aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2017-07-31 17:37:19 -0700
committerKeith Seitz <keiths@redhat.com>2017-07-31 17:37:19 -0700
commit2a95a158fae932f758d75a1178a40d4cc4804ff0 (patch)
treea3be9ceedd34433da1dbe4d5dbf89cc6a4b0e852
parent8fc31fb04a8fe0088a7a5e322a17bec7fbb6162a (diff)
parentab27f80c5dceaa23c4ba7f62c0d5d22a5d5dd7a1 (diff)
downloadbinutils-2a95a158fae932f758d75a1178a40d4cc4804ff0.zip
binutils-2a95a158fae932f758d75a1178a40d4cc4804ff0.tar.gz
binutils-2a95a158fae932f758d75a1178a40d4cc4804ff0.tar.bz2
Update w/HEAD.
Problems: gdb/compile/compile-c-support.c
-rw-r--r--bfd/ChangeLog645
-rw-r--r--bfd/aout-adobe.c1
-rw-r--r--bfd/aout-target.h3
-rw-r--r--bfd/aout-tic30.c3
-rw-r--r--bfd/arc-got.h7
-rw-r--r--bfd/bfd-in2.h19
-rw-r--r--bfd/binary.c5
-rw-r--r--bfd/bout.c1
-rw-r--r--bfd/coff-alpha.c1
-rw-r--r--bfd/coff-mips.c1
-rw-r--r--bfd/coff-rs6000.c1
-rw-r--r--bfd/coff-sh.c3
-rw-r--r--bfd/coff64-rs6000.c2
-rw-r--r--bfd/coffcode.h4
-rw-r--r--bfd/compress.c2
-rw-r--r--bfd/config.bfd15
-rw-r--r--bfd/cpu-mips.c2
-rw-r--r--bfd/elf-bfd.h25
-rw-r--r--bfd/elf-properties.c19
-rw-r--r--bfd/elf-s390.h29
-rw-r--r--bfd/elf.c114
-rw-r--r--bfd/elf32-arc.c89
-rw-r--r--bfd/elf32-arm.c60
-rw-r--r--bfd/elf32-i386.c618
-rw-r--r--bfd/elf32-s390.c21
-rw-r--r--bfd/elf32-score.c8
-rw-r--r--bfd/elf32-score7.c16
-rw-r--r--bfd/elf32-sh.c2
-rw-r--r--bfd/elf32-v850.c4
-rw-r--r--bfd/elf32-xtensa.c60
-rw-r--r--bfd/elf64-mips.c19
-rw-r--r--bfd/elf64-ppc.c82
-rw-r--r--bfd/elf64-ppc.h3
-rw-r--r--bfd/elf64-s390.c102
-rw-r--r--bfd/elf64-x86-64.c531
-rw-r--r--bfd/elflink.c241
-rw-r--r--bfd/elfnn-aarch64.c181
-rw-r--r--bfd/elfxx-mips.c16
-rw-r--r--bfd/elfxx-target.h6
-rw-r--r--bfd/i386msdos.c1
-rw-r--r--bfd/i386os9k.c1
-rw-r--r--bfd/ieee.c36
-rw-r--r--bfd/ihex.c1
-rw-r--r--bfd/libbfd-in.h3
-rw-r--r--bfd/libbfd.c18
-rw-r--r--bfd/libbfd.h3
-rw-r--r--bfd/libieee.h1
-rw-r--r--bfd/linker.c39
-rw-r--r--bfd/mach-o-target.c1
-rw-r--r--bfd/mmo.c1
-rw-r--r--bfd/nlm-target.h1
-rw-r--r--bfd/oasys.c1
-rw-r--r--bfd/opncls.c18
-rw-r--r--bfd/peXXigen.c5
-rw-r--r--bfd/pef.c1
-rw-r--r--bfd/plugin.c1
-rw-r--r--bfd/ppcboot.c1
-rw-r--r--bfd/reloc.c7
-rw-r--r--bfd/som.c10
-rw-r--r--bfd/srec.c1
-rw-r--r--bfd/targets.c8
-rw-r--r--bfd/tekhex.c7
-rw-r--r--bfd/versados.c13
-rw-r--r--bfd/version.h2
-rw-r--r--bfd/vms-alpha.c212
-rw-r--r--bfd/vms-misc.c8
-rw-r--r--bfd/vms.h4
-rw-r--r--bfd/xsym.c1
-rw-r--r--binutils/ChangeLog79
-rw-r--r--binutils/bucomm.c2
-rw-r--r--binutils/dwarf.c154
-rw-r--r--binutils/objdump.c58
-rw-r--r--binutils/readelf.c65
-rw-r--r--binutils/strings.c5
-rw-r--r--binutils/sysinfo.y15
-rw-r--r--binutils/testsuite/binutils-all/i386/empty.d9
-rw-r--r--binutils/testsuite/binutils-all/i386/empty.s27
-rw-r--r--binutils/testsuite/binutils-all/i386/ibt.d9
-rw-r--r--binutils/testsuite/binutils-all/i386/ibt.s27
-rw-r--r--binutils/testsuite/binutils-all/i386/shstk.d9
-rw-r--r--binutils/testsuite/binutils-all/i386/shstk.s27
-rw-r--r--binutils/testsuite/binutils-all/x86-64/empty-x32.d10
-rw-r--r--binutils/testsuite/binutils-all/x86-64/empty.d9
-rw-r--r--binutils/testsuite/binutils-all/x86-64/empty.s27
-rw-r--r--binutils/testsuite/binutils-all/x86-64/ibt-x32.d10
-rw-r--r--binutils/testsuite/binutils-all/x86-64/ibt.d9
-rw-r--r--binutils/testsuite/binutils-all/x86-64/ibt.s27
-rw-r--r--binutils/testsuite/binutils-all/x86-64/shstk-x32.d10
-rw-r--r--binutils/testsuite/binutils-all/x86-64/shstk.d9
-rw-r--r--binutils/testsuite/binutils-all/x86-64/shstk.s27
-rw-r--r--elfcpp/ChangeLog10
-rw-r--r--elfcpp/elfcpp.h7
-rw-r--r--elfcpp/powerpc.h8
-rw-r--r--gas/ChangeLog299
-rw-r--r--gas/NEWS3
-rw-r--r--gas/config/obj-elf.c15
-rw-r--r--gas/config/tc-aarch64.c11
-rw-r--r--gas/config/tc-arc.c24
-rw-r--r--gas/config/tc-arc.h1
-rw-r--r--gas/config/tc-arm.c1048
-rw-r--r--gas/config/tc-arm.h4
-rw-r--r--gas/config/tc-i386.c9
-rw-r--r--gas/config/tc-riscv.c16
-rw-r--r--gas/config/tc-xtensa.c32
-rw-r--r--gas/config/tc-xtensa.h9
-rw-r--r--gas/doc/c-aarch64.texi2
-rw-r--r--gas/doc/c-arm.texi4
-rw-r--r--gas/testsuite/gas/aarch64/diagnostic.l1
-rw-r--r--gas/testsuite/gas/aarch64/diagnostic.s2
-rw-r--r--gas/testsuite/gas/arc/asm-errors-3.d2
-rw-r--r--gas/testsuite/gas/arc/asm-errors-3.err7
-rw-r--r--gas/testsuite/gas/arc/asm-errors-3.s14
-rw-r--r--gas/testsuite/gas/arm/armv8-a+fp.d2
-rw-r--r--gas/testsuite/gas/arm/armv8-a+simd.d2
-rw-r--r--gas/testsuite/gas/arm/armv8-a-bad.d4
-rw-r--r--gas/testsuite/gas/arm/armv8-a-bad.l96
-rw-r--r--gas/testsuite/gas/arm/armv8-a-barrier-arm.d2
-rw-r--r--gas/testsuite/gas/arm/armv8-a-barrier-thumb.d2
-rw-r--r--gas/testsuite/gas/arm/armv8-a-it-bad.d5
-rw-r--r--gas/testsuite/gas/arm/armv8-a-it-bad.l18
-rw-r--r--gas/testsuite/gas/arm/armv8-a.d2
-rw-r--r--gas/testsuite/gas/arm/armv8-ar+fp.s (renamed from gas/testsuite/gas/arm/armv8-a+fp.s)1
-rw-r--r--gas/testsuite/gas/arm/armv8-ar+simd.s (renamed from gas/testsuite/gas/arm/armv8-a+simd.s)1
-rw-r--r--gas/testsuite/gas/arm/armv8-ar-bad.l96
-rw-r--r--gas/testsuite/gas/arm/armv8-ar-bad.s (renamed from gas/testsuite/gas/arm/armv8-a-bad.s)1
-rw-r--r--gas/testsuite/gas/arm/armv8-ar-barrier.s (renamed from gas/testsuite/gas/arm/armv8-a-barrier.s)0
-rw-r--r--gas/testsuite/gas/arm/armv8-ar-it-bad.l18
-rw-r--r--gas/testsuite/gas/arm/armv8-ar-it-bad.s (renamed from gas/testsuite/gas/arm/armv8-a-it-bad.s)1
-rw-r--r--gas/testsuite/gas/arm/armv8-ar.s (renamed from gas/testsuite/gas/arm/armv8-a.s)0
-rw-r--r--gas/testsuite/gas/arm/armv8-r+fp.d117
-rw-r--r--gas/testsuite/gas/arm/armv8-r+simd.d81
-rw-r--r--gas/testsuite/gas/arm/armv8-r-bad.d4
-rw-r--r--gas/testsuite/gas/arm/armv8-r-barrier-arm.d24
-rw-r--r--gas/testsuite/gas/arm/armv8-r-barrier-thumb.d25
-rw-r--r--gas/testsuite/gas/arm/armv8-r-it-bad.d4
-rw-r--r--gas/testsuite/gas/arm/armv8-r.d104
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv1.d1
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv2.d1
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv2a.d1
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv2s.d1
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv3.d1
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv3m.d1
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv8-r+crypto.d18
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv8-r+fp.d17
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv8-r+simd.d18
-rw-r--r--gas/testsuite/gas/arm/attr-march-armv8-r.d16
-rw-r--r--gas/testsuite/gas/arm/crc32-armv8-a-bad.d (renamed from gas/testsuite/gas/arm/crc32-bad.d)3
-rw-r--r--gas/testsuite/gas/arm/crc32-armv8-a.d (renamed from gas/testsuite/gas/arm/crc32.d)3
-rw-r--r--gas/testsuite/gas/arm/crc32-armv8-ar-bad.s (renamed from gas/testsuite/gas/arm/crc32-bad.s)0
-rw-r--r--gas/testsuite/gas/arm/crc32-armv8-ar.s (renamed from gas/testsuite/gas/arm/crc32.s)0
-rw-r--r--gas/testsuite/gas/arm/crc32-armv8-r-bad.d23
-rw-r--r--gas/testsuite/gas/arm/crc32-armv8-r.d23
-rw-r--r--gas/testsuite/gas/arm/forbid-armv7-idiv-ext.d4
-rw-r--r--gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l3
-rw-r--r--gas/testsuite/gas/arm/ld-sp-warn.l1
-rw-r--r--gas/testsuite/gas/arm/mask_1-armv8-a.d (renamed from gas/testsuite/gas/arm/mask_1.d)3
-rw-r--r--gas/testsuite/gas/arm/mask_1-armv8-ar.s (renamed from gas/testsuite/gas/arm/mask_1.s)0
-rw-r--r--gas/testsuite/gas/arm/mask_1-armv8-r.d29
-rw-r--r--gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d4
-rw-r--r--gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l192
-rw-r--r--gas/testsuite/gas/arm/sp-pc-validations-bad-t.d3
-rw-r--r--gas/testsuite/gas/arm/sp-pc-validations-bad-t.s2
-rw-r--r--gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d4
-rw-r--r--gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l17
-rw-r--r--gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d25
-rw-r--r--gas/testsuite/gas/arm/sp-usage-thumb2-relax.s27
-rw-r--r--gas/testsuite/gas/arm/strex-bad-t.d1
-rw-r--r--gas/testsuite/gas/elf/elf.exp1
-rw-r--r--gas/testsuite/gas/elf/pr21661.d2
-rw-r--r--gas/testsuite/gas/elf/pr21661.l3
-rw-r--r--gas/testsuite/gas/elf/pr21661.s4
-rw-r--r--gas/testsuite/gas/i386/cet-intel.d12
-rw-r--r--gas/testsuite/gas/i386/cet.d12
-rw-r--r--gas/testsuite/gas/i386/cet.s12
-rw-r--r--gas/testsuite/gas/i386/mpx.d4
-rw-r--r--gas/testsuite/gas/i386/mpx.s12
-rw-r--r--gas/testsuite/gas/i386/notrack-intel.d16
-rw-r--r--gas/testsuite/gas/i386/notrack.d16
-rw-r--r--gas/testsuite/gas/i386/notrack.s22
-rw-r--r--gas/testsuite/gas/i386/notrackbad.l54
-rw-r--r--gas/testsuite/gas/i386/notrackbad.s4
-rw-r--r--gas/testsuite/gas/i386/x86-64-cet-intel.d16
-rw-r--r--gas/testsuite/gas/i386/x86-64-cet.d16
-rw-r--r--gas/testsuite/gas/i386/x86-64-cet.s16
-rw-r--r--gas/testsuite/gas/i386/x86-64-mpx.d4
-rw-r--r--gas/testsuite/gas/i386/x86-64-mpx.s12
-rw-r--r--gas/testsuite/gas/i386/x86-64-notrack-intel.d32
-rw-r--r--gas/testsuite/gas/i386/x86-64-notrack.d32
-rw-r--r--gas/testsuite/gas/i386/x86-64-notrack.s43
-rw-r--r--gas/testsuite/gas/i386/x86-64-notrackbad.l54
-rw-r--r--gas/testsuite/gas/i386/x86-64-notrackbad.s4
-rw-r--r--gas/testsuite/gas/s390/esa-g5.d2
-rw-r--r--gas/testsuite/gas/s390/esa-g5.s2
-rw-r--r--gas/testsuite/gas/s390/zarch-z196.d2
-rw-r--r--gas/testsuite/gas/s390/zarch-z196.s2
-rw-r--r--gas/testsuite/gas/s390/zarch-z990.d3
-rw-r--r--gas/testsuite/gas/s390/zarch-z990.s3
-rw-r--r--gas/testsuite/gas/s390/zarch-zEC12.d23
-rw-r--r--gas/testsuite/gas/s390/zarch-zEC12.s7
-rw-r--r--gdb/ChangeLog953
-rw-r--r--gdb/MAINTAINERS2
-rw-r--r--gdb/Makefile.in12
-rw-r--r--gdb/NEWS23
-rw-r--r--gdb/aarch64-linux-tdep.c2
-rw-r--r--gdb/aarch64-tdep.c8
-rw-r--r--gdb/ada-lang.c103
-rw-r--r--gdb/ada-lex.l10
-rw-r--r--gdb/ada-valprint.c3
-rw-r--r--gdb/alpha-tdep.c29
-rw-r--r--gdb/amd64-linux-tdep.c2
-rw-r--r--gdb/arc-tdep.c63
-rw-r--r--gdb/arch-utils.c8
-rw-r--r--gdb/arch-utils.h7
-rw-r--r--gdb/arm-linux-tdep.c2
-rw-r--r--gdb/arm-tdep.c5
-rw-r--r--gdb/break-catch-sig.c27
-rw-r--r--gdb/break-catch-syscall.c26
-rw-r--r--gdb/break-catch-throw.c46
-rw-r--r--gdb/breakpoint.c471
-rw-r--r--gdb/breakpoint.h30
-rw-r--r--gdb/build-id.c7
-rw-r--r--gdb/c-valprint.c4
-rw-r--r--gdb/charset.c13
-rw-r--r--gdb/charset.h4
-rw-r--r--gdb/cli/cli-cmds.c21
-rw-r--r--gdb/cli/cli-decode.c11
-rw-r--r--gdb/cli/cli-decode.h5
-rw-r--r--gdb/cli/cli-dump.c16
-rw-r--r--gdb/common/agent.h11
-rw-r--r--gdb/common/byte-vector.h62
-rw-r--r--gdb/common/common-gdbthread.h25
-rw-r--r--gdb/common/common-inferior.h33
-rw-r--r--gdb/common/common-utils.c24
-rw-r--r--gdb/common/common-utils.h4
-rw-r--r--gdb/common/def-vector.h36
-rw-r--r--gdb/common/default-init-alloc.h67
-rw-r--r--gdb/common/diagnostics.h56
-rw-r--r--gdb/common/environ.c202
-rw-r--r--gdb/common/environ.h70
-rw-r--r--gdb/common/job-control.c93
-rw-r--r--gdb/common/job-control.h38
-rw-r--r--gdb/common/preprocessor.h4
-rw-r--r--gdb/common/vec.h25
-rw-r--r--gdb/compile/compile-c-support.c4
-rw-r--r--gdb/compile/compile-cplus-types.c3
-rwxr-xr-xgdb/configure7
-rw-r--r--gdb/configure.nat22
-rw-r--r--gdb/corefile.c4
-rw-r--r--gdb/ctf.c4
-rw-r--r--gdb/darwin-nat.c17
-rw-r--r--gdb/defs.h47
-rw-r--r--gdb/doc/ChangeLog20
-rw-r--r--gdb/doc/gdb.texinfo45
-rw-r--r--gdb/doc/guile.texi2
-rw-r--r--gdb/doc/python.texi2
-rw-r--r--gdb/dtrace-probe.c3
-rw-r--r--gdb/dwarf2loc.c478
-rw-r--r--gdb/dwarf2read.c758
-rw-r--r--gdb/event-loop.c2
-rw-r--r--gdb/f-valprint.c3
-rw-r--r--gdb/features/i386/i386-linux.c6
-rw-r--r--gdb/features/i386/i386-linux.xml2
-rw-r--r--gdb/findvar.c105
-rw-r--r--gdb/fork-child.c629
-rw-r--r--gdb/frame.c23
-rw-r--r--gdb/gdb_regex.c57
-rw-r--r--gdb/gdb_regex.h39
-rw-r--r--gdb/gdbarch.c24
-rw-r--r--gdb/gdbarch.h15
-rwxr-xr-xgdb/gdbarch.sh12
-rw-r--r--gdb/gdbcore.h6
-rw-r--r--gdb/gdbserver/ChangeLog127
-rw-r--r--gdb/gdbserver/Makefile.in20
-rwxr-xr-xgdb/gdbserver/configure13
-rw-r--r--gdb/gdbserver/configure.srv6
-rw-r--r--gdb/gdbserver/fork-child.c116
-rw-r--r--gdb/gdbserver/inferiors.c9
-rw-r--r--gdb/gdbserver/linux-low.c107
-rw-r--r--gdb/gdbserver/lynx-low.c51
-rw-r--r--gdb/gdbserver/nto-low.c10
-rw-r--r--gdb/gdbserver/server.c277
-rw-r--r--gdb/gdbserver/server.h14
-rw-r--r--gdb/gdbserver/spu-low.c44
-rw-r--r--gdb/gdbserver/target.c27
-rw-r--r--gdb/gdbserver/target.h13
-rw-r--r--gdb/gdbserver/win32-low.c23
-rw-r--r--gdb/gdbthread.h5
-rw-r--r--gdb/gnu-nat.c8
-rw-r--r--gdb/i386-linux-tdep.c2
-rw-r--r--gdb/i386-tdep.c2
-rw-r--r--gdb/ia64-libunwind-tdep.c3
-rw-r--r--gdb/ia64-tdep.c15
-rw-r--r--gdb/inf-ptrace.c15
-rw-r--r--gdb/infcmd.c42
-rw-r--r--gdb/inferior.c4
-rw-r--r--gdb/inferior.h40
-rw-r--r--gdb/inflow.c64
-rw-r--r--gdb/infrun.c8
-rw-r--r--gdb/linux-nat.c4
-rw-r--r--gdb/linux-tdep.c85
-rw-r--r--gdb/main.c2
-rw-r--r--gdb/mi/mi-cmd-break.c2
-rw-r--r--gdb/mi/mi-cmd-env.c18
-rw-r--r--gdb/mi/mi-main.c32
-rw-r--r--gdb/mips-linux-nat.c11
-rw-r--r--gdb/mips-linux-tdep.c11
-rw-r--r--gdb/mips-linux-tdep.h6
-rw-r--r--gdb/mips-tdep.c56
-rw-r--r--gdb/mn10300-tdep.c9
-rw-r--r--gdb/nat/fork-inferior.c595
-rw-r--r--gdb/nat/fork-inferior.h106
-rw-r--r--gdb/nat/linux-ptrace.c2
-rw-r--r--gdb/nat/x86-dregs.c16
-rw-r--r--gdb/printcmd.c198
-rw-r--r--gdb/probe.c19
-rw-r--r--gdb/procfs.c7
-rw-r--r--gdb/python/py-unwind.c25
-rw-r--r--gdb/record-full.c17
-rw-r--r--gdb/regcache.c163
-rw-r--r--gdb/regcache.h28
-rw-r--r--gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat1
-rw-r--r--gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat3
-rw-r--r--gdb/regformats/regdef.h5
-rw-r--r--gdb/remote.c30
-rw-r--r--gdb/rs6000-aix-tdep.c1
-rw-r--r--gdb/rs6000-tdep.c2
-rw-r--r--gdb/s390-linux-tdep.c2
-rw-r--r--gdb/sh-tdep.c6
-rw-r--r--gdb/sh64-tdep.c48
-rw-r--r--gdb/skip.c24
-rw-r--r--gdb/solib.c7
-rw-r--r--gdb/spu-tdep.c2
-rw-r--r--gdb/symfile.c18
-rw-r--r--gdb/symfile.h4
-rw-r--r--gdb/symtab.c42
-rw-r--r--gdb/target-descriptions.c197
-rw-r--r--gdb/target.h31
-rw-r--r--gdb/target/target.h14
-rw-r--r--gdb/terminal.h12
-rw-r--r--gdb/testsuite/ChangeLog88
-rw-r--r--gdb/testsuite/gdb.arch/aarch64-fp.exp9
-rw-r--r--gdb/testsuite/gdb.arch/altivec-regs.exp20
-rw-r--r--gdb/testsuite/gdb.arch/e500-regs.exp12
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power9.exp4
-rw-r--r--gdb/testsuite/gdb.arch/powerpc-power9.s2
-rw-r--r--gdb/testsuite/gdb.arch/s390-vregs.exp17
-rw-r--r--gdb/testsuite/gdb.arch/vsx-regs.exp20
-rw-r--r--gdb/testsuite/gdb.base/dump.exp7
-rw-r--r--gdb/testsuite/gdb.base/funcargs.exp12
-rw-r--r--gdb/testsuite/gdb.base/gnu_vector.exp7
-rw-r--r--gdb/testsuite/gdb.base/startup-with-shell.c29
-rw-r--r--gdb/testsuite/gdb.base/startup-with-shell.exp89
-rw-r--r--gdb/testsuite/gdb.dwarf2/formdata16.exp40
-rw-r--r--gdb/testsuite/gdb.dwarf2/implptrpiece.exp10
-rw-r--r--gdb/testsuite/gdb.dwarf2/nonvar-access.exp31
-rw-r--r--gdb/testsuite/gdb.dwarf2/var-access.c25
-rw-r--r--gdb/testsuite/gdb.dwarf2/var-access.exp345
-rw-r--r--gdb/testsuite/gdb.python/py-inferior.exp12
-rw-r--r--gdb/testsuite/gdb.reverse/i386-sse-reverse.exp94
-rw-r--r--gdb/testsuite/gdb.server/non-existing-program.exp12
-rw-r--r--gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp8
-rw-r--r--gdb/testsuite/lib/gdb-utils.exp2
-rw-r--r--gdb/testsuite/lib/gdb.exp15
-rw-r--r--gdb/top.c1
-rw-r--r--gdb/tracefile-tfile.c4
-rw-r--r--gdb/tracefile.c10
-rw-r--r--gdb/tracepoint.c20
-rw-r--r--gdb/unittests/environ-selftests.c159
-rw-r--r--gdb/utils.c57
-rw-r--r--gdb/valops.c7
-rw-r--r--gdb/valprint.c252
-rw-r--r--gdb/valprint.h9
-rw-r--r--gdb/value.h9
-rw-r--r--gdb/warning.m47
-rw-r--r--gdb/x86-linux-nat.c10
-rw-r--r--gdb/xtensa-tdep.c7
-rw-r--r--gold/ChangeLog79
-rw-r--r--gold/aarch64.cc73
-rw-r--r--gold/options.h4
-rw-r--r--gold/powerpc.cc464
-rw-r--r--gold/symtab.h20
-rw-r--r--include/ChangeLog63
-rw-r--r--include/bfdlink.h15
-rw-r--r--include/dis-asm.h8
-rw-r--r--include/elf/arm.h1
-rw-r--r--include/elf/common.h4
-rw-r--r--include/elf/ppc64.h1
-rw-r--r--include/elf/s390.h3
-rw-r--r--include/opcode/arm.h20
-rw-r--r--ld/ChangeLog546
-rw-r--r--ld/Makefile.am5
-rw-r--r--ld/Makefile.in6
-rw-r--r--ld/NEWS21
-rw-r--r--ld/config.in4
-rwxr-xr-xld/configure26
-rw-r--r--ld/configure.ac18
-rw-r--r--ld/configure.tgt2
-rw-r--r--ld/emulparams/avr1.sh8
-rw-r--r--ld/emulparams/avr2.sh8
-rw-r--r--ld/emulparams/avr25.sh8
-rw-r--r--ld/emulparams/avr3.sh8
-rw-r--r--ld/emulparams/avr31.sh8
-rw-r--r--ld/emulparams/avr35.sh8
-rw-r--r--ld/emulparams/avr4.sh8
-rw-r--r--ld/emulparams/avr5.sh8
-rw-r--r--ld/emulparams/avr51.sh8
-rw-r--r--ld/emulparams/avr6.sh8
-rw-r--r--ld/emulparams/avrtiny.sh10
-rw-r--r--ld/emulparams/avrxmega1.sh8
-rw-r--r--ld/emulparams/avrxmega2.sh8
-rw-r--r--ld/emulparams/avrxmega3.sh8
-rw-r--r--ld/emulparams/avrxmega4.sh8
-rw-r--r--ld/emulparams/avrxmega5.sh8
-rw-r--r--ld/emulparams/avrxmega6.sh8
-rw-r--r--ld/emulparams/avrxmega7.sh8
-rw-r--r--ld/emulparams/call_nop.sh5
-rw-r--r--ld/emulparams/cet.sh17
-rw-r--r--ld/emulparams/elf32_x86_64.sh2
-rw-r--r--ld/emulparams/elf64_s390.sh1
-rw-r--r--ld/emulparams/elf_i386.sh2
-rw-r--r--ld/emulparams/elf_x86_64.sh1
-rw-r--r--ld/emultempl/elf32.em17
-rw-r--r--ld/emultempl/ppc64elf.em65
-rw-r--r--ld/emultempl/s390.em64
-rw-r--r--ld/gen-doc.texi1
-rw-r--r--ld/ld.h5
-rw-r--r--ld/ld.texinfo86
-rw-r--r--ld/ldgram.y4
-rw-r--r--ld/ldlang.c260
-rw-r--r--ld/ldlex.h1
-rw-r--r--ld/ldlex.l1
-rw-r--r--ld/ldmain.c9
-rw-r--r--ld/lexsup.c8
-rw-r--r--ld/scripttempl/avr.sc69
-rw-r--r--ld/scripttempl/avrtiny.sc262
-rw-r--r--ld/testsuite/ld-aarch64/aarch64-elf.exp6
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-2.d7
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-eliminate.d4
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-exe-2.s32
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s7
-rw-r--r--ld/testsuite/ld-aarch64/copy-reloc-so.s19
-rw-r--r--ld/testsuite/ld-aarch64/pcrel.s6
-rw-r--r--ld/testsuite/ld-aarch64/pcrel_pic_defined.d10
-rw-r--r--ld/testsuite/ld-aarch64/pcrel_pic_defined_local.d5
-rw-r--r--ld/testsuite/ld-aarch64/pcrel_pic_undefined.d16
-rw-r--r--ld/testsuite/ld-arc/tls_ie-01.d4
-rw-r--r--ld/testsuite/ld-arm/arm-elf.exp6
-rw-r--r--ld/testsuite/ld-arm/attr-merge-11.attr9
-rw-r--r--ld/testsuite/ld-arm/attr-merge-11a.s5
-rw-r--r--ld/testsuite/ld-arm/attr-merge-11b.s5
-rw-r--r--ld/testsuite/ld-arm/attr-merge-12.attr9
-rw-r--r--ld/testsuite/ld-arm/attr-merge-12a.s5
-rw-r--r--ld/testsuite/ld-arm/attr-merge-12b.s5
-rw-r--r--ld/testsuite/ld-elf/elf.exp4
-rw-r--r--ld/testsuite/ld-elf/group11.d6
-rw-r--r--ld/testsuite/ld-elf/group12.d6
-rw-r--r--ld/testsuite/ld-elf/group12.ld14
-rw-r--r--ld/testsuite/ld-elf/now-3.d2
-rw-r--r--ld/testsuite/ld-elf/now-4.d2
-rw-r--r--ld/testsuite/ld-elf/pr14156a.d1
-rw-r--r--ld/testsuite/ld-elf/pr21562a.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562a.s12
-rw-r--r--ld/testsuite/ld-elf/pr21562a.t3
-rw-r--r--ld/testsuite/ld-elf/pr21562b.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562b.s12
-rw-r--r--ld/testsuite/ld-elf/pr21562b.t5
-rw-r--r--ld/testsuite/ld-elf/pr21562c.d13
-rw-r--r--ld/testsuite/ld-elf/pr21562c.t7
-rw-r--r--ld/testsuite/ld-elf/pr21562d.d13
-rw-r--r--ld/testsuite/ld-elf/pr21562d.t5
-rw-r--r--ld/testsuite/ld-elf/pr21562e.d10
-rw-r--r--ld/testsuite/ld-elf/pr21562f.d10
-rw-r--r--ld/testsuite/ld-elf/pr21562g.d10
-rw-r--r--ld/testsuite/ld-elf/pr21562h.d10
-rw-r--r--ld/testsuite/ld-elf/pr21562i.d13
-rw-r--r--ld/testsuite/ld-elf/pr21562j.d13
-rw-r--r--ld/testsuite/ld-elf/pr21562k.d13
-rw-r--r--ld/testsuite/ld-elf/pr21562l.d13
-rw-r--r--ld/testsuite/ld-elf/pr21562m.d13
-rw-r--r--ld/testsuite/ld-elf/pr21562n.d13
-rw-r--r--ld/testsuite/ld-elf/rpath-1.d2
-rw-r--r--ld/testsuite/ld-elf/rpath-2.d2
-rw-r--r--ld/testsuite/ld-elf/shared.exp23
-rw-r--r--ld/testsuite/ld-elf/sizeof.s15
-rw-r--r--ld/testsuite/ld-elf/sizeofa.d12
-rw-r--r--ld/testsuite/ld-elf/sizeofb.d13
-rw-r--r--ld/testsuite/ld-elf/sizeofc.d12
-rw-r--r--ld/testsuite/ld-elf/startof.s15
-rw-r--r--ld/testsuite/ld-elf/startofa.d12
-rw-r--r--ld/testsuite/ld-elf/startofb.d13
-rw-r--r--ld/testsuite/ld-elf/startofc.d12
-rw-r--r--ld/testsuite/ld-elfvsb/elfvsb.exp5
-rw-r--r--ld/testsuite/ld-gc/gc.exp11
-rw-r--r--ld/testsuite/ld-gc/pr19161.d2
-rw-r--r--ld/testsuite/ld-gc/pr20022.d13
-rw-r--r--ld/testsuite/ld-gc/pr20022a.s9
-rw-r--r--ld/testsuite/ld-gc/pr20022b.s8
-rw-r--r--ld/testsuite/ld-gc/start.d2
-rw-r--r--ld/testsuite/ld-i386/call3c.d12
-rw-r--r--ld/testsuite/ld-i386/i386.exp142
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-1.d51
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-1.s54
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2.s54
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2a.d52
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2b.d9
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2c.d52
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-2d.d9
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3.s38
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3a.d52
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3b.d5
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3c.d52
-rw-r--r--ld/testsuite/ld-i386/ibt-plt-3d.d9
-rw-r--r--ld/testsuite/ld-i386/no-plt.exp23
-rw-r--r--ld/testsuite/ld-i386/plt-main-ibt.dd7
-rw-r--r--ld/testsuite/ld-i386/plt-pie-ibt.dd7
-rw-r--r--ld/testsuite/ld-i386/property-x86-empty.s27
-rw-r--r--ld/testsuite/ld-i386/property-x86-ibt.s27
-rw-r--r--ld/testsuite/ld-i386/property-x86-ibt1a.d6
-rw-r--r--ld/testsuite/ld-i386/property-x86-ibt1b.d6
-rw-r--r--ld/testsuite/ld-i386/property-x86-ibt2.d9
-rw-r--r--ld/testsuite/ld-i386/property-x86-ibt3a.d11
-rw-r--r--ld/testsuite/ld-i386/property-x86-ibt3b.d11
-rw-r--r--ld/testsuite/ld-i386/property-x86-ibt4.d9
-rw-r--r--ld/testsuite/ld-i386/property-x86-ibt5.d9
-rw-r--r--ld/testsuite/ld-i386/property-x86-shstk.s27
-rw-r--r--ld/testsuite/ld-i386/property-x86-shstk1a.d6
-rw-r--r--ld/testsuite/ld-i386/property-x86-shstk1b.d6
-rw-r--r--ld/testsuite/ld-i386/property-x86-shstk2.d9
-rw-r--r--ld/testsuite/ld-i386/property-x86-shstk3a.d11
-rw-r--r--ld/testsuite/ld-i386/property-x86-shstk3b.d11
-rw-r--r--ld/testsuite/ld-i386/property-x86-shstk4.d9
-rw-r--r--ld/testsuite/ld-i386/property-x86-shstk5.d9
-rw-r--r--ld/testsuite/ld-i386/weakundef1.c16
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-1-local-x86.d3
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-1-local-x86.map3
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-1-x86.d3
-rw-r--r--ld/testsuite/ld-ifunc/ifunc-1-x86.map3
-rw-r--r--ld/testsuite/ld-mips-elf/lsi-4010-isa.d23
-rw-r--r--ld/testsuite/ld-mips-elf/mips-elf.exp3
-rw-r--r--ld/testsuite/ld-nds32/diff.d6
-rw-r--r--ld/testsuite/ld-powerpc/elfv2so.d2
-rw-r--r--ld/testsuite/ld-powerpc/powerpc.exp12
-rw-r--r--ld/testsuite/ld-powerpc/tlsopt5.d4
-rw-r--r--ld/testsuite/ld-powerpc/tocsave1.s24
-rw-r--r--ld/testsuite/ld-powerpc/tocsave1a.d15
-rw-r--r--ld/testsuite/ld-powerpc/tocsave1s.d9
-rw-r--r--ld/testsuite/ld-powerpc/tocsave2.s24
-rw-r--r--ld/testsuite/ld-powerpc/tocsave2a.d18
-rw-r--r--ld/testsuite/ld-powerpc/tocsave2s.d13
-rw-r--r--ld/testsuite/ld-powerpc/tocsavelib.s5
-rw-r--r--ld/testsuite/ld-scripts/crossref.exp5
-rw-r--r--ld/testsuite/ld-shared/shared.exp4
-rw-r--r--ld/testsuite/ld-size/size.exp13
-rw-r--r--ld/testsuite/ld-srec/srec.exp9
-rw-r--r--ld/testsuite/ld-unique/pr21529.d5
-rw-r--r--ld/testsuite/ld-unique/pr21529.s8
-rw-r--r--ld/testsuite/ld-unique/unique.exp7
-rw-r--r--ld/testsuite/ld-x86-64/call1c.d12
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-1-x32.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-1.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-1.s45
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2.s45
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2a.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2b.d9
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2c.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-2d.d9
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3.s17
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3a.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d5
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3b.d5
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3c.d43
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d10
-rw-r--r--ld/testsuite/ld-x86-64/ibt-plt-3d.d10
-rw-r--r--ld/testsuite/ld-x86-64/lea1a.d2
-rw-r--r--ld/testsuite/ld-x86-64/lea1b.d2
-rw-r--r--ld/testsuite/ld-x86-64/lea1d.d2
-rw-r--r--ld/testsuite/ld-x86-64/lea1e.d2
-rw-r--r--ld/testsuite/ld-x86-64/no-plt.exp9
-rw-r--r--ld/testsuite/ld-x86-64/plt-main-ibt-now.rd3
-rw-r--r--ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd7
-rw-r--r--ld/testsuite/ld-x86-64/plt-main-ibt.dd7
-rw-r--r--ld/testsuite/ld-x86-64/pr21481b.S4
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-3-x32.d10
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-3.d2
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-3.s28
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-4a-x32.d10
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-4a.d2
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-4b-x32.d10
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-4b.d2
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-4b.s15
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-empty.s27
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt.s27
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt1a-x32.d6
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt1a.d6
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt1b-x32.d6
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt1b.d6
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt2-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt2.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt3a.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt3b.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt4-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt4.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt5-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-ibt5.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk.s27
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk1a-x32.d6
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk1a.d6
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk1b-x32.d6
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk1b.d6
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk2-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk2.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk3a.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk3b.d11
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk4-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk4.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk5-x32.d9
-rw-r--r--ld/testsuite/ld-x86-64/property-x86-shstk5.d9
-rw-r--r--ld/testsuite/ld-x86-64/x86-64.exp224
-rw-r--r--ld/testsuite/lib/ld-lib.exp19
-rw-r--r--libiberty/ChangeLog102
-rw-r--r--libiberty/cp-demangle.c28
-rw-r--r--libiberty/cp-demangle.h4
-rw-r--r--libiberty/cplus-dem.c16
-rw-r--r--libiberty/d-demangle.c518
-rw-r--r--libiberty/testsuite/d-demangle-expected252
-rw-r--r--libiberty/testsuite/demangle-expected15
-rw-r--r--opcodes/ChangeLog102
-rw-r--r--opcodes/aarch64-dis.c5
-rw-r--r--opcodes/arm-dis.c4
-rw-r--r--opcodes/bfin-dis.c8
-rw-r--r--opcodes/disassemble.h8
-rw-r--r--opcodes/i386-dis.c49
-rw-r--r--opcodes/i386-opc.tbl8
-rw-r--r--opcodes/i386-tbl.h24
-rw-r--r--opcodes/ia64-dis.c2
-rw-r--r--opcodes/mips-dis.c2
-rw-r--r--opcodes/riscv-opc.c4
-rw-r--r--opcodes/rl78-decode.c820
-rw-r--r--opcodes/rl78-decode.opc6
-rw-r--r--opcodes/rx-decode.c1448
-rw-r--r--opcodes/rx-decode.opc24
-rw-r--r--opcodes/s390-opc.txt7
-rw-r--r--opcodes/score-dis.c1
-rw-r--r--opcodes/score7-dis.c3
-rw-r--r--opcodes/spu-dis.c2
-rw-r--r--sim/microblaze/ChangeLog4
-rw-r--r--sim/microblaze/interp.c2
657 files changed, 18318 insertions, 6923 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 11a474e..c2491d5 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,648 @@
+2017-06-26 Pedro Alves <palves@redhat.com>
+
+ PR binutils/21665
+ * libbfd.c (_bfd_generic_get_section_contents): Add "count", not
+ "sz".
+
+2017-06-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/21665
+ * libbfd.c (_bfd_generic_get_section_contents_in_window): Add
+ a missing line.
+
+2017-06-26 Maciej W. Rozycki <macro@imgtec.com>
+
+ * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit.
+ * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set
+ E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'.
+ (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending
+ `bfd_mach_mips6000' rather than `bfd_mach_mips4000'.
+
+2017-06-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/21665
+ * compress.c (bfd_get_full_section_contents): Don't check the
+ file size here.
+ * libbfd.c (_bfd_generic_get_section_contents): Check for and
+ reject a section whoes size + offset is greater than the size
+ of the entire file.
+ (_bfd_generic_get_section_contents_in_window): Likewise.
+
+2017-06-26 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21670
+ * tekhex.c (getvalue): Check for the source pointer exceeding the
+ end pointer before the first byte is read.
+
+2017-06-26 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21665
+ * opncls.c (get_build_id): Check that the section is beig enough
+ to contain the whole note.
+ * compress.c (bfd_get_full_section_contents): Check for and reject
+ a section whoes size is greater than the size of the entire file.
+ * elf32-v850.c (v850_elf_copy_notes): Allow for the ouput to not
+ contain a notes section.
+
+2017-06-26 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * elf64-s390.c (elf_s390_additional_program_headers): Add NULL
+ pointer checks.
+ (elf_s390_modify_segment_map): Likewise.
+ (bfd_elf_s390_set_options): Lisewise.
+
+2017-06-26 Alan Modra <amodra@gmail.com>
+
+ * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj
+ a --just-syms bfd.
+ (_bfd_elf_size_group_sections): Skip --just-syms bfds.
+ (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and
+ .preinit_array on --just-syms bfds.
+ (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds.
+ (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise.
+ (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise.
+
+2017-06-25 Sergei Trofimovich <slyfox@gentoo.org>
+
+ * elf.c (find_link): Bounds check "hint".
+
+2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * elf32-arm.c (using_thumb_only): Update list of architectures in
+ BFD_ASSERT for which the logic is valid.
+ (using_thumb2_bl): Likewise.
+ (using_thumb2): Likewise and return true for ARMv8-R.
+ (arch_has_arm_nop): Likewise.
+ (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch
+ merging logic. Update commentis for value 15 of v8m_baseline,
+ v8m_mainline and v4t_plus_v6_m arrays. Use v8r array to decide
+ merging of value 15 of Tag_CPU_arch.
+
+2017-06-23 Jiong Wang <jiong.wang@arm.com>
+
+ * reloc.c (BFD_RELOC_AARCH64_ADR_GOTPAGE): Rename to
+ BFD_RELOC_AARCH64_ADR_GOT_PAGE
+ * bfd-in2.h: Regenerate.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf64-x86-64.c (elf_x86_64_link_setup_gnu_properties): Move
+ the error_alignment label forward. Properly align program
+ property note section.
+
+2017-06-22 Eric Christopher <echristo@gmail.com>
+
+ * elf32-arm.c (elf32_arm_final_link_relocate): Use labs rather than
+ abs to fix a truncation warning.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Resolve
+ local undefined weak symbol to 0.
+ * elf64-x86-64.c (UNDEFINED_WEAK_RESOLVED_TO_ZERO): Likewise.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_merge_gnu_properties): If info->shstk
+ is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
+ (elf_i386_link_setup_gnu_properties): If info->shstk is set,
+ turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
+ * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): If
+ info->shstk is set, turn on GNU_PROPERTY_X86_FEATURE_1_SHSTK.
+ (elf_x86_64_link_setup_gnu_properties): If info->shstk is set,
+ turn on GNU_PROPERTY_X86_FEATURE_1_IBT.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_lazy_ibt_plt0_entry): New.
+ (elf_i386_lazy_ibt_plt_entry): Likewise.
+ (elf_i386_pic_lazy_ibt_plt0_entry): Likewise.
+ (elf_i386_non_lazy_ibt_plt_entry): Likewise.
+ (elf_i386_pic_non_lazy_ibt_plt_entry): Likewise.
+ (elf_i386_eh_frame_lazy_ibt_plt): Likewise.
+ (elf_i386_lazy_plt_layout): Likewise.
+ (elf_i386_non_lazy_plt_layout): Likewise.
+ (elf_i386_link_hash_entry): Add plt_second.
+ (elf_i386_link_hash_table): Add plt_second and
+ plt_second_eh_frame.
+ (elf_i386_allocate_dynrelocs): Use the second PLT if needed.
+ (elf_i386_size_dynamic_sections): Use .plt.got unwind info for
+ the second PLT. Check the second PLT.
+ (elf_i386_relocate_section): Use the second PLT to resolve
+ PLT reference if needed.
+ (elf_i386_finish_dynamic_symbol): Fill and use the second PLT if
+ needed.
+ (elf_i386_finish_dynamic_sections): Set sh_entsize on the
+ second PLT. Generate unwind info for the second PLT.
+ (elf_i386_plt_type): Add plt_second.
+ (elf_i386_get_synthetic_symtab): Support the second PLT.
+ (elf_i386_parse_gnu_properties): Support
+ GNU_PROPERTY_X86_FEATURE_1_AND.
+ (elf_i386_merge_gnu_properties): Support
+ GNU_PROPERTY_X86_FEATURE_1_AND. If info->ibt is set, turn
+ on GNU_PROPERTY_X86_FEATURE_1_IBT
+ (elf_i386_link_setup_gnu_properties): If info->ibt is set,
+ turn on GNU_PROPERTY_X86_FEATURE_1_IBT. Use IBT-enabled PLT
+ for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
+ is set on all relocatable inputs.
+ * elf64-x86-64.c (elf_x86_64_lazy_ibt_plt_entry): New.
+ (elf_x32_lazy_ibt_plt_entry): Likewise.
+ (elf_x86_64_non_lazy_ibt_plt_entry): Likewise.
+ (elf_x32_non_lazy_ibt_plt_entry): Likewise.
+ (elf_x86_64_eh_frame_lazy_ibt_plt): Likewise.
+ (elf_x32_eh_frame_lazy_ibt_plt): Likewise.
+ (elf_x86_64_lazy_ibt_plt): Likewise.
+ (elf_x32_lazy_ibt_plt): Likewise.
+ (elf_x86_64_non_lazy_ibt_plt): Likewise.
+ (elf_x32_non_lazy_ibt_plt): Likewise.
+ (elf_x86_64_get_synthetic_symtab): Support the second PLT.
+ (elf_x86_64_parse_gnu_properties): Support
+ GNU_PROPERTY_X86_FEATURE_1_AND.
+ (elf_x86_64_merge_gnu_properties): Support
+ GNU_PROPERTY_X86_FEATURE_1_AND. If info->ibt is set, turn
+ on GNU_PROPERTY_X86_FEATURE_1_IBT
+ (elf_x86_64_link_setup_gnu_properties): If info->ibt is set,
+ turn on GNU_PROPERTY_X86_FEATURE_1_IBT. Use IBT-enabled PLT
+ for info->ibtplt, info->ibt or GNU_PROPERTY_X86_FEATURE_1_IBT
+ is set on all relocatable inputs.
+
+2017-06-22 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21649
+ * som.c (setup_sections): NUL terminate the space_strings buffer.
+ Check that the space.name field does not index beyond the end of
+ the space_strings buffer.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21646
+ * coff-sh.c (sh_reloc): Check for an out of range reloc.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21639
+ * vms-misc.c (_bfd_vms_save_sized_string): Use unsigned int as
+ type of the size parameter.
+ (_bfd_vms_save_counted_string): Add second parameter - the maximum
+ length of the counted string.
+ * vms.h (_bfd_vms_save_sized_string): Update prototype.
+ (_bfd_vms_save_counted_string): Likewise.
+ * vms-alpha.c (_bfd_vms_slurp_eisd): Update calls to
+ _bfd_vms_save_counted_string.
+ (_bfd_vms_slurp_ehdr): Likewise.
+ (_bfd_vms_slurp_egsd): Likewise.
+ (Parse_module): Likewise.
+
+2017-06-21 Alan Modra <amodra@gmail.com>
+
+ * elf64-ppc.c (ppc64_elf_size_stubs): Test for localentry:0 plt
+ calls before tocsave calls.
+ (ppc64_elf_relocate_section): Allow localentry:0 plt calls without
+ following nop.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21645
+ * reloc.c (bfd_generic_get_relocated_section_contents): Fail if
+ bfd_get_full_section_contents returns no contents.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21638
+ * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an undersized
+ record.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21637
+ * vms-alpha.c (_bfd_vms_slurp_egsd): Check for an empty section
+ list.
+ (image_set_ptr): Likewise.
+ (alpha_vms_fix_sec_rel): Likewise.
+ (alpha_vms_slurp_relocs): Likewise.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21633
+ * ieee.c (ieee_slurp_sections): Check for a NULL return from
+ read_id.
+ (ieee_archive_p): Likewise.
+ (ieee_object_p): Likewise.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21640
+ * elf.c (setup_group): Zero the group section pointer list after
+ allocation so that loops can be caught. Check for NULL pointers
+ when processing a group list.
+
+2017-06-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * elf-s390.h: New file.
+ * elf64-s390.c (struct elf_s390_link_hash_table): Add params
+ field.
+ (elf_s390_additional_program_headers): New function.
+ (elf_s390_modify_segment_map): New function.
+ (bfd_elf_s390_set_options): New function.
+ (elf_backend_additional_program_headers)
+ (elf_backend_modify_segment_map): Add macro definitions.
+
+2017-06-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21626
+ * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Check
+ the DYNAMIC bit instead of bfd_count_sections.
+
+2017-06-19 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21618
+ * vms-alpha.c (evax_bfd_print_emh): Check for insufficient record
+ length.
+ (evax_bfd_print_eeom): Likewise.
+ (evax_bfd_print_egsd): Check for an overlarge record length.
+ (evax_bfd_print_etir): Likewise.
+
+2017-06-19 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21612
+ * libieee.h (struct common_header_type): Add end_p field.
+ * ieee.c (this_byte_and_next): Do not advance input_p beyond
+ end_p.
+ (read_id): Check for a length that exceeds the remaining bytes in
+ the input buffer.
+ (ieee_seek): Initialise end_p.
+ (ieee_archive_p): Likewise.
+ (ieee_object_p): Likewise.
+
+2017-06-19 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21611
+ * vms-alpha.c (_bfd_vms_slurp_eihs): Check for invalid offset
+ before reading the EIHS structure entries.
+
+2017-06-19 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21615
+ * vms-alpha.c (_bfd_vms_slurp_egsd): Use unsigned int for
+ gsd_size. Check that there are enough bytes remaining to read the
+ type and size of the next egsd. Check that the size of the egsd
+ does not exceed the size of the record.
+
+2017-06-19 Alan Modra <amodra@gmail.com>
+
+ * config.bfd: Correct targ_underscore for cris.
+
+2017-06-18 Alan Modra <amodra@gmail.com>
+
+ * config.bfd: Correct targ_underscore for epiphany, ip2k,
+ m32c, mn10200, pru, rl78, rx, crisv32 and v850.
+
+2017-06-16 Nick Clifton <nickc@redhat.com>
+
+ * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Do not fail if the
+ bucketlist is empty because there are no symbols to add to the
+ list.
+
+2017-06-16 Alan Modra <amodra@gmail.com>
+
+ PR ld/20022
+ PR ld/21557
+ PR ld/21562
+ PR ld/21571
+ * targets.c (struct bfd_target): Add _bfd_define_start_stop.
+ (BFD_JUMP_TABLE_LINK): Likewise.
+ * elf-bfd.h (bfd_elf_define_start_stop): Declare.
+ * elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
+ (bfd_elf_define_start_stop): New function.
+ * linker.c (bfd_generic_define_start_stop): New function.
+ * coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
+ new field.
+ * aout-adobe.c (aout_32_bfd_define_start_stop): Define.
+ * aout-target.h (MY_bfd_define_start_stop): Define.
+ * aout-tic30.c (MY_bfd_define_start_stop): Define.
+ * binary.c (binary_bfd_define_start_stop): Define.
+ * bout.c (b_out_bfd_define_start_stop): Define.
+ * coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
+ * coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
+ * coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
+ * coffcode.h (coff_bfd_define_start_stop): Define.
+ * elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
+ * i386msdos.c (msdos_bfd_define_start_stop): Define.
+ * i386os9k.c (os9k_bfd_define_start_stop): Define.
+ * ieee.c (ieee_bfd_define_start_stop): Define.
+ * ihex.c (ihex_bfd_define_start_stop): Define.
+ * libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
+ * mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
+ * mmo.c (mmo_bfd_define_start_stop): Define.
+ * nlm-target.h (nlm_bfd_define_start_stop): Define.
+ * oasys.c (oasys_bfd_define_start_stop): Define.
+ * pef.c (bfd_pef_bfd_define_start_stop): Define.
+ * plugin.c (bfd_plugin_bfd_define_start_stop): Define.
+ * ppcboot.c (ppcboot_bfd_define_start_stop): Define.
+ * som.c (som_bfd_define_start_stop): Define.
+ * srec.c (srec_bfd_define_start_stop): Define.
+ * tekhex.c (tekhex_bfd_define_start_stop): Define.
+ * versados.c (versados_bfd_define_start_stop): Define.
+ * vms-alpha.c (vms_bfd_define_start_stop): Define.
+ (alpha_vms_bfd_define_start_stop): Define.
+ * xsym.c (bfd_sym_bfd_define_start_stop): Define.
+ * bfd-in2.h: Regenerate.
+ * libbfd.h: Regenerate.
+
+2017-06-16 Jiong Wang <jiong.wang@arm.com>
+
+ * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Use
+ SYMBOL_REFERENCES_LOCAL.
+
+2017-06-15 Jiong Wang <jiong.wang@arm.com>
+
+ PR ld/21532
+ * elfnn-aarch64.c (ELIMINATE_COPY_RELOCS): Set to 1.
+ (elfNN_aarch64_final_link_relocate): Also propagate relocations to
+ runtime for if there needs copy relocation elimination.
+ (need_copy_relocation_p): New function. Return true for symbol with
+ pc-relative references and if it's against read-only sections.
+ (elfNN_aarch64_adjust_dynamic_symbol): Use need_copy_relocation_p.
+ (elfNN_aarch64_check_relocs): Allocate dynrelocs for relocation types
+ that are related with accessing external objects.
+ (elfNN_aarch64_gc_sweep_hook): Sync the relocation types with the change
+ in elfNN_aarch64_check_relocs.
+
+2017-06-15 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21582
+ * ieee.c (ieee_object_p): Use a static buffer to avoid compiler
+ bugs.
+ PR binutils/21581
+ (ieee_archive_p): Likewise.
+
+2017-06-15 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21579
+ * vms-alpha.c (_bfd_vms_slurp_etir): Extend check of cmd_length.
+
+2017-06-14 Max Filippov <jcmvbkbc@gmail.com>
+
+ * elf32-xtensa.c (elf_xtensa_be_plt_entry,
+ elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
+ keep both windowed and call0 ABI PLT definitions.
+ (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
+ elf_xtensa_*_plt_entry endex.
+ (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
+
+2017-06-14 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21578
+ * elf32-sh.c (sh_elf_set_mach_from_flags): Fix check for invalid
+ flag value.
+
+2017-06-14 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21589
+ * vms-alpha.c (_bfd_vms_get_value): Add an extra parameter - the
+ maximum value for the ascic pointer. Check that name processing
+ does not read beyond this value.
+ (_bfd_vms_slurp_etir): Add checks for attempts to read beyond the
+ end of etir record.
+
+2017-06-14 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21591
+ * versados.c (versados_mkobject): Zero the allocated tdata structure.
+ (process_otr): Check for an invalid offset in the otr structure.
+
+2017-06-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * config.bfd (epiphany-*-elf): Accept epiphany-*-*.
+
+2017-06-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/20022
+ PR ld/21557
+ PR ld/21562
+ PR ld/21571
+ * elf-bfd.h (elf_link_hash_entry): Add start_stop. Change the
+ vtable field to a union.
+ (_bfd_elf_is_start_stop): Removed.
+ * elf32-i386.c (elf_i386_convert_load_reloc): Also check for
+ __start_SECNAME and __stop_SECNAME symbols.
+ * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Likewise.
+ * elflink.c (_bfd_elf_is_start_stop): Removed.
+ (_bfd_elf_gc_mark_rsec): Check start_stop instead of calling
+ _bfd_elf_is_start_stop.
+ (elf_gc_propagate_vtable_entries_used): Skip __start_SECNAME and
+ __stop_SECNAME symbols. Updated.
+ (elf_gc_smash_unused_vtentry_relocs): Likewise.
+ (bfd_elf_gc_record_vtinherit): Likewise.
+ (bfd_elf_gc_record_vtentry): Likewise.
+
+2017-06-13 Nick Clifton <nickc@redhat.com>
+
+ PR ld/21524
+ * elflink.c (elf_link_adjust_relocs): Generate an error when
+ encountering a reloc against a symbol removed by garbage
+ collection.
+
+2017-06-12 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf-bfd.h (elf_backend_data): Add struct bfd_link_info *
+ to merge_gnu_properties.
+ * elf-properties.c (elf_merge_gnu_properties): Add struct
+ bfd_link_info * and pass it to merge_gnu_properties.
+ (elf_merge_gnu_property_list): Add struct bfd_link_info *
+ and pass it to elf_merge_gnu_properties.
+ (_bfd_elf_link_setup_gnu_properties): Pass info to
+ elf_merge_gnu_property_list.
+ * elf32-i386.c (elf_i386_merge_gnu_properties): Add struct
+ bfd_link_info *.
+ * elf64-x86-64.c (elf_x86_64_merge_gnu_properties): Likewise.
+
+2017-06-11 Joe Zbiciak <joe.zbiciak@leftturnonly.info>
+
+ PR 21564
+ * binary.c (binary_set_section_contents): Scale lma by octets
+ per byte to set filepos.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * elf32-arc.c (elf_arc_check_relocs): Fixed conditions to generate
+ dynamic sections.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * elf32-arc.c (elf_arc_size_dynamic_sections): Changed condition to
+ require TEXTREL.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * arc-got.h (relocate_fix_got_relocs_for_got_info): Added TCB_SIZE to
+ patched section contents for TLS IE reloc.
+ * elf32-arc.c: Remove TCB_SIZE preprocessor macro.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * elf32-arc.c (elf_arc_relocate_section): Added "call" to
+ RELOC_FOR_GLOBAL_SYMBOL macro.
+
+2018-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * elf32-arc.c (elf_arc_relocate_section): Small refactor and condition
+ changes.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * config/tc-arc.c (md_undefined_symbol): Changed.
+ * config/tc-arc.h (DYNAMIC_STRUCT_NAME): Removed.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * elf32-arc.c (elf_arc_relocate_section): Fixed reassign of indirect
+ symbols.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * elf32-arc.c (elf_arc_check_relocs): Added condition to disable
+ warning and "Bad value" for local symbols ARC_32 or ARC_32_ME relocs.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * elf32-arc.c (ADD_RELA): Changed to only work when dynamic
+ object is created.
+
+2017-06-08 Richard Earnshaw <rearnsha@arm.com>
+
+ * elf32-arm.c (elf32_arm_merge_eabi_attributes): Remove assertion
+ that the input bfd has Tag_FP_ARCH non-zero if Tag_ABI_HardFP_use
+ is non-zero. Add clarifying comments.
+
+2017-06-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * elf32-i386.c (elf_i386_check_relocs): Set local IFUNC symbol
+ name. Use local IFUNC symbol name string to report unsupported
+ non-PIC call to IFUNC function.
+ (elf_i386_relocate_section): Dump local IFUNC name with minfo
+ when generating R_386_IRELATIVE relocation.
+ (elf_i386_finish_dynamic_symbol): Likewise.
+ * elf_x86_64_check_relocs (elf_x86_64_check_relocs): Set local
+ IFUNC symbol name.
+ (elf_x86_64_relocate_section): Dump local IFUNC name with minfo
+ when generating R_X86_64_IRELATIVE relocation.
+ (elf_x86_64_finish_dynamic_symbol): Likewise.
+
+2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * elf.c (setup_group): Make sure BFD sections are created for all
+ group sections in the input file when processing SHF_GROUP
+ sections.
+ (bfd_section_from_shdr): Avoid duplicating logic already
+ implemented in `setup_group'.
+
+2017-06-06 Daniel Bonniot de Ruisselet <bonniot@gmail.com>
+
+ PR binutils/21546
+ * peXXigen.c (pe_print_idata): Use the address of the first thunk
+ if the hint address is zero.
+
+2017-06-06 James Clarke <jrtc27@jrtc27.com>
+
+ PR ld/19579
+ * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Check
+ ELF_COMMON_DEF_P for common symbols.
+
+2017-06-06 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * elf.c (_bfd_elf_make_section_from_shdr): Don't initially mark
+ SEC_GROUP sections as SEC_EXCLUDE.
+ (bfd_elf_set_group_contents): Replace use of abort with an assert.
+ (assign_section_numbers): Use resolve_section_groups flag instead
+ of relocatable link type.
+ (_bfd_elf_init_private_section_data): Use resolve_section_groups
+ flag instead of checking the final_link flag for part of the
+ checks in here. Fix white space as a result.
+ * elflink.c (elf_link_input_bfd): Use resolve_section_groups flag
+ instead of relocatable link type.
+ (bfd_elf_final_link): Likewise.
+
+2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * elfxx-mips.c (_bfd_mips_elf_relocate_section): Remove unused
+ variable `bed'.
+ * elf32-score.c (score_elf_final_link_relocate): Likewise.
+ (s3_bfd_score_elf_check_relocs): Likewise.
+ * elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
+ (score_elf_final_link_relocate): Likewise.
+ (s7_bfd_score_elf_check_relocs): Likewise.
+
+2017-06-06 Jose E. Marchesi <jose.marchesi@oracle.com>
+
+ * elflink.c (init_reloc_cookie_rels): Remove unused variable
+ `bed'.
+
+2017-06-06 Maciej W. Rozycki <macro@imgtec.com>
+
+ * elf-bfd.h (RELOC_AGAINST_DISCARDED_SECTION): Subtract `count'
+ from `reloc_count' rather than decrementing it.
+ * elf.c (bfd_section_from_shdr): Multiply the adjustment to
+ `reloc_count' by `int_rels_per_ext_rel'.
+ * elf32-score.c (score_elf_final_link_relocate): Do not multiply
+ `reloc_count' by `int_rels_per_ext_rel' for last relocation
+ entry determination.
+ (s3_bfd_score_elf_check_relocs): Likewise.
+ * elf32-score7.c (score_elf_final_link_relocate): Likewise.
+ (s7_bfd_score_elf_relocate_section): Likewise.
+ (s7_bfd_score_elf_check_relocs): Likewise.
+ * elf64-mips.c (mips_elf64_get_reloc_upper_bound): Remove
+ prototype and function.
+ (mips_elf64_slurp_one_reloc_table): Do not update `reloc_count'.
+ (mips_elf64_slurp_reloc_table): Assert that `reloc_count' is
+ triple rather than once the sum of REL and RELA relocation entry
+ counts.
+ (bfd_elf64_get_reloc_upper_bound): Remove macro.
+ * elflink.c (_bfd_elf_link_read_relocs): Do not multiply
+ `reloc_count' by `int_rels_per_ext_rel' for internal relocation
+ storage allocation size determination.
+ (elf_link_input_bfd): Multiply `.ctors' and `.dtors' section's
+ size by `int_rels_per_ext_rel'. Do not multiply `reloc_count'
+ by `int_rels_per_ext_rel' for last relocation entry
+ determination.
+ (bfd_elf_final_link): Do not multiply `reloc_count' by
+ `int_rels_per_ext_rel' for internal relocation storage
+ allocation size determination.
+ (init_reloc_cookie_rels): Do not multiply `reloc_count' by
+ `int_rels_per_ext_rel' for last relocation entry determination.
+ (elf_gc_smash_unused_vtentry_relocs): Likewise.
+ * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
+ (_bfd_mips_elf_relocate_section): Likewise.
+
+2017-06-05 Alan Modra <amodra@gmail.com>
+
+ PR 21529
+ * linker.c (_bfd_generic_link_output_symbols): Handle BSF_GNU_UNIQUE.
+
+2017-06-01 John Baldwin <jhb@FreeBSD.org>
+
+ * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to
+ determine structure sizes.
+ (elfcore_grok_freebsd_prstatus): Likewise.
+
+2017-06-01 Alan Modra <amodra@gmail.com>
+
+ * elf64-ppc.c (struct ppc_link_hash_table): Add has_plt_localentry0.
+ (ppc64_elf_merge_symbol_attribute): Merge localentry bits from
+ dynamic objects.
+ (is_elfv2_localentry0): New function.
+ (ppc64_elf_tls_setup): Default params->plt_localentry0.
+ (plt_stub_size): Adjust size for tls_get_addr_opt stub.
+ (build_tls_get_addr_stub): Use a simpler stub when r2 is not saved.
+ (ppc64_elf_size_stubs): Leave stub_type as ppc_stub_plt_call for
+ optimized localentry:0 stubs.
+ (ppc64_elf_build_stubs): Save r2 in ELFv2 __glink_PLTresolve.
+ (ppc64_elf_relocate_section): Leave nop unchanged for optimized
+ localentry:0 stubs.
+ (ppc64_elf_finish_dynamic_sections): Set PPC64_OPT_LOCALENTRY in
+ DT_PPC64_OPT.
+ * elf64-ppc.h (struct ppc64_elf_params): Add plt_localentry0.
+
2017-05-30 Casey Smith <clegg89@gmail.com>
PR ld/21523
diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c
index a2c927d..487ed8c 100644
--- a/bfd/aout-adobe.c
+++ b/bfd/aout-adobe.c
@@ -466,6 +466,7 @@ aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED,
#define aout_32_bfd_discard_group bfd_generic_discard_group
#define aout_32_section_already_linked _bfd_generic_section_already_linked
#define aout_32_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define aout_32_bfd_define_start_stop bfd_generic_define_start_stop
#define aout_32_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define aout_32_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define aout_32_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 2e98c4d..65bc44c 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -513,6 +513,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
#ifndef MY_bfd_define_common_symbol
#define MY_bfd_define_common_symbol bfd_generic_define_common_symbol
#endif
+#ifndef MY_bfd_define_start_stop
+#define MY_bfd_define_start_stop bfd_generic_define_start_stop
+#endif
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
#endif
diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c
index 5db3da7..068428c 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -968,6 +968,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
#ifndef MY_bfd_define_common_symbol
#define MY_bfd_define_common_symbol bfd_generic_define_common_symbol
#endif
+#ifndef MY_bfd_define_start_stop
+#define MY_bfd_define_start_stop bfd_generic_define_start_stop
+#endif
#ifndef MY_bfd_reloc_type_lookup
#define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup
#endif
diff --git a/bfd/arc-got.h b/bfd/arc-got.h
index b8a6d15..f1f6c0e 100644
--- a/bfd/arc-got.h
+++ b/bfd/arc-got.h
@@ -22,6 +22,8 @@
#ifndef ARC_GOT_H
#define ARC_GOT_H
+#define TCB_SIZE (8)
+
enum tls_type_e
{
GOT_UNKNOWN = 0,
@@ -354,7 +356,8 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
= tls_sec->output_section->vma;
bfd_put_32 (output_bfd,
- sym_value - sec_vma,
+ sym_value - sec_vma
+ + (elf_hash_table (info)->dynamic_sections_created ? 0 : TCB_SIZE),
htab->sgot->contents + entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0));
@@ -478,8 +481,10 @@ GOT_OFFSET = %#lx, GOT_VMA = %#lx, INDEX = %ld, ADDEND = 0x0\n",
{
bfd_vma addend = 0;
if (list->type == GOT_TLS_IE)
+ {
addend = bfd_get_32 (output_bfd,
htab->sgot->contents + got_offset);
+ }
ADD_RELA (output_bfd, got,
got_offset + (e == TLS_GOT_MOD_AND_OFF ? 4 : 0),
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index a23bb98..45f665b 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -6014,12 +6014,12 @@ conjunction with BFD_RELOC_AARCH64_LD64_GOT_LO12_NC. */
/* Unsigned 12 bit byte offset for 64 bit load/store from the page of
the GOT entry for this symbol. Used in conjunction with
-BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in LP64 ABI only. */
+BFD_RELOC_AARCH64_ADR_GOT_PAGE. Valid in LP64 ABI only. */
BFD_RELOC_AARCH64_LD64_GOT_LO12_NC,
/* Unsigned 12 bit byte offset for 32 bit load/store from the page of
the GOT entry for this symbol. Used in conjunction with
-BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in ILP32 ABI only. */
+BFD_RELOC_AARCH64_ADR_GOT_PAGE. Valid in ILP32 ABI only. */
BFD_RELOC_AARCH64_LD32_GOT_LO12_NC,
/* Unsigned 16 bit byte offset for 64 bit load/store from the GOT entry
@@ -7593,7 +7593,8 @@ typedef struct bfd_target
NAME##_bfd_is_group_section, \
NAME##_bfd_discard_group, \
NAME##_section_already_linked, \
- NAME##_bfd_define_common_symbol
+ NAME##_bfd_define_common_symbol, \
+ NAME##_bfd_define_start_stop
int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
bfd_byte * (*_bfd_get_relocated_section_contents)
@@ -7657,6 +7658,11 @@ typedef struct bfd_target
bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *,
struct bfd_link_hash_entry *);
+ /* Define a __start, __stop, .startof. or .sizeof. symbol. */
+ struct bfd_link_hash_entry *(*_bfd_define_start_stop) (struct bfd_link_info *,
+ const char *,
+ asection *);
+
/* Routines to handle dynamic symbols and relocs. */
#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
NAME##_get_dynamic_symtab_upper_bound, \
@@ -7736,6 +7742,13 @@ bfd_boolean bfd_generic_define_common_symbol
#define bfd_define_common_symbol(output_bfd, info, h) \
BFD_SEND (output_bfd, _bfd_define_common_symbol, (output_bfd, info, h))
+struct bfd_link_hash_entry *bfd_generic_define_start_stop
+ (struct bfd_link_info *info,
+ const char *symbol, asection *sec);
+
+#define bfd_define_start_stop(output_bfd, info, symbol, sec) \
+ BFD_SEND (output_bfd, _bfd_define_start_stop, (info, symbol, sec))
+
struct bfd_elf_version_tree * bfd_find_version_for_sym
(struct bfd_elf_version_tree *verdefs,
const char *sym_name, bfd_boolean *hide);
diff --git a/bfd/binary.c b/bfd/binary.c
index ff52f14..1018d56 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -230,6 +230,7 @@ binary_set_section_contents (bfd *abfd,
if (! abfd->output_has_begun)
{
+ unsigned int opb;
bfd_boolean found_low;
bfd_vma low;
asection *s;
@@ -250,9 +251,10 @@ binary_set_section_contents (bfd *abfd,
found_low = TRUE;
}
+ opb = bfd_octets_per_byte (abfd);
for (s = abfd->sections; s != NULL; s = s->next)
{
- s->filepos = s->lma - low;
+ s->filepos = (s->lma - low) * opb;
/* Skip following warning check for sections that will not
occupy file space. */
@@ -308,6 +310,7 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define binary_bfd_discard_group bfd_generic_discard_group
#define binary_section_already_linked _bfd_generic_section_already_linked
#define binary_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define binary_bfd_define_start_stop bfd_generic_define_start_stop
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define binary_bfd_link_just_syms _bfd_generic_link_just_syms
#define binary_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type
diff --git a/bfd/bout.c b/bfd/bout.c
index 0a6f8db..33692d6 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -1390,6 +1390,7 @@ b_out_bfd_get_relocated_section_contents (bfd *output_bfd,
#define b_out_bfd_discard_group bfd_generic_discard_group
#define b_out_section_already_linked _bfd_generic_section_already_linked
#define b_out_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define b_out_bfd_define_start_stop bfd_generic_define_start_stop
#define aout_32_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
#define b_out_bfd_link_check_relocs _bfd_generic_link_check_relocs
#define b_out_set_reloc _bfd_generic_set_reloc
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 8ecba2f..47e3740 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2340,6 +2340,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#define _bfd_ecoff_section_already_linked \
_bfd_coff_section_already_linked
#define _bfd_ecoff_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define _bfd_ecoff_bfd_define_start_stop bfd_generic_define_start_stop
#define _bfd_ecoff_bfd_link_check_relocs _bfd_generic_link_check_relocs
/* Installing internal relocations in a section is also generic. */
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 45c65f8..c3ade62 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1356,6 +1356,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
#define _bfd_ecoff_section_already_linked \
_bfd_coff_section_already_linked
#define _bfd_ecoff_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define _bfd_ecoff_bfd_define_start_stop bfd_generic_define_start_stop
#define _bfd_ecoff_set_reloc _bfd_generic_set_reloc
extern const bfd_target mips_ecoff_be_vec;
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index b49e393..fabf971 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4013,6 +4013,7 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = {
#define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
#define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked
#define _bfd_xcoff_bfd_define_common_symbol _bfd_xcoff_define_common_symbol
+#define _bfd_xcoff_bfd_define_start_stop bfd_generic_define_start_stop
#define _bfd_xcoff_bfd_link_check_relocs _bfd_generic_link_check_relocs
/* For dynamic symbols and relocs entry points. */
diff --git a/bfd/coff-sh.c b/bfd/coff-sh.c
index dd8090c..26d296b 100644
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -596,6 +596,9 @@ sh_reloc (bfd * abfd,
&& bfd_is_und_section (symbol_in->section))
return bfd_reloc_undefined;
+ if (addr > input_section->size)
+ return bfd_reloc_outofrange;
+
sym_value = get_symbol_value (symbol_in);
switch (r_type)
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 56458e0..525b079 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -2746,6 +2746,7 @@ const bfd_target rs6000_xcoff64_vec =
bfd_generic_discard_group,
_bfd_generic_section_already_linked,
_bfd_xcoff_define_common_symbol,
+ bfd_generic_define_start_stop,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
@@ -3006,6 +3007,7 @@ const bfd_target rs6000_xcoff64_aix_vec =
bfd_generic_discard_group,
_bfd_generic_section_already_linked,
_bfd_xcoff_define_common_symbol,
+ bfd_generic_define_start_stop,
/* Dynamic */
_bfd_xcoff_get_dynamic_symtab_upper_bound,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index f9d3978..3331f4c 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -6061,6 +6061,10 @@ static bfd_coff_backend_data bigobj_swap_table =
#define coff_bfd_define_common_symbol bfd_generic_define_common_symbol
#endif
+#ifndef coff_bfd_define_start_stop
+#define coff_bfd_define_start_stop bfd_generic_define_start_stop
+#endif
+
#define CREATE_BIG_COFF_TARGET_VEC(VAR, NAME, EXTRA_O_FLAGS, EXTRA_S_FLAGS, UNDER, ALTERNATIVE, SWAP_TABLE) \
const bfd_target VAR = \
{ \
diff --git a/bfd/compress.c b/bfd/compress.c
index c854a20..ef549f9 100644
--- a/bfd/compress.c
+++ b/bfd/compress.c
@@ -254,7 +254,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
/* xgettext:c-format */
(_("error: %B(%A) is too large (%#lx bytes)"),
abfd, sec, (long) sz);
- return FALSE;
+ return FALSE;
}
}
diff --git a/bfd/config.bfd b/bfd/config.bfd
index eb6a958..dc24aab 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -503,7 +503,10 @@ case "${targ}" in
cris-*-* | crisv32-*-*)
targ_defvec=cris_aout_vec
targ_selvecs="cris_elf32_us_vec cris_elf32_vec ieee_vec"
- targ_underscore=yes # Note: not true for cris_elf32_vec.
+ case "${targ}" in
+ *-*-linux*) ;;
+ *) targ_underscore=yes ;;
+ esac
;;
crx-*-elf*)
@@ -524,8 +527,9 @@ case "${targ}" in
targ_defvec=d30v_elf32_vec
;;
- epiphany-*-elf)
+ epiphany-*-*)
targ_defvec=epiphany_elf32_vec
+ targ_underscore=yes
;;
fido-*-elf* )
@@ -913,6 +917,7 @@ case "${targ}" in
ip2k-*-elf)
targ_defvec=ip2k_elf32_vec
+ targ_underscore=yes
;;
iq2000-*-elf)
@@ -931,6 +936,7 @@ case "${targ}" in
m32c-*-elf | m32c-*-rtems*)
targ_defvec=m32c_elf32_vec
+ targ_underscore=yes
;;
m32r*le-*-linux*)
@@ -1231,6 +1237,7 @@ case "${targ}" in
#endif
mn10200-*-*)
targ_defvec=mn10200_elf32_vec
+ targ_underscore=yes
;;
mn10300-*-*)
@@ -1435,7 +1442,6 @@ case "${targ}" in
pru-*-*)
targ_defvec=pru_elf32_vec
- targ_underscore=yes
;;
#ifdef BFD64
@@ -1453,11 +1459,13 @@ case "${targ}" in
rl78-*-elf)
targ_defvec=rl78_elf32_vec
+ targ_underscore=yes
;;
rx-*-elf)
targ_defvec=rx_elf32_le_vec
targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec rx_elf32_be_ns_vec"
+ targ_underscore=yes
;;
s390-*-linux*)
@@ -1767,6 +1775,7 @@ case "${targ}" in
v850*-*-*)
targ_defvec=v850_elf32_vec
targ_selvecs="v800_elf32_vec"
+ targ_underscore=yes
;;
vax-*-netbsdelf*)
diff --git a/bfd/cpu-mips.c b/bfd/cpu-mips.c
index b9ecdd6..70a8aa7 100644
--- a/bfd/cpu-mips.c
+++ b/bfd/cpu-mips.c
@@ -114,7 +114,7 @@ static const bfd_arch_info_type arch_info_struct[] =
N (32, 32, bfd_mach_mips3000, "mips:3000", FALSE, NN(I_mips3000)),
N (32, 32, bfd_mach_mips3900, "mips:3900", FALSE, NN(I_mips3900)),
N (64, 64, bfd_mach_mips4000, "mips:4000", FALSE, NN(I_mips4000)),
- N (64, 64, bfd_mach_mips4010, "mips:4010", FALSE, NN(I_mips4010)),
+ N (32, 32, bfd_mach_mips4010, "mips:4010", FALSE, NN(I_mips4010)),
N (64, 64, bfd_mach_mips4100, "mips:4100", FALSE, NN(I_mips4100)),
N (64, 64, bfd_mach_mips4111, "mips:4111", FALSE, NN(I_mips4111)),
N (64, 64, bfd_mach_mips4120, "mips:4120", FALSE, NN(I_mips4120)),
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 4110ace..b889720 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -213,6 +213,9 @@ struct elf_link_hash_entry
/* Symbol is defined by a shared library with non-default visibility
in a read/write section. */
unsigned int protected_def : 1;
+ /* Symbol is __start_SECNAME or __stop_SECNAME to mark section
+ SECNAME. */
+ unsigned int start_stop : 1;
/* String table index in .dynstr if this is a dynamic symbol. */
unsigned long dynstr_index;
@@ -243,7 +246,15 @@ struct elf_link_hash_entry
struct bfd_elf_version_tree *vertree;
} verinfo;
- struct elf_link_virtual_table_entry *vtable;
+ union
+ {
+ /* For __start_SECNAME and __stop_SECNAME symbols, record the first
+ input section whose section name is SECNAME. */
+ asection *start_stop_section;
+
+ /* Vtable information. */
+ struct elf_link_virtual_table_entry *vtable;
+ } u2;
};
/* Will references to this symbol always reference the symbol
@@ -1437,8 +1448,8 @@ struct elf_backend_data
unsigned int);
/* Merge GNU properties. Return TRUE if property is updated. */
- bfd_boolean (*merge_gnu_properties) (bfd *, elf_property *,
- elf_property *);
+ bfd_boolean (*merge_gnu_properties) (struct bfd_link_info *, bfd *,
+ elf_property *, elf_property *);
/* Set up GNU properties. */
bfd *(*setup_gnu_properties) (struct bfd_link_info *);
@@ -2262,6 +2273,9 @@ extern bfd_reloc_status_type bfd_elf_perform_complex_relocation
extern bfd_boolean _bfd_elf_setup_sections
(bfd *);
+extern struct bfd_link_hash_entry *bfd_elf_define_start_stop
+ (struct bfd_link_info *, const char *, asection *);
+
extern void _bfd_elf_post_process_headers (bfd * , struct bfd_link_info *);
extern const bfd_target *bfd_elf32_object_p
@@ -2445,9 +2459,6 @@ extern bfd_boolean bfd_elf_gc_common_finalize_got_offsets
extern bfd_boolean bfd_elf_gc_common_final_link
(bfd *, struct bfd_link_info *);
-extern asection *_bfd_elf_is_start_stop
- (const struct bfd_link_info *, struct elf_link_hash_entry *);
-
extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
(bfd_vma, void *);
@@ -2767,7 +2778,7 @@ extern asection _bfd_elf_large_com_section;
memmove (rel, rel + count, \
(relend - rel - count) * sizeof (*rel)); \
\
- input_section->reloc_count--; \
+ input_section->reloc_count -= count; \
relend -= count; \
rel--; \
continue; \
diff --git a/bfd/elf-properties.c b/bfd/elf-properties.c
index fda8875..13d620d 100644
--- a/bfd/elf-properties.c
+++ b/bfd/elf-properties.c
@@ -197,8 +197,8 @@ next:
with ABFD. */
static bfd_boolean
-elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
- elf_property *bprop)
+elf_merge_gnu_properties (struct bfd_link_info *info, bfd *abfd,
+ elf_property *aprop, elf_property *bprop)
{
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
@@ -206,7 +206,7 @@ elf_merge_gnu_properties (bfd *abfd, elf_property *aprop,
if (bed->merge_gnu_properties != NULL
&& pr_type >= GNU_PROPERTY_LOPROC
&& pr_type < GNU_PROPERTY_LOUSER)
- return bed->merge_gnu_properties (abfd, aprop, bprop);
+ return bed->merge_gnu_properties (info, abfd, aprop, bprop);
switch (pr_type)
{
@@ -263,7 +263,8 @@ elf_find_and_remove_property (elf_property_list **listp,
/* Merge GNU property list *LISTP with ABFD. */
static void
-elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
+elf_merge_gnu_property_list (struct bfd_link_info *info, bfd *abfd,
+ elf_property_list **listp)
{
elf_property_list *p, **lastp;
elf_property *pr;
@@ -275,7 +276,7 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
pr = elf_find_and_remove_property (listp, p->property.pr_type);
/* Pass NULL to elf_merge_gnu_properties for the property which
isn't on *LISTP. */
- elf_merge_gnu_properties (abfd, &p->property, pr);
+ elf_merge_gnu_properties (info, abfd, &p->property, pr);
if (p->property.pr_kind == property_remove)
{
/* Remove this property. */
@@ -287,7 +288,7 @@ elf_merge_gnu_property_list (bfd *abfd, elf_property_list **listp)
/* Merge the remaining properties on *LISTP with ABFD. */
for (p = *listp; p != NULL; p = p->next)
- if (elf_merge_gnu_properties (abfd, NULL, &p->property))
+ if (elf_merge_gnu_properties (info, abfd, NULL, &p->property))
{
pr = _bfd_elf_get_property (abfd, p->property.pr_type,
p->property.pr_datasz);
@@ -317,7 +318,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
/* Find the first relocatable ELF input with GNU properties. */
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
- && bfd_count_sections (abfd) != 0
+ && (abfd->flags & DYNAMIC) == 0
&& elf_properties (abfd) != NULL)
{
has_properties = TRUE;
@@ -341,7 +342,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
/* Merge .note.gnu.property sections. */
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
- if (abfd != first_pbfd && bfd_count_sections (abfd) != 0)
+ if (abfd != first_pbfd && (abfd->flags & DYNAMIC) == 0)
{
elf_property_list *null_ptr = NULL;
elf_property_list **listp = &null_ptr;
@@ -365,7 +366,7 @@ _bfd_elf_link_setup_gnu_properties (struct bfd_link_info *info)
when all properties are from ELF objects with different
machine code or class. */
if (first_pbfd != NULL)
- elf_merge_gnu_property_list (first_pbfd, listp);
+ elf_merge_gnu_property_list (info, first_pbfd, listp);
if (list != NULL)
{
diff --git a/bfd/elf-s390.h b/bfd/elf-s390.h
new file mode 100644
index 0000000..b37ec18
--- /dev/null
+++ b/bfd/elf-s390.h
@@ -0,0 +1,29 @@
+/* S/390-specific support for ELF.
+ Copyright (C) 2017 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 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA. */
+
+/* Used to pass info between ld and bfd. */
+struct s390_elf_params
+{
+ /* Tell the kernel to allocate 4k page tables. */
+ int pgste;
+};
+
+bfd_boolean bfd_elf_s390_set_options (struct bfd_link_info *info,
+ struct s390_elf_params *params);
diff --git a/bfd/elf.c b/bfd/elf.c
index 863bd61..76c6a5c 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -613,6 +613,7 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
{
num_group = (unsigned) -1;
elf_tdata (abfd)->num_group = num_group;
+ elf_tdata (abfd)->group_sect_ptr = NULL;
}
else
{
@@ -625,8 +626,9 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
bfd_alloc2 (abfd, num_group, sizeof (Elf_Internal_Shdr *));
if (elf_tdata (abfd)->group_sect_ptr == NULL)
return FALSE;
-
+ memset (elf_tdata (abfd)->group_sect_ptr, 0, num_group * sizeof (Elf_Internal_Shdr *));
num_group = 0;
+
for (i = 0; i < shnum; i++)
{
Elf_Internal_Shdr *shdr = elf_elfsections (abfd)[i];
@@ -636,6 +638,11 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
unsigned char *src;
Elf_Internal_Group *dest;
+ /* Make sure the group section has a BFD section
+ attached to it. */
+ if (!bfd_section_from_shdr (abfd, i))
+ return FALSE;
+
/* Add to list of sections. */
elf_tdata (abfd)->group_sect_ptr[num_group] = shdr;
num_group += 1;
@@ -734,8 +741,14 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect)
for (i = 0; i < num_group; i++)
{
Elf_Internal_Shdr *shdr = elf_tdata (abfd)->group_sect_ptr[i];
- Elf_Internal_Group *idx = (Elf_Internal_Group *) shdr->contents;
- unsigned int n_elt = shdr->sh_size / 4;
+ Elf_Internal_Group *idx;
+ unsigned int n_elt;
+
+ if (shdr == NULL)
+ continue;
+
+ idx = (Elf_Internal_Group *) shdr->contents;
+ n_elt = shdr->sh_size / 4;
/* Look through this group's sections to see if current
section is a member. */
@@ -983,7 +996,7 @@ _bfd_elf_make_section_from_shdr (bfd *abfd,
if (hdr->sh_type != SHT_NOBITS)
flags |= SEC_HAS_CONTENTS;
if (hdr->sh_type == SHT_GROUP)
- flags |= SEC_GROUP | SEC_EXCLUDE;
+ flags |= SEC_GROUP;
if ((hdr->sh_flags & SHF_ALLOC) != 0)
{
flags |= SEC_ALLOC;
@@ -1270,7 +1283,8 @@ section_match (const Elf_Internal_Shdr * a,
to be the correct section. */
static unsigned int
-find_link (const bfd * obfd, const Elf_Internal_Shdr * iheader, const unsigned int hint)
+find_link (const bfd *obfd, const Elf_Internal_Shdr *iheader,
+ const unsigned int hint)
{
Elf_Internal_Shdr ** oheaders = elf_elfsections (obfd);
unsigned int i;
@@ -1278,7 +1292,8 @@ find_link (const bfd * obfd, const Elf_Internal_Shdr * iheader, const unsigned i
BFD_ASSERT (iheader != NULL);
/* See PR 20922 for a reproducer of the NULL test. */
- if (oheaders[hint] != NULL
+ if (hint < elf_numsections (obfd)
+ && oheaders[hint] != NULL
&& section_match (oheaders[hint], iheader))
return hint;
@@ -2374,7 +2389,8 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
*hdr2 = *hdr;
*p_hdr = hdr2;
elf_elfsections (abfd)[shindex] = hdr2;
- target_sect->reloc_count += NUM_SHDR_ENTRIES (hdr);
+ target_sect->reloc_count += (NUM_SHDR_ENTRIES (hdr)
+ * bed->s->int_rels_per_ext_rel);
target_sect->flags |= SEC_RELOC;
target_sect->relocation = NULL;
target_sect->rel_filepos = hdr->sh_offset;
@@ -2420,34 +2436,6 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
if (!_bfd_elf_make_section_from_shdr (abfd, hdr, name, shindex))
goto fail;
- if (hdr->contents != NULL)
- {
- Elf_Internal_Group *idx = (Elf_Internal_Group *) hdr->contents;
- unsigned int n_elt = hdr->sh_size / sizeof (* idx);
- asection *s;
-
- if (n_elt == 0)
- goto fail;
- if (idx->flags & GRP_COMDAT)
- hdr->bfd_section->flags
- |= SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD;
-
- /* We try to keep the same section order as it comes in. */
- idx += n_elt;
-
- while (--n_elt != 0)
- {
- --idx;
-
- if (idx->shdr != NULL
- && (s = idx->shdr->bfd_section) != NULL
- && elf_next_in_group (s) != NULL)
- {
- elf_next_in_group (hdr->bfd_section) = s;
- break;
- }
- }
- }
goto success;
default:
@@ -3532,8 +3520,8 @@ bfd_elf_set_group_contents (bfd *abfd, asection *sec, void *failedptrarg)
break;
}
- if ((loc -= 4) != sec->contents)
- abort ();
+ loc -= 4;
+ BFD_ASSERT (loc == sec->contents);
H_PUT_32 (abfd, sec->flags & SEC_LINK_ONCE ? GRP_COMDAT : 0, loc);
}
@@ -3608,7 +3596,7 @@ assign_section_numbers (bfd *abfd, struct bfd_link_info *link_info)
_bfd_elf_strtab_clear_all_refs (elf_shstrtab (abfd));
/* SHT_GROUP sections are in relocatable files only. */
- if (link_info == NULL || bfd_link_relocatable (link_info))
+ if (link_info == NULL || !link_info->resolve_section_groups)
{
size_t reloc_count = 0;
@@ -7444,23 +7432,22 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
SHT_GROUP section will have its elf_next_in_group pointing back
to the input group members. Ignore linker created group section.
See elfNN_ia64_object_p in elfxx-ia64.c. */
- if (!final_link)
+ if ((link_info == NULL
+ || !link_info->resolve_section_groups)
+ && (elf_sec_group (isec) == NULL
+ || (elf_sec_group (isec)->flags & SEC_LINKER_CREATED) == 0))
{
- if (elf_sec_group (isec) == NULL
- || (elf_sec_group (isec)->flags & SEC_LINKER_CREATED) == 0)
- {
- if (elf_section_flags (isec) & SHF_GROUP)
- elf_section_flags (osec) |= SHF_GROUP;
- elf_next_in_group (osec) = elf_next_in_group (isec);
- elf_section_data (osec)->group = elf_section_data (isec)->group;
- }
-
- /* If not decompress, preserve SHF_COMPRESSED. */
- if ((ibfd->flags & BFD_DECOMPRESS) == 0)
- elf_section_flags (osec) |= (elf_section_flags (isec)
- & SHF_COMPRESSED);
+ if (elf_section_flags (isec) & SHF_GROUP)
+ elf_section_flags (osec) |= SHF_GROUP;
+ elf_next_in_group (osec) = elf_next_in_group (isec);
+ elf_section_data (osec)->group = elf_section_data (isec)->group;
}
+ /* If not decompress, preserve SHF_COMPRESSED. */
+ if (!final_link && (ibfd->flags & BFD_DECOMPRESS) == 0)
+ elf_section_flags (osec) |= (elf_section_flags (isec)
+ & SHF_COMPRESSED);
+
ihdr = &elf_section_data (isec)->this_hdr;
/* We need to handle elf_linked_to_section for SHF_LINK_ORDER. We
@@ -9814,14 +9801,14 @@ elfcore_grok_freebsd_psinfo (bfd *abfd, Elf_Internal_Note *note)
{
size_t offset;
- switch (abfd->arch_info->bits_per_word)
+ switch (elf_elfheader (abfd)->e_ident[EI_CLASS])
{
- case 32:
+ case ELFCLASS32:
if (note->descsz < 108)
return FALSE;
break;
- case 64:
+ case ELFCLASS64:
if (note->descsz < 120)
return FALSE;
break;
@@ -9836,7 +9823,7 @@ elfcore_grok_freebsd_psinfo (bfd *abfd, Elf_Internal_Note *note)
offset = 4;
/* Skip over pr_psinfosz. */
- if (abfd->arch_info->bits_per_word == 32)
+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32)
offset += 4;
else
{
@@ -9879,13 +9866,13 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note)
offset = 4;
/* Skip over pr_statussz. */
- switch (abfd->arch_info->bits_per_word)
+ switch (elf_elfheader (abfd)->e_ident[EI_CLASS])
{
- case 32:
+ case ELFCLASS32:
offset += 4;
break;
- case 64:
+ case ELFCLASS64:
offset += 4; /* Padding before pr_statussz. */
offset += 8;
break;
@@ -9895,13 +9882,16 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note)
}
/* Extract size of pr_reg from pr_gregsetsz. */
- if (abfd->arch_info->bits_per_word == 32)
+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32)
size = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + offset);
else
size = bfd_h_get_64 (abfd, (bfd_byte *) note->descdata + offset);
/* Skip over pr_gregsetsz and pr_fpregsetsz. */
- offset += (abfd->arch_info->bits_per_word / 8) * 2;
+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32)
+ offset += 4 * 2;
+ else
+ offset += 8 * 2;
/* Skip over pr_osreldate. */
offset += 4;
@@ -9918,7 +9908,7 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note)
offset += 4;
/* Padding before pr_reg. */
- if (abfd->arch_info->bits_per_word == 64)
+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64)
offset += 4;
/* Make a ".reg/999" section and a ".reg" section. */
diff --git a/bfd/elf32-arc.c b/bfd/elf32-arc.c
index ef0d893..6903ad7 100644
--- a/bfd/elf32-arc.c
+++ b/bfd/elf32-arc.c
@@ -55,17 +55,20 @@ name_for_global_symbol (struct elf_link_hash_entry *h)
Elf_Internal_Rela _rel; \
bfd_byte * _loc; \
\
- BFD_ASSERT (_htab->srel##SECTION &&_htab->srel##SECTION->contents); \
- _loc = _htab->srel##SECTION->contents \
- + ((_htab->srel##SECTION->reloc_count) \
- * sizeof (Elf32_External_Rela)); \
- _htab->srel##SECTION->reloc_count++; \
- _rel.r_addend = ADDEND; \
- _rel.r_offset = (_htab->s##SECTION)->output_section->vma \
- + (_htab->s##SECTION)->output_offset + OFFSET; \
- BFD_ASSERT ((long) SYM_IDX != -1); \
- _rel.r_info = ELF32_R_INFO (SYM_IDX, TYPE); \
- bfd_elf32_swap_reloca_out (BFD, &_rel, _loc); \
+ if (_htab->dynamic_sections_created == TRUE) \
+ { \
+ BFD_ASSERT (_htab->srel##SECTION &&_htab->srel##SECTION->contents); \
+ _loc = _htab->srel##SECTION->contents \
+ + ((_htab->srel##SECTION->reloc_count) \
+ * sizeof (Elf32_External_Rela)); \
+ _htab->srel##SECTION->reloc_count++; \
+ _rel.r_addend = ADDEND; \
+ _rel.r_offset = (_htab->s##SECTION)->output_section->vma \
+ + (_htab->s##SECTION)->output_offset + OFFSET; \
+ BFD_ASSERT ((long) SYM_IDX != -1); \
+ _rel.r_info = ELF32_R_INFO (SYM_IDX, TYPE); \
+ bfd_elf32_swap_reloca_out (BFD, &_rel, _loc); \
+ } \
}
@@ -1184,7 +1187,6 @@ arc_special_overflow_checks (const struct arc_relocation_data reloc_data,
#define TLS_REL (bfd_signed_vma) \
((elf_hash_table (info))->tls_sec->output_section->vma)
#define TLS_TBSS (8)
-#define TCB_SIZE (8)
#define none (0)
@@ -1409,6 +1411,7 @@ elf_arc_relocate_section (bfd * output_bfd,
asection * sec;
struct elf_link_hash_entry * h2;
const char * msg;
+ bfd_boolean unresolved_reloc = FALSE;
struct arc_relocation_data reloc_data =
{
@@ -1496,6 +1499,14 @@ elf_arc_relocate_section (bfd * output_bfd,
}
else
{
+ bfd_boolean warned, ignored;
+ bfd_vma relocation ATTRIBUTE_UNUSED;
+
+ RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel,
+ r_symndx, symtab_hdr, sym_hashes,
+ h, sec, relocation,
+ unresolved_reloc, warned, ignored);
+
/* TODO: This code is repeated from below. We should
clean it and remove duplications.
Sec is used check for discarded sections.
@@ -1585,7 +1596,12 @@ elf_arc_relocate_section (bfd * output_bfd,
while (h->root.type == bfd_link_hash_indirect
|| h->root.type == bfd_link_hash_warning)
+ {
+ struct elf_link_hash_entry *h_old = h;
h = (struct elf_link_hash_entry *) h->root.u.i.link;
+ if (h->got.glist == 0 && h_old->got.glist != h->got.glist)
+ h->got.glist = h_old->got.glist;
+ }
/* TODO: Need to validate what was the intention. */
/* BFD_ASSERT ((h->dynindx == -1) || (h->forced_local != 0)); */
@@ -1705,16 +1721,22 @@ elf_arc_relocate_section (bfd * output_bfd,
}
}
+
+#define IS_ARC_PCREL_TYPE(TYPE) \
+ ( (TYPE == R_ARC_PC32) \
+ || (TYPE == R_ARC_32_PCREL))
+
switch (r_type)
{
case R_ARC_32:
case R_ARC_32_ME:
case R_ARC_PC32:
case R_ARC_32_PCREL:
- if ((bfd_link_pic (info))
- && ((r_type != R_ARC_PC32 && r_type != R_ARC_32_PCREL)
+ if (bfd_link_pic (info)
+ && (!IS_ARC_PCREL_TYPE (r_type)
|| (h != NULL
&& h->dynindx != -1
+ && !h->def_regular
&& (!info->symbolic || !h->def_regular))))
{
Elf_Internal_Rela outrel;
@@ -1731,6 +1753,7 @@ elf_arc_relocate_section (bfd * output_bfd,
info,
input_section,
rel->r_offset);
+
if (outrel.r_offset == (bfd_vma) -1)
skip = TRUE;
@@ -1738,10 +1761,6 @@ elf_arc_relocate_section (bfd * output_bfd,
outrel.r_offset += (input_section->output_section->vma
+ input_section->output_offset);
-#define IS_ARC_PCREL_TYPE(TYPE) \
- ( (TYPE == R_ARC_PC32) \
- || (TYPE == R_ARC_32_PCREL))
-
if (skip)
{
memset (&outrel, 0, sizeof outrel);
@@ -1749,10 +1768,10 @@ elf_arc_relocate_section (bfd * output_bfd,
}
else if (h != NULL
&& h->dynindx != -1
- && ((IS_ARC_PCREL_TYPE (r_type))
- || !(bfd_link_executable (info)
- || SYMBOLIC_BIND (info, h))
- || ! h->def_regular))
+ && (IS_ARC_PCREL_TYPE (r_type)
+ || !(bfd_link_executable (info)
+ || SYMBOLIC_BIND (info, h))
+ || ! h->def_regular))
{
BFD_ASSERT (h != NULL);
if ((input_section->flags & SEC_ALLOC) != 0)
@@ -1885,10 +1904,14 @@ elf_arc_check_relocs (bfd * abfd,
const Elf_Internal_Rela * rel_end;
bfd * dynobj;
asection * sreloc = NULL;
+ struct elf_link_hash_table * htab = elf_hash_table (info);
if (bfd_link_relocatable (info))
return TRUE;
+ if (htab->dynobj == NULL)
+ htab->dynobj = abfd;
+
dynobj = (elf_hash_table (info))->dynobj;
symtab_hdr = &((elf_tdata (abfd))->symtab_hdr);
sym_hashes = elf_sym_hashes (abfd);
@@ -1910,15 +1933,6 @@ elf_arc_check_relocs (bfd * abfd,
}
howto = arc_elf_howto (r_type);
- if (dynobj == NULL
- && (is_reloc_for_GOT (howto)
- || is_reloc_for_TLS (howto)))
- {
- dynobj = elf_hash_table (info)->dynobj = abfd;
- if (! _bfd_elf_create_got_section (abfd, info))
- return FALSE;
- }
-
/* Load symbol information. */
r_symndx = ELF32_R_SYM (rel->r_info);
if (r_symndx < symtab_hdr->sh_info) /* Is a local symbol. */
@@ -1935,7 +1949,8 @@ elf_arc_check_relocs (bfd * abfd,
and the dynamic linker can not resolve these. However
the error should not occur for e.g. debugging or
non-readonly sections. */
- if ((bfd_link_dll (info) && !bfd_link_pie (info))
+ if (h != NULL
+ && (bfd_link_dll (info) && !bfd_link_pie (info))
&& (sec->flags & SEC_ALLOC) != 0
&& (sec->flags & SEC_READONLY) != 0
&& ((sec->flags & SEC_CODE) != 0
@@ -1974,6 +1989,10 @@ elf_arc_check_relocs (bfd * abfd,
{
if (sreloc == NULL)
{
+ if (info->dynamic
+ && ! htab->dynamic_sections_created
+ && ! _bfd_elf_link_create_dynamic_sections (abfd, info))
+ return FALSE;
sreloc = _bfd_elf_make_dynamic_reloc_section (sec, dynobj,
2, abfd,
/*rela*/
@@ -2001,6 +2020,9 @@ elf_arc_check_relocs (bfd * abfd,
if (is_reloc_for_GOT (howto)
|| is_reloc_for_TLS (howto))
{
+ if (! _bfd_elf_create_got_section (dynobj, info))
+ return FALSE;
+
arc_fill_got_info_for_reloc (
arc_got_entry_type_for_reloc (howto),
get_got_entry_list_for_symbol (abfd, r_symndx, h),
@@ -2627,7 +2649,8 @@ elf_arc_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
const char *name = s->name + 5;
bfd *ibfd;
for (ibfd = info->input_bfds; ibfd; ibfd = ibfd->link.next)
- if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour)
+ if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour
+ && ibfd->flags & DYNAMIC)
{
asection *target = bfd_get_section_by_name (ibfd, name);
if (target != NULL
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 9cd34ca..b9f5d04 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -3567,9 +3567,7 @@ using_thumb_only (struct elf32_arm_link_hash_table *globals)
arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC, Tag_CPU_arch);
/* Force return logic to be reviewed for each new architecture. */
- BFD_ASSERT (arch <= TAG_CPU_ARCH_V8
- || arch == TAG_CPU_ARCH_V8M_BASE
- || arch == TAG_CPU_ARCH_V8M_MAIN);
+ BFD_ASSERT (arch <= TAG_CPU_ARCH_V8M_MAIN);
if (arch == TAG_CPU_ARCH_V6_M
|| arch == TAG_CPU_ARCH_V6S_M
@@ -3596,14 +3594,13 @@ using_thumb2 (struct elf32_arm_link_hash_table *globals)
arch = bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC, Tag_CPU_arch);
/* Force return logic to be reviewed for each new architecture. */
- BFD_ASSERT (arch <= TAG_CPU_ARCH_V8
- || arch == TAG_CPU_ARCH_V8M_BASE
- || arch == TAG_CPU_ARCH_V8M_MAIN);
+ BFD_ASSERT (arch <= TAG_CPU_ARCH_V8M_MAIN);
return (arch == TAG_CPU_ARCH_V6T2
|| arch == TAG_CPU_ARCH_V7
|| arch == TAG_CPU_ARCH_V7E_M
|| arch == TAG_CPU_ARCH_V8
+ || arch == TAG_CPU_ARCH_V8R
|| arch == TAG_CPU_ARCH_V8M_MAIN);
}
@@ -3616,9 +3613,7 @@ using_thumb2_bl (struct elf32_arm_link_hash_table *globals)
bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC, Tag_CPU_arch);
/* Force return logic to be reviewed for each new architecture. */
- BFD_ASSERT (arch <= TAG_CPU_ARCH_V8
- || arch == TAG_CPU_ARCH_V8M_BASE
- || arch == TAG_CPU_ARCH_V8M_MAIN);
+ BFD_ASSERT (arch <= TAG_CPU_ARCH_V8M_MAIN);
/* Architecture was introduced after ARMv6T2 (eg. ARMv6-M). */
return (arch == TAG_CPU_ARCH_V6T2
@@ -3824,14 +3819,13 @@ arch_has_arm_nop (struct elf32_arm_link_hash_table *globals)
Tag_CPU_arch);
/* Force return logic to be reviewed for each new architecture. */
- BFD_ASSERT (arch <= TAG_CPU_ARCH_V8
- || arch == TAG_CPU_ARCH_V8M_BASE
- || arch == TAG_CPU_ARCH_V8M_MAIN);
+ BFD_ASSERT (arch <= TAG_CPU_ARCH_V8M_MAIN);
return (arch == TAG_CPU_ARCH_V6T2
|| arch == TAG_CPU_ARCH_V6K
|| arch == TAG_CPU_ARCH_V7
- || arch == TAG_CPU_ARCH_V8);
+ || arch == TAG_CPU_ARCH_V8
+ || arch == TAG_CPU_ARCH_V8R);
}
static bfd_boolean
@@ -10508,7 +10502,7 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto,
/* PR 21523: Use an absolute value. The user of this reloc will
have already selected an ADD or SUB insn appropriately. */
- value = abs (relocation);
+ value = labs (relocation);
if (value >= 0x1000)
return bfd_reloc_overflow;
@@ -13329,6 +13323,25 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V8), /* V7E_M. */
T(V8) /* V8. */
};
+ const int v8r[] =
+ {
+ T(V8R), /* PRE_V4. */
+ T(V8R), /* V4. */
+ T(V8R), /* V4T. */
+ T(V8R), /* V5T. */
+ T(V8R), /* V5TE. */
+ T(V8R), /* V5TEJ. */
+ T(V8R), /* V6. */
+ T(V8R), /* V6KZ. */
+ T(V8R), /* V6T2. */
+ T(V8R), /* V6K. */
+ T(V8R), /* V7. */
+ T(V8R), /* V6_M. */
+ T(V8R), /* V6S_M. */
+ T(V8R), /* V7E_M. */
+ T(V8), /* V8. */
+ T(V8R), /* V8R. */
+ };
const int v8m_baseline[] =
{
-1, /* PRE_V4. */
@@ -13346,7 +13359,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V8M_BASE), /* V6S_M. */
-1, /* V7E_M. */
-1, /* V8. */
- -1,
+ -1, /* V8R. */
T(V8M_BASE) /* V8-M BASELINE. */
};
const int v8m_mainline[] =
@@ -13366,7 +13379,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V8M_MAIN), /* V6S_M. */
T(V8M_MAIN), /* V7E_M. */
-1, /* V8. */
- -1,
+ -1, /* V8R. */
T(V8M_MAIN), /* V8-M BASELINE. */
T(V8M_MAIN) /* V8-M MAINLINE. */
};
@@ -13387,7 +13400,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
T(V6S_M), /* V6S_M. */
T(V7E_M), /* V7E_M. */
T(V8), /* V8. */
- -1, /* Unused. */
+ -1, /* V8R. */
T(V8M_BASE), /* V8-M BASELINE. */
T(V8M_MAIN), /* V8-M MAINLINE. */
T(V4T_PLUS_V6_M) /* V4T plus V6_M. */
@@ -13401,7 +13414,7 @@ tag_cpu_arch_combine (bfd *ibfd, int oldtag, int *secondary_compat_out,
v6s_m,
v7e_m,
v8,
- NULL,
+ v8r,
v8m_baseline,
v8m_mainline,
/* Pseudo-architecture. */
@@ -13825,6 +13838,9 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
follow the requirement of the input. */
if (out_attr[i].i == 0)
{
+ /* This assert is still reasonable, we shouldn't
+ produce the suspicious build attribute
+ combination (See below for in_attr). */
BFD_ASSERT (out_attr[Tag_ABI_HardFP_use].i == 0);
out_attr[i].i = in_attr[i].i;
out_attr[Tag_ABI_HardFP_use].i
@@ -13835,7 +13851,13 @@ elf32_arm_merge_eabi_attributes (bfd *ibfd, struct bfd_link_info *info)
nothing. */
else if (in_attr[i].i == 0)
{
- BFD_ASSERT (in_attr[Tag_ABI_HardFP_use].i == 0);
+ /* We used to assert that Tag_ABI_HardFP_use was
+ zero here, but we should never assert when
+ consuming an object file that has suspicious
+ build attributes. The single precision variant
+ of 'no FP architecture' is still 'no FP
+ architecture', so we just ignore the tag in this
+ case. */
break;
}
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 1fdc06c..df16775 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -617,6 +617,60 @@ static const bfd_byte elf_i386_pic_non_lazy_plt_entry[NON_LAZY_PLT_ENTRY_SIZE] =
0x66, 0x90 /* xchg %ax,%ax */
};
+/* The first entry in an absolute IBT-enabled lazy procedure linkage
+ table looks like this. */
+
+static const bfd_byte elf_i386_lazy_ibt_plt0_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xff, 0x35, 0, 0, 0, 0, /* pushl GOT[1] */
+ 0xff, 0x25, 0, 0, 0, 0, /* jmp *GOT[2] */
+ 0x0f, 0x1f, 0x40, 0x00 /* nopl 0(%rax) */
+};
+
+/* Subsequent entries for an absolute IBT-enabled lazy procedure linkage
+ table look like this. Subsequent entries for a PIC IBT-enabled lazy
+ procedure linkage table are the same. */
+
+static const bfd_byte elf_i386_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xf3, 0x0f, 0x1e, 0xfb, /* endbr32 */
+ 0x68, 0, 0, 0, 0, /* pushl immediate */
+ 0xe9, 0, 0, 0, 0, /* jmp relative */
+ 0x66, 0x90 /* xchg %ax,%ax */
+};
+
+/* The first entry in a PIC IBT-enabled lazy procedure linkage table
+ look like. */
+
+static const bfd_byte elf_i386_pic_lazy_ibt_plt0_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xff, 0xb3, 4, 0, 0, 0, /* pushl 4(%ebx) */
+ 0xff, 0xa3, 8, 0, 0, 0, /* jmp *8(%ebx) */
+ 0x0f, 0x1f, 0x40, 0x00 /* nopl 0(%rax) */
+};
+
+/* Entries for branches with IBT-enabled in the absolute non-lazey
+ procedure linkage table look like this. They have the same size
+ as the lazy PLT entry. */
+
+static const bfd_byte elf_i386_non_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xf3, 0x0f, 0x1e, 0xfb, /* endbr32 */
+ 0xff, 0x25, 0, 0, 0, 0, /* jmp *name@GOT */
+ 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nopw 0x0(%rax,%rax,1) */
+};
+
+/* Entries for branches with IBT-enabled in the PIC non-lazey procedure
+ linkage table look like this. They have the same size as the lazy
+ PLT entry. */
+
+static const bfd_byte elf_i386_pic_non_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xf3, 0x0f, 0x1e, 0xfb, /* endbr32 */
+ 0xff, 0xa3, 0, 0, 0, 0, /* jmp *name@GOT(%ebx) */
+ 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nopw 0x0(%rax,%rax,1) */
+};
+
/* .eh_frame covering the lazy .plt section. */
static const bfd_byte elf_i386_eh_frame_lazy_plt[] =
@@ -656,6 +710,41 @@ static const bfd_byte elf_i386_eh_frame_lazy_plt[] =
DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop
};
+/* .eh_frame covering the lazy .plt section with IBT-enabled. */
+
+static const bfd_byte elf_i386_eh_frame_lazy_ibt_plt[] =
+{
+ PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */
+ 0, 0, 0, 0, /* CIE ID */
+ 1, /* CIE version */
+ 'z', 'R', 0, /* Augmentation string */
+ 1, /* Code alignment factor */
+ 0x7c, /* Data alignment factor */
+ 8, /* Return address column */
+ 1, /* Augmentation size */
+ DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */
+ DW_CFA_def_cfa, 4, 4, /* DW_CFA_def_cfa: r4 (esp) ofs 4 */
+ DW_CFA_offset + 8, 1, /* DW_CFA_offset: r8 (eip) at cfa-4 */
+ DW_CFA_nop, DW_CFA_nop,
+
+ PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */
+ PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */
+ 0, 0, 0, 0, /* R_386_PC32 .plt goes here */
+ 0, 0, 0, 0, /* .plt size goes here */
+ 0, /* Augmentation size */
+ DW_CFA_def_cfa_offset, 8, /* DW_CFA_def_cfa_offset: 8 */
+ DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */
+ DW_CFA_def_cfa_offset, 12, /* DW_CFA_def_cfa_offset: 12 */
+ DW_CFA_advance_loc + 10, /* DW_CFA_advance_loc: 10 to __PLT__+16 */
+ DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */
+ 11, /* Block length */
+ DW_OP_breg4, 4, /* DW_OP_breg4 (esp): 4 */
+ DW_OP_breg8, 0, /* DW_OP_breg8 (eip): 0 */
+ DW_OP_lit15, DW_OP_and, DW_OP_lit9, DW_OP_ge,
+ DW_OP_lit2, DW_OP_shl, DW_OP_plus,
+ DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop
+};
+
/* .eh_frame covering the non-lazy .plt section. */
static const bfd_byte elf_i386_eh_frame_non_lazy_plt[] =
@@ -786,6 +875,34 @@ static const struct elf_i386_non_lazy_plt_layout elf_i386_non_lazy_plt =
elf_i386_eh_frame_non_lazy_plt, /* eh_frame_plt */
sizeof (elf_i386_eh_frame_non_lazy_plt) /* eh_frame_plt_size */
};
+
+static const struct elf_i386_lazy_plt_layout elf_i386_lazy_ibt_plt =
+ {
+ elf_i386_lazy_ibt_plt0_entry, /* plt0_entry */
+ sizeof (elf_i386_lazy_ibt_plt0_entry), /* plt0_entry_size */
+ 2, /* plt0_got1_offset */
+ 8, /* plt0_got2_offset */
+ elf_i386_lazy_ibt_plt_entry, /* plt_entry */
+ LAZY_PLT_ENTRY_SIZE, /* plt_entry_size */
+ 4+2, /* plt_got_offset */
+ 4+1, /* plt_reloc_offset */
+ 4+6, /* plt_plt_offset */
+ 0, /* plt_lazy_offset */
+ elf_i386_pic_lazy_ibt_plt0_entry, /* pic_plt0_entry */
+ elf_i386_lazy_ibt_plt_entry, /* pic_plt_entry */
+ elf_i386_eh_frame_lazy_ibt_plt, /* eh_frame_plt */
+ sizeof (elf_i386_eh_frame_lazy_ibt_plt) /* eh_frame_plt_size */
+ };
+
+static const struct elf_i386_non_lazy_plt_layout elf_i386_non_lazy_ibt_plt =
+ {
+ elf_i386_non_lazy_ibt_plt_entry, /* plt_entry */
+ elf_i386_pic_non_lazy_ibt_plt_entry,/* pic_plt_entry */
+ LAZY_PLT_ENTRY_SIZE, /* plt_entry_size */
+ 4+2, /* plt_got_offset */
+ elf_i386_eh_frame_non_lazy_plt, /* eh_frame_plt */
+ sizeof (elf_i386_eh_frame_non_lazy_plt) /* eh_frame_plt_size */
+ };
/* On VxWorks, the .rel.plt.unloaded section has absolute relocations
@@ -828,14 +945,16 @@ static const struct elf_i386_backend_data elf_i386_arch_bed =
it isn't dynamic and
1. Has non-GOT/non-PLT relocations in text section. Or
2. Has no GOT/PLT relocation.
+ Local undefined weak symbol is always resolved to 0.
*/
#define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, GOT_RELOC, EH) \
((EH)->elf.root.type == bfd_link_hash_undefweak \
- && bfd_link_executable (INFO) \
- && (elf_i386_hash_table (INFO)->interp == NULL \
- || !(GOT_RELOC) \
- || (EH)->has_non_got_reloc \
- || !(INFO)->dynamic_undefined_weak))
+ && ((EH)->elf.forced_local \
+ || (bfd_link_executable (INFO) \
+ && (elf_i386_hash_table (INFO)->interp == NULL \
+ || !(GOT_RELOC) \
+ || (EH)->has_non_got_reloc \
+ || !(INFO)->dynamic_undefined_weak))))
/* i386 ELF linker hash entry. */
@@ -889,6 +1008,9 @@ struct elf_i386_link_hash_entry
GOT and PLT relocations against the same function. */
union gotplt_union plt_got;
+ /* Information about the second PLT entry. */
+ union gotplt_union plt_second;
+
/* Offset of the GOTPLT entry reserved for the TLS descriptor,
starting at the end of the jump table. */
bfd_vma tlsdesc_got;
@@ -937,6 +1059,8 @@ struct elf_i386_link_hash_table
/* Short-cuts to get to dynamic linker sections. */
asection *interp;
asection *plt_eh_frame;
+ asection *plt_second;
+ asection *plt_second_eh_frame;
asection *plt_got;
asection *plt_got_eh_frame;
@@ -1787,11 +1911,13 @@ convert_branch:
return TRUE;
/* def_regular is set by an assignment in a linker script in
- bfd_elf_record_link_assignment. */
- if ((h->def_regular
- || h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && SYMBOL_REFERENCES_LOCAL (link_info, h))
+ bfd_elf_record_link_assignment. start_stop is set on
+ __start_SECNAME/__stop_SECNAME which mark section SECNAME. */
+ if (h->start_stop
+ || ((h->def_regular
+ || h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && SYMBOL_REFERENCES_LOCAL (link_info, h)))
{
convert_load:
if (opcode == 0x8b)
@@ -1945,6 +2071,8 @@ elf_i386_check_relocs (bfd *abfd,
goto error_return;
/* Fake a STT_GNU_IFUNC symbol. */
+ h->root.root.string = bfd_elf_sym_name (abfd, symtab_hdr,
+ isym, NULL);
h->type = STT_GNU_IFUNC;
h->def_regular = 1;
h->ref_regular = 1;
@@ -2181,15 +2309,10 @@ do_relocation:
else if (h->type == STT_GNU_IFUNC
&& bfd_link_pic (info))
{
- if (isym == NULL)
- name = h->root.root.string;
- else
- name = bfd_elf_sym_name (abfd, symtab_hdr, isym,
- NULL);
- _bfd_error_handler
- /* xgettext:c-format */
- (_("%B: unsupported non-PIC call to IFUNC `%s'"),
- abfd, name);
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B: unsupported non-PIC call to IFUNC `%s'"),
+ abfd, h->root.root.string);
bfd_set_error (bfd_error_bad_value);
goto error_return;
}
@@ -2645,12 +2768,29 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
here if it is defined and referenced in a non-shared object. */
if (h->type == STT_GNU_IFUNC
&& h->def_regular)
- return _bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs,
- &htab->readonly_dynrelocs_against_ifunc,
- plt_entry_size,
- (htab->plt.has_plt0 *
+ {
+ if (_bfd_elf_allocate_ifunc_dyn_relocs (info, h, &eh->dyn_relocs,
+ &htab->readonly_dynrelocs_against_ifunc,
+ plt_entry_size,
+ (htab->plt.has_plt0 *
plt_entry_size),
- 4, TRUE);
+ 4, TRUE))
+ {
+ asection *s = htab->plt_second;
+ if (h->plt.offset != (bfd_vma) -1 && s != NULL)
+ {
+ /* Use the second PLT section if it is created. */
+ eh->plt_second.offset = s->size;
+
+ /* Make room for this entry in the second PLT section. */
+ s->size += htab->non_lazy_plt->plt_entry_size;
+ }
+
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
/* Don't create the PLT entry if there are only function pointer
relocations which can be resolved at run-time. */
else if (htab->elf.dynamic_sections_created
@@ -2678,6 +2818,7 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{
asection *s = htab->elf.splt;
+ asection *second_s = htab->plt_second;
asection *got_s = htab->plt_got;
/* If this is the first .plt entry, make room for the special
@@ -2689,7 +2830,11 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
if (use_plt_got)
eh->plt_got.offset = got_s->size;
else
- h->plt.offset = s->size;
+ {
+ h->plt.offset = s->size;
+ if (second_s)
+ eh->plt_second.offset = second_s->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
@@ -2708,8 +2853,18 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
}
else
{
- h->root.u.def.section = s;
- h->root.u.def.value = h->plt.offset;
+ if (second_s)
+ {
+ /* We need to make a call to the entry of the
+ second PLT instead of regular PLT entry. */
+ h->root.u.def.section = second_s;
+ h->root.u.def.value = eh->plt_second.offset;
+ }
+ else
+ {
+ h->root.u.def.section = s;
+ h->root.u.def.value = h->plt.offset;
+ }
}
}
@@ -2719,6 +2874,8 @@ elf_i386_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
else
{
s->size += plt_entry_size;
+ if (second_s)
+ second_s->size += htab->non_lazy_plt->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
@@ -3371,6 +3528,15 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
&& !bfd_is_abs_section (htab->plt_got->output_section))
htab->plt_got_eh_frame->size
= htab->non_lazy_plt->eh_frame_plt_size;
+
+ /* Unwind info for the second PLT and .plt.got sections are
+ identical. */
+ if (htab->plt_second_eh_frame != NULL
+ && htab->plt_second != NULL
+ && htab->plt_second->size != 0
+ && !bfd_is_abs_section (htab->plt_second->output_section))
+ htab->plt_second_eh_frame->size
+ = htab->non_lazy_plt->eh_frame_plt_size;
}
/* We now have determined the sizes of the various dynamic sections.
@@ -3398,9 +3564,11 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
else if (s == htab->elf.sgotplt
|| s == htab->elf.iplt
|| s == htab->elf.igotplt
+ || s == htab->plt_second
|| s == htab->plt_got
|| s == htab->plt_eh_frame
|| s == htab->plt_got_eh_frame
+ || s == htab->plt_second_eh_frame
|| s == htab->elf.sdynbss
|| s == htab->elf.sdynrelro)
{
@@ -3473,6 +3641,17 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
+ PLT_FDE_LEN_OFFSET));
}
+ if (htab->plt_second_eh_frame != NULL
+ && htab->plt_second_eh_frame->contents != NULL)
+ {
+ memcpy (htab->plt_second_eh_frame->contents,
+ htab->non_lazy_plt->eh_frame_plt,
+ htab->plt_second_eh_frame->size);
+ bfd_put_32 (dynobj, htab->plt_second->size,
+ (htab->plt_second_eh_frame->contents
+ + PLT_FDE_LEN_OFFSET));
+ }
+
if (htab->elf.dynamic_sections_created)
{
/* Add some entries to the .dynamic section. We fill in the
@@ -3904,13 +4083,15 @@ elf_i386_relocate_section (bfd *output_bfd,
continue;
}
+ eh = (struct elf_i386_link_hash_entry *) h;
+
/* Since STT_GNU_IFUNC symbol must go through PLT, we handle
it here if it is defined in a non-shared object. */
if (h != NULL
&& h->type == STT_GNU_IFUNC
&& h->def_regular)
{
- asection *plt, *gotplt, *base_got;
+ asection *gotplt, *base_got;
bfd_vma plt_index;
const char *name;
@@ -3927,12 +4108,22 @@ elf_i386_relocate_section (bfd *output_bfd,
/* STT_GNU_IFUNC symbol must go through PLT. */
if (htab->elf.splt != NULL)
{
- plt = htab->elf.splt;
+ if (htab->plt_second != NULL)
+ {
+ resolved_plt = htab->plt_second;
+ plt_offset = eh->plt_second.offset;
+ }
+ else
+ {
+ resolved_plt = htab->elf.splt;
+ plt_offset = h->plt.offset;
+ }
gotplt = htab->elf.sgotplt;
}
else
{
- plt = htab->elf.iplt;
+ resolved_plt = htab->elf.iplt;
+ plt_offset = h->plt.offset;
gotplt = htab->elf.igotplt;
}
@@ -4032,8 +4223,8 @@ elf_i386_relocate_section (bfd *output_bfd,
goto bad_ifunc_reloc;
}
- relocation = (plt->output_section->vma
- + plt->output_offset + h->plt.offset);
+ relocation = (resolved_plt->output_section->vma
+ + resolved_plt->output_offset + plt_offset);
switch (r_type)
{
@@ -4081,6 +4272,10 @@ do_ifunc_pointer:
|| h->forced_local
|| bfd_link_executable (info))
{
+ info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
+ h->root.root.string,
+ h->root.u.def.section->owner);
+
/* This symbol is resolved locally. */
outrel.r_info = ELF32_R_INFO (0, R_386_IRELATIVE);
bfd_put_32 (output_bfd,
@@ -4123,7 +4318,6 @@ do_ifunc_pointer:
}
}
- eh = (struct elf_i386_link_hash_entry *) h;
resolved_to_zero = (eh != NULL
&& UNDEFINED_WEAK_RESOLVED_TO_ZERO (info,
eh->has_got_reloc,
@@ -4421,8 +4615,16 @@ disallow_got32:
if (h->plt.offset != (bfd_vma) -1)
{
- resolved_plt = htab->elf.splt;
- plt_offset = h->plt.offset;
+ if (htab->plt_second != NULL)
+ {
+ resolved_plt = htab->plt_second;
+ plt_offset = eh->plt_second.offset;
+ }
+ else
+ {
+ resolved_plt = htab->elf.splt;
+ plt_offset = h->plt.offset;
+ }
}
else
{
@@ -5255,6 +5457,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
const struct elf_i386_backend_data *abed;
struct elf_i386_link_hash_entry *eh;
bfd_boolean local_undefweak;
+ bfd_boolean use_plt_second;
htab = elf_i386_hash_table (info);
if (htab == NULL)
@@ -5263,6 +5466,9 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
abed = get_elf_i386_backend_data (output_bfd);
plt_entry_size = htab->plt.plt_entry_size;
+ /* Use the second PLT section only if there is .plt section. */
+ use_plt_second = htab->elf.splt != NULL && htab->plt_second != NULL;
+
eh = (struct elf_i386_link_hash_entry *) h;
if (eh->no_finish_dynamic_symbol)
abort ();
@@ -5276,11 +5482,11 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
if (h->plt.offset != (bfd_vma) -1)
{
- bfd_vma plt_index;
+ bfd_vma plt_index, plt_offset;
bfd_vma got_offset;
Elf_Internal_Rela rel;
bfd_byte *loc;
- asection *plt, *gotplt, *relplt;
+ asection *plt, *resolved_plt, *gotplt, *relplt;
/* When building a static executable, use .iplt, .igot.plt and
.rel.iplt sections for STT_GNU_IFUNC symbols. */
@@ -5337,13 +5543,33 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
the first slot. */
memcpy (plt->contents + h->plt.offset, htab->plt.plt_entry,
plt_entry_size);
+
+ if (use_plt_second)
+ {
+ const bfd_byte *plt_entry;
+ if (bfd_link_pic (info))
+ plt_entry = htab->non_lazy_plt->pic_plt_entry;
+ else
+ plt_entry = htab->non_lazy_plt->plt_entry;
+ memcpy (htab->plt_second->contents + eh->plt_second.offset,
+ plt_entry, htab->non_lazy_plt->plt_entry_size);
+
+ resolved_plt = htab->plt_second;
+ plt_offset = eh->plt_second.offset;
+ }
+ else
+ {
+ resolved_plt = plt;
+ plt_offset = h->plt.offset;
+ }
+
if (! bfd_link_pic (info))
{
bfd_put_32 (output_bfd,
(gotplt->output_section->vma
+ gotplt->output_offset
+ got_offset),
- plt->contents + h->plt.offset
+ resolved_plt->contents + plt_offset
+ htab->plt.plt_got_offset);
if (abed->os == is_vxworks)
@@ -5367,8 +5593,8 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
loc = (htab->srelplt2->contents + reloc_index
* sizeof (Elf32_External_Rel));
- rel.r_offset = (htab->elf.splt->output_section->vma
- + htab->elf.splt->output_offset
+ rel.r_offset = (plt->output_section->vma
+ + plt->output_offset
+ h->plt.offset + 2),
rel.r_info = ELF32_R_INFO (htab->elf.hgot->indx, R_386_32);
bfd_elf32_swap_reloc_out (output_bfd, &rel, loc);
@@ -5386,7 +5612,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
else
{
bfd_put_32 (output_bfd, got_offset,
- plt->contents + h->plt.offset
+ resolved_plt->contents + plt_offset
+ htab->plt.plt_got_offset);
}
@@ -5413,6 +5639,10 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
&& h->def_regular
&& h->type == STT_GNU_IFUNC))
{
+ info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
+ h->root.root.string,
+ h->root.u.def.section->owner);
+
/* If an STT_GNU_IFUNC symbol is locally defined, generate
R_386_IRELATIVE instead of R_386_JUMP_SLOT. Store addend
in the .got.plt section. */
@@ -5548,6 +5778,10 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
}
if (SYMBOL_REFERENCES_LOCAL (info, h))
{
+ info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
+ h->root.root.string,
+ h->root.u.def.section->owner);
+
bfd_put_32 (output_bfd,
(h->root.u.def.value
+ h->root.u.def.section->output_section->vma
@@ -5566,6 +5800,7 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
else
{
asection *plt;
+ bfd_vma plt_offset;
if (!h->pointer_equality_needed)
abort ();
@@ -5573,10 +5808,19 @@ elf_i386_finish_dynamic_symbol (bfd *output_bfd,
/* For non-shared object, we can't use .got.plt, which
contains the real function addres if we need pointer
equality. We load the GOT entry with the PLT entry. */
- plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
+ if (htab->plt_second != NULL)
+ {
+ plt = htab->plt_second;
+ plt_offset = eh->plt_second.offset;
+ }
+ else
+ {
+ plt = htab->elf.splt ? htab->elf.splt : htab->elf.iplt;
+ plt_offset = h->plt.offset;
+ }
bfd_put_32 (output_bfd,
(plt->output_section->vma
- + plt->output_offset + h->plt.offset),
+ + plt->output_offset + plt_offset),
htab->elf.sgot->contents + h->got.offset);
return TRUE;
}
@@ -5857,6 +6101,10 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
if (htab->plt_got != NULL && htab->plt_got->size > 0)
elf_section_data (htab->plt_got->output_section)
->this_hdr.sh_entsize = htab->non_lazy_plt->plt_entry_size;
+
+ if (htab->plt_second != NULL && htab->plt_second->size > 0)
+ elf_section_data (htab->plt_second->output_section)
+ ->this_hdr.sh_entsize = htab->non_lazy_plt->plt_entry_size;
}
/* Fill in the first three entries in the global offset table. */
@@ -5934,6 +6182,35 @@ elf_i386_finish_dynamic_sections (bfd *output_bfd,
}
}
+ /* Adjust .eh_frame for the second PLT section. */
+ if (htab->plt_second_eh_frame != NULL
+ && htab->plt_second_eh_frame->contents != NULL)
+ {
+ if (htab->plt_second != NULL
+ && htab->plt_second->size != 0
+ && (htab->plt_second->flags & SEC_EXCLUDE) == 0
+ && htab->plt_second->output_section != NULL
+ && htab->plt_second_eh_frame->output_section != NULL)
+ {
+ bfd_vma plt_start = htab->plt_second->output_section->vma;
+ bfd_vma eh_frame_start
+ = (htab->plt_second_eh_frame->output_section->vma
+ + htab->plt_second_eh_frame->output_offset
+ + PLT_FDE_START_OFFSET);
+ bfd_put_signed_32 (dynobj, plt_start - eh_frame_start,
+ htab->plt_second_eh_frame->contents
+ + PLT_FDE_START_OFFSET);
+ }
+ if (htab->plt_second_eh_frame->sec_info_type
+ == SEC_INFO_TYPE_EH_FRAME)
+ {
+ if (! _bfd_elf_write_section_eh_frame (output_bfd, info,
+ htab->plt_second_eh_frame,
+ htab->plt_second_eh_frame->contents))
+ return FALSE;
+ }
+ }
+
if (htab->elf.sgot && htab->elf.sgot->size > 0)
elf_section_data (htab->elf.sgot->output_section)->this_hdr.sh_entsize = 4;
@@ -5994,6 +6271,7 @@ enum elf_i386_plt_type
plt_non_lazy = 0,
plt_lazy = 1 << 0,
plt_pic = 1 << 1,
+ plt_second = 1 << 2,
plt_unknown = -1
};
@@ -6031,6 +6309,8 @@ elf_i386_get_synthetic_symtab (bfd *abfd,
arelent **dynrelbuf;
const struct elf_i386_lazy_plt_layout *lazy_plt;
const struct elf_i386_non_lazy_plt_layout *non_lazy_plt;
+ const struct elf_i386_lazy_plt_layout *lazy_ibt_plt;
+ const struct elf_i386_non_lazy_plt_layout *non_lazy_ibt_plt;
asection *plt;
bfd_vma got_addr;
char *names;
@@ -6039,6 +6319,7 @@ elf_i386_get_synthetic_symtab (bfd *abfd,
{
{ ".plt", NULL, NULL, plt_unknown, 0, 0, 0 },
{ ".plt.got", NULL, NULL, plt_non_lazy, 0, 0, 0 },
+ { ".plt.sec", NULL, NULL, plt_second, 0, 0, 0 },
{ NULL, NULL, NULL, plt_non_lazy, 0, 0, 0 }
};
@@ -6067,10 +6348,14 @@ elf_i386_get_synthetic_symtab (bfd *abfd,
non_lazy_plt = NULL;
/* Silence GCC 6. */
lazy_plt = NULL;
+ non_lazy_ibt_plt = NULL;
+ lazy_ibt_plt = NULL;
switch (get_elf_i386_backend_data (abfd)->os)
{
case is_normal:
non_lazy_plt = &elf_i386_non_lazy_plt;
+ lazy_ibt_plt = &elf_i386_lazy_ibt_plt;
+ non_lazy_ibt_plt = &elf_i386_non_lazy_ibt_plt;
/* Fall through */
case is_vxworks:
lazy_plt = &elf_i386_lazy_plt;
@@ -6107,10 +6392,30 @@ elf_i386_get_synthetic_symtab (bfd *abfd,
/* Match lazy PLT first. */
if (memcmp (plt_contents, lazy_plt->plt0_entry,
lazy_plt->plt0_got1_offset) == 0)
- plt_type = plt_lazy;
+ {
+ /* The fist entry in the lazy IBT PLT is the same as the
+ normal lazy PLT. */
+ if (lazy_ibt_plt != NULL
+ && (memcmp (plt_contents + lazy_ibt_plt->plt_entry_size,
+ lazy_ibt_plt->plt_entry,
+ lazy_ibt_plt->plt_got_offset) == 0))
+ plt_type = plt_lazy | plt_second;
+ else
+ plt_type = plt_lazy;
+ }
else if (memcmp (plt_contents, lazy_plt->pic_plt0_entry,
lazy_plt->plt0_got1_offset) == 0)
- plt_type = plt_lazy | plt_pic;
+ {
+ /* The fist entry in the PIC lazy IBT PLT is the same as
+ the normal PIC lazy PLT. */
+ if (lazy_ibt_plt != NULL
+ && (memcmp (plt_contents + lazy_ibt_plt->plt_entry_size,
+ lazy_ibt_plt->pic_plt_entry,
+ lazy_ibt_plt->plt_got_offset) == 0))
+ plt_type = plt_lazy | plt_pic | plt_second;
+ else
+ plt_type = plt_lazy | plt_pic;
+ }
}
if (non_lazy_plt != NULL
@@ -6125,6 +6430,27 @@ elf_i386_get_synthetic_symtab (bfd *abfd,
plt_type = plt_pic;
}
+ if ((non_lazy_ibt_plt != NULL)
+ && (plt_type == plt_unknown || plt_type == plt_second))
+ {
+ if (memcmp (plt_contents,
+ non_lazy_ibt_plt->plt_entry,
+ non_lazy_ibt_plt->plt_got_offset) == 0)
+ {
+ /* Match IBT PLT. */
+ plt_type = plt_second;
+ non_lazy_plt = non_lazy_ibt_plt;
+ }
+ else if (memcmp (plt_contents,
+ non_lazy_ibt_plt->pic_plt_entry,
+ non_lazy_ibt_plt->plt_got_offset) == 0)
+ {
+ /* Match PIC IBT PLT. */
+ plt_type = plt_second | plt_pic;
+ non_lazy_plt = non_lazy_ibt_plt;
+ }
+ }
+
if (plt_type == plt_unknown)
continue;
@@ -6145,9 +6471,16 @@ elf_i386_get_synthetic_symtab (bfd *abfd,
i = 0;
}
- n = plt->size / plts[j].plt_entry_size;
- plts[j].count = n;
- count += n - i;
+ /* Skip lazy PLT when the second PLT is used. */
+ if ((plt_type & (plt_lazy | plt_second))
+ == (plt_lazy | plt_second))
+ plts[j].count = 0;
+ else
+ {
+ n = plt->size / plts[j].plt_entry_size;
+ plts[j].count = n;
+ count += n - i;
+ }
plts[j].contents = plt_contents;
@@ -6352,12 +6685,15 @@ elf_i386_parse_gnu_properties (bfd *abfd, unsigned int type,
{
case GNU_PROPERTY_X86_ISA_1_USED:
case GNU_PROPERTY_X86_ISA_1_NEEDED:
+ case GNU_PROPERTY_X86_FEATURE_1_AND:
if (datasz != 4)
{
_bfd_error_handler
((type == GNU_PROPERTY_X86_ISA_1_USED
? _("error: %B: <corrupt x86 ISA used size: 0x%x>")
- : _("error: %B: <corrupt x86 ISA needed size: 0x%x>")),
+ : (type == GNU_PROPERTY_X86_ISA_1_NEEDED
+ ? _("error: %B: <corrupt x86 ISA needed size: 0x%x>")
+ : _("error: %B: <corrupt x86 feature size: 0x%x>"))),
abfd, datasz);
return property_corrupt;
}
@@ -6379,11 +6715,12 @@ elf_i386_parse_gnu_properties (bfd *abfd, unsigned int type,
should be merged with ABFD. */
static bfd_boolean
-elf_i386_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
+elf_i386_merge_gnu_properties (struct bfd_link_info *info,
+ bfd *abfd ATTRIBUTE_UNUSED,
elf_property *aprop,
elf_property *bprop)
{
- unsigned int number;
+ unsigned int number, features;
bfd_boolean updated = FALSE;
unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
@@ -6405,6 +6742,59 @@ elf_i386_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
}
break;
+ case GNU_PROPERTY_X86_FEATURE_1_AND:
+ /* Only one of APROP and BPROP can be NULL:
+ 1. APROP & BPROP when both APROP and BPROP aren't NULL.
+ 2. If APROP is NULL, remove x86 feature.
+ 3. Otherwise, do nothing.
+ */
+ if (aprop != NULL && bprop != NULL)
+ {
+ features = 0;
+ if (info->ibt)
+ features = GNU_PROPERTY_X86_FEATURE_1_IBT;
+ if (info->shstk)
+ features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+ number = aprop->u.number;
+ /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ aprop->u.number = (number & bprop->u.number) | features;
+ updated = number != (unsigned int) aprop->u.number;
+ /* Remove the property if all feature bits are cleared. */
+ if (aprop->u.number == 0)
+ aprop->pr_kind = property_remove;
+ }
+ else
+ {
+ features = 0;
+ if (info->ibt)
+ features = GNU_PROPERTY_X86_FEATURE_1_IBT;
+ if (info->shstk)
+ features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+ if (features)
+ {
+ /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ if (aprop != NULL)
+ {
+ number = aprop->u.number;
+ aprop->u.number = number | features;
+ updated = number != (unsigned int) aprop->u.number;
+ }
+ else
+ {
+ bprop->u.number |= features;
+ updated = TRUE;
+ }
+ }
+ else if (aprop != NULL)
+ {
+ aprop->pr_kind = property_remove;
+ updated = TRUE;
+ }
+ }
+ break;
+
default:
/* Never should happen. */
abort ();
@@ -6420,11 +6810,76 @@ static bfd *
elf_i386_link_setup_gnu_properties (struct bfd_link_info *info)
{
bfd_boolean normal_target;
+ bfd_boolean lazy_plt;
asection *sec, *pltsec;
bfd *dynobj;
- unsigned int plt_alignment;
+ bfd_boolean use_ibt_plt;
+ unsigned int plt_alignment, features;
struct elf_i386_link_hash_table *htab;
- bfd *pbfd = _bfd_elf_link_setup_gnu_properties (info);
+ bfd *pbfd;
+
+ features = 0;
+ if (info->ibt)
+ features = GNU_PROPERTY_X86_FEATURE_1_IBT;
+ if (info->shstk)
+ features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+ if (features)
+ {
+ /* Turn on GNU_PROPERTY_X86_FEATURE_1_IBT and
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ bfd *ebfd = NULL;
+ elf_property *prop;
+
+ for (pbfd = info->input_bfds;
+ pbfd != NULL;
+ pbfd = pbfd->link.next)
+ if (bfd_get_flavour (pbfd) == bfd_target_elf_flavour
+ && bfd_count_sections (pbfd) != 0)
+ {
+ ebfd = pbfd;
+
+ if (elf_properties (pbfd) != NULL)
+ {
+ /* Find a normal input file with GNU property note. */
+ prop = _bfd_elf_get_property (pbfd,
+ GNU_PROPERTY_X86_FEATURE_1_AND,
+ 4);
+ /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ prop->u.number |= features;
+ prop->pr_kind = property_number;
+ break;
+ }
+ }
+
+ if (pbfd == NULL && ebfd != NULL)
+ {
+ /* Create GNU_PROPERTY_X86_FEATURE_1_IBT if needed. */
+ prop = _bfd_elf_get_property (ebfd,
+ GNU_PROPERTY_X86_FEATURE_1_AND,
+ 4);
+ prop->u.number = features;
+ prop->pr_kind = property_number;
+
+ sec = bfd_make_section_with_flags (ebfd,
+ NOTE_GNU_PROPERTY_SECTION_NAME,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_IN_MEMORY
+ | SEC_READONLY
+ | SEC_HAS_CONTENTS
+ | SEC_DATA));
+ if (sec == NULL)
+ info->callbacks->einfo (_("%F: failed to create GNU property section\n"));
+
+ if (!bfd_set_section_alignment (ebfd, sec, 2))
+ goto error_alignment;
+
+ elf_section_type (sec) = SHT_NOTE;
+ }
+ }
+
+ pbfd = _bfd_elf_link_setup_gnu_properties (info);
if (bfd_link_relocatable (info))
return pbfd;
@@ -6433,6 +6888,26 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info)
if (htab == NULL)
return pbfd;
+ use_ibt_plt = info->ibtplt || info->ibt;
+ if (!use_ibt_plt && pbfd != NULL)
+ {
+ /* Check if GNU_PROPERTY_X86_FEATURE_1_IBT is on. */
+ elf_property_list *p;
+
+ /* The property list is sorted in order of type. */
+ for (p = elf_properties (pbfd); p; p = p->next)
+ {
+ if (GNU_PROPERTY_X86_FEATURE_1_AND == p->property.pr_type)
+ {
+ use_ibt_plt = !!(p->property.u.number
+ & GNU_PROPERTY_X86_FEATURE_1_IBT);
+ break;
+ }
+ else if (GNU_PROPERTY_X86_FEATURE_1_AND < p->property.pr_type)
+ break;
+ }
+ }
+
dynobj = htab->elf.dynobj;
/* Set htab->elf.dynobj here so that there is no need to check and
@@ -6464,8 +6939,16 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info)
switch (get_elf_i386_backend_data (info->output_bfd)->os)
{
case is_normal:
- htab->lazy_plt = &elf_i386_lazy_plt;
- htab->non_lazy_plt = &elf_i386_non_lazy_plt;
+ if (use_ibt_plt)
+ {
+ htab->lazy_plt = &elf_i386_lazy_ibt_plt;
+ htab->non_lazy_plt = &elf_i386_non_lazy_ibt_plt;
+ }
+ else
+ {
+ htab->lazy_plt = &elf_i386_lazy_plt;
+ htab->non_lazy_plt = &elf_i386_non_lazy_plt;
+ }
normal_target = TRUE;
break;
case is_vxworks:
@@ -6488,6 +6971,7 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info)
if (htab->non_lazy_plt != NULL
&& (!htab->plt.has_plt0 || pltsec == NULL))
{
+ lazy_plt = FALSE;
if (bfd_link_pic (info))
htab->plt.plt_entry
= htab->non_lazy_plt->pic_plt_entry;
@@ -6505,6 +6989,7 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info)
}
else
{
+ lazy_plt = TRUE;
if (bfd_link_pic (info))
{
htab->plt.plt0_entry
@@ -6593,6 +7078,29 @@ elf_i386_link_setup_gnu_properties (struct bfd_link_info *info)
goto error_alignment;
htab->plt_got = sec;
+
+ if (lazy_plt)
+ {
+ sec = NULL;
+
+ if (use_ibt_plt)
+ {
+ /* Create the second PLT for Intel IBT support. IBT
+ PLT is supported only for non-NaCl target and is
+ is needed only for lazy binding. */
+ sec = bfd_make_section_anyway_with_flags (dynobj,
+ ".plt.sec",
+ pltflags);
+ if (sec == NULL)
+ info->callbacks->einfo (_("%F: failed to create IBT-enabled PLT section\n"));
+
+ if (!bfd_set_section_alignment (dynobj, sec,
+ plt_alignment))
+ goto error_alignment;
+ }
+
+ htab->plt_second = sec;
+ }
}
if (!info->no_ld_generated_unwind_info)
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c
index fc4992e..c26bdcf 100644
--- a/bfd/elf32-s390.c
+++ b/bfd/elf32-s390.c
@@ -3231,7 +3231,6 @@ elf_s390_relocate_section (bfd *output_bfd,
unsigned int insn, ry;
insn = bfd_get_32 (input_bfd, contents + rel->r_offset);
- ry = 0;
if ((insn & 0xff00f000) == 0x58000000)
/* l %rx,0(%ry,0) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x000f0000);
@@ -3245,7 +3244,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* l %rx,0(%r12,%ry) -> lr %rx,%ry + bcr 0,0 */
ry = (insn & 0x0000f000) << 4;
else
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
insn = 0x18000700 | (insn & 0x00f00000) | ry;
bfd_put_32 (output_bfd, insn, contents + rel->r_offset);
}
@@ -3258,7 +3260,10 @@ elf_s390_relocate_section (bfd *output_bfd,
if ((insn & 0xff000fff) != 0x4d000000 &&
(insn & 0xffff0000) != 0xc0e50000 &&
(insn & 0xff000000) != 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
{
if ((insn & 0xff000000) == 0x0d000000)
@@ -3287,7 +3292,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* If basr is used in the pic case to invoke
_tls_get_offset, something went wrong before. */
if ((insn & 0xff000000) == 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn & 0xff000000) == 0x4d000000)
{
@@ -3317,7 +3325,10 @@ elf_s390_relocate_section (bfd *output_bfd,
if ((insn & 0xff000fff) != 0x4d000000 &&
(insn & 0xffff0000) != 0xc0e50000 &&
(insn & 0xff000000) != 0x0d000000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn & 0xff000000) == 0x0d000000)
{
diff --git a/bfd/elf32-score.c b/bfd/elf32-score.c
index 4468276..5429476 100644
--- a/bfd/elf32-score.c
+++ b/bfd/elf32-score.c
@@ -2034,11 +2034,9 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
{
const Elf_Internal_Rela *relend;
const Elf_Internal_Rela *lo16_rel;
- const struct elf_backend_data *bed;
bfd_vma lo_value = 0;
- bed = get_elf_backend_data (output_bfd);
- relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+ relend = relocs + input_section->reloc_count;
lo16_rel = score_elf_next_relocation (input_bfd, R_SCORE_GOT_LO16, rel, relend);
if ((local_p) && (lo16_rel != NULL))
{
@@ -2778,7 +2776,6 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
const Elf_Internal_Rela *rel_end;
asection *sgot;
asection *sreloc;
- const struct elf_backend_data *bed;
if (bfd_link_relocatable (info))
return TRUE;
@@ -2807,8 +2804,7 @@ s3_bfd_score_elf_check_relocs (bfd *abfd,
}
sreloc = NULL;
- bed = get_elf_backend_data (abfd);
- rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+ rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; ++rel)
{
unsigned long r_symndx;
diff --git a/bfd/elf32-score7.c b/bfd/elf32-score7.c
index abf9b32..66e7945 100644
--- a/bfd/elf32-score7.c
+++ b/bfd/elf32-score7.c
@@ -1902,11 +1902,9 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
{
const Elf_Internal_Rela *relend;
const Elf_Internal_Rela *lo16_rel;
- const struct elf_backend_data *bed;
bfd_vma lo_value = 0;
- bed = get_elf_backend_data (output_bfd);
- relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+ relend = relocs + input_section->reloc_count;
lo16_rel = score_elf_next_relocation (input_bfd, R_SCORE_GOT_LO16, rel, relend);
if ((local_p) && (lo16_rel != NULL))
{
@@ -1935,7 +1933,6 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
{
const Elf_Internal_Rela *relend;
const Elf_Internal_Rela *lo16_rel;
- const struct elf_backend_data *bed;
bfd_vma lo_value = 0;
value = bfd_get_32 (input_bfd, contents + rel->r_offset);
@@ -1943,8 +1940,7 @@ score_elf_final_link_relocate (reloc_howto_type *howto,
if ((addend & 0x4000) == 0x4000)
addend |= 0xffffc000;
- bed = get_elf_backend_data (output_bfd);
- relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+ relend = relocs + input_section->reloc_count;
lo16_rel = score_elf_next_relocation (input_bfd, R_SCORE_GOT_LO16, rel, relend);
if ((local_p) && (lo16_rel != NULL))
{
@@ -2471,7 +2467,6 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd,
if (r_type == R_SCORE_GOT15)
{
const Elf_Internal_Rela *lo16_rel;
- const struct elf_backend_data *bed;
bfd_vma lo_addend = 0, lo_value = 0;
bfd_vma addend, value;
@@ -2480,8 +2475,7 @@ s7_bfd_score_elf_relocate_section (bfd *output_bfd,
if ((addend & 0x4000) == 0x4000)
addend |= 0xffffc000;
- bed = get_elf_backend_data (output_bfd);
- relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+ relend = relocs + input_section->reloc_count;
lo16_rel = score_elf_next_relocation (input_bfd, R_SCORE_GOT_LO16, rel, relend);
if (lo16_rel != NULL)
{
@@ -2587,7 +2581,6 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
const Elf_Internal_Rela *rel_end;
asection *sgot;
asection *sreloc;
- const struct elf_backend_data *bed;
if (bfd_link_relocatable (info))
return TRUE;
@@ -2616,8 +2609,7 @@ s7_bfd_score_elf_check_relocs (bfd *abfd,
}
sreloc = NULL;
- bed = get_elf_backend_data (abfd);
- rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+ rel_end = relocs + sec->reloc_count;
for (rel = relocs; rel < rel_end; ++rel)
{
unsigned long r_symndx;
diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c
index 3b1cc67..3df13b5 100644
--- a/bfd/elf32-sh.c
+++ b/bfd/elf32-sh.c
@@ -6344,7 +6344,7 @@ sh_elf_set_mach_from_flags (bfd *abfd)
{
flagword flags = elf_elfheader (abfd)->e_flags & EF_SH_MACH_MASK;
- if (flags >= sizeof(sh_ef_bfd_table))
+ if (flags >= ARRAY_SIZE (sh_ef_bfd_table))
return FALSE;
if (sh_ef_bfd_table[flags] == 0)
diff --git a/bfd/elf32-v850.c b/bfd/elf32-v850.c
index 0e9ed5f..8db7507 100644
--- a/bfd/elf32-v850.c
+++ b/bfd/elf32-v850.c
@@ -2450,7 +2450,9 @@ v850_elf_copy_notes (bfd *ibfd, bfd *obfd)
BFD_ASSERT (bfd_malloc_and_get_section (ibfd, inotes, & icont));
if ((ocont = elf_section_data (onotes)->this_hdr.contents) == NULL)
- BFD_ASSERT (bfd_malloc_and_get_section (obfd, onotes, & ocont));
+ /* If the output is being stripped then it is possible for
+ the notes section to disappear. In this case do nothing. */
+ return;
/* Copy/overwrite notes from the input to the output. */
memcpy (ocont, icont, bfd_section_size (obfd, onotes));
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index d11d43b..64e40d3 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -519,28 +519,42 @@ elf_xtensa_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
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] =
+static const bfd_byte elf_xtensa_be_plt_entry[][PLT_ENTRY_SIZE] =
{
-#if XSHAL_ABI == XTHAL_ABI_WINDOWED
- 0x6c, 0x10, 0x04, /* entry sp, 32 */
-#endif
- 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 */
+ {
+ 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 */
+ },
+ {
+ 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] =
+static const bfd_byte elf_xtensa_le_plt_entry[][PLT_ENTRY_SIZE] =
{
-#if XSHAL_ABI == XTHAL_ABI_WINDOWED
- 0x36, 0x41, 0x00, /* entry sp, 32 */
-#endif
- 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 */
+ {
+ 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 */
+ },
+ {
+ 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 */
+ }
};
/* The size of the thread control block. */
@@ -2336,8 +2350,8 @@ elf_xtensa_create_plt_entry (struct bfd_link_info *info,
/* 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),
+ ? elf_xtensa_be_plt_entry[XSHAL_ABI != XTHAL_ABI_WINDOWED]
+ : elf_xtensa_le_plt_entry[XSHAL_ABI != XTHAL_ABI_WINDOWED]),
PLT_ENTRY_SIZE);
abi_offset = XSHAL_ABI == XTHAL_ABI_WINDOWED ? 3 : 0;
bfd_put_16 (output_bfd, l32r_offset (got_base + 0,
@@ -11317,11 +11331,7 @@ static const struct bfd_elf_special_section elf_xtensa_special_sections[] =
#define ELF_MACHINE_CODE EM_XTENSA
#define ELF_MACHINE_ALT1 EM_XTENSA_OLD
-#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 */
+#define ELF_MAXPAGESIZE 0x1000
#endif /* ELF_ARCH */
#define elf_backend_can_gc_sections 1
diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c
index e95db2c..84f2a3f 100644
--- a/bfd/elf64-mips.c
+++ b/bfd/elf64-mips.c
@@ -86,8 +86,6 @@ static void mips_elf64_info_to_howto_rel
(bfd *, arelent *, Elf_Internal_Rela *);
static void mips_elf64_info_to_howto_rela
(bfd *, arelent *, Elf_Internal_Rela *);
-static long mips_elf64_get_reloc_upper_bound
- (bfd *, asection *);
static long mips_elf64_get_dynamic_reloc_upper_bound
(bfd *);
static bfd_boolean mips_elf64_slurp_one_reloc_table
@@ -3648,12 +3646,6 @@ mips_elf64_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
to three relocs, we must tell the user to allocate more space. */
static long
-mips_elf64_get_reloc_upper_bound (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
-{
- return (sec->reloc_count * 3 + 1) * sizeof (arelent *);
-}
-
-static long
mips_elf64_get_dynamic_reloc_upper_bound (bfd *abfd)
{
return _bfd_elf_get_dynamic_reloc_upper_bound (abfd) * 3;
@@ -3819,8 +3811,6 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
}
}
- asect->reloc_count += relent - relents;
-
if (allocated != NULL)
free (allocated);
@@ -3835,8 +3825,7 @@ mips_elf64_slurp_one_reloc_table (bfd *abfd, asection *asect,
/* Read the relocations. On Irix 6, there can be two reloc sections
associated with a single data section. This is copied from
elfcode.h as well, with changes as small as accounting for 3
- internal relocs per external reloc and resetting reloc_count to
- zero before processing the relocs of a section. */
+ internal relocs per external reloc. */
static bfd_boolean
mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
@@ -3864,7 +3853,7 @@ mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
rel_hdr2 = d->rela.hdr;
reloc_count2 = (rel_hdr2 ? NUM_SHDR_ENTRIES (rel_hdr2) : 0);
- BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2);
+ BFD_ASSERT (asect->reloc_count == 3 * (reloc_count + reloc_count2));
BFD_ASSERT ((rel_hdr && asect->rel_filepos == rel_hdr->sh_offset)
|| (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
@@ -3890,9 +3879,6 @@ mips_elf64_slurp_reloc_table (bfd *abfd, asection *asect,
if (relents == NULL)
return FALSE;
- /* The slurp_one_reloc_table routine increments reloc_count. */
- asect->reloc_count = 0;
-
if (rel_hdr != NULL
&& ! mips_elf64_slurp_one_reloc_table (abfd, asect,
rel_hdr, reloc_count,
@@ -4437,7 +4423,6 @@ const struct elf_size_info mips_elf64_size_info =
#define bfd_elf64_bfd_print_private_bfd_data \
_bfd_mips_elf_print_private_bfd_data
-#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
#define bfd_elf64_get_dynamic_reloc_upper_bound mips_elf64_get_dynamic_reloc_upper_bound
#define bfd_elf64_mkobject _bfd_mips_elf_mkobject
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 948de12..319d58f 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -4118,6 +4118,9 @@ struct ppc_link_hash_table
unsigned int local_ifunc_resolver:1;
unsigned int maybe_local_ifunc_resolver:1;
+ /* Whether plt calls for ELFv2 localentry:0 funcs have been optimized. */
+ unsigned int has_plt_localentry0:1;
+
/* Incremented every time we size stubs. */
unsigned int stub_iteration;
@@ -5005,7 +5008,7 @@ ppc64_elf_merge_symbol_attribute (struct elf_link_hash_entry *h,
bfd_boolean definition,
bfd_boolean dynamic)
{
- if (definition && !dynamic)
+ if (definition && (!dynamic || !h->def_regular))
h->other = ((isym->st_other & ~ELF_ST_VISIBILITY (-1))
| ELF_ST_VISIBILITY (h->other));
}
@@ -6318,6 +6321,21 @@ ppc64_elf_maybe_function_sym (const asymbol *sym, asection *sec,
return size;
}
+/* Return true if symbol is a strong function defined in an ELFv2
+ object with st_other localentry bits of zero, ie. its local entry
+ point coincides with its global entry point. */
+
+static bfd_boolean
+is_elfv2_localentry0 (struct elf_link_hash_entry *h)
+{
+ return (h != NULL
+ && h->type == STT_FUNC
+ && h->root.type == bfd_link_hash_defined
+ && (STO_PPC64_LOCAL_MASK & h->other) == 0
+ && is_ppc64_elf (h->root.u.def.section->owner)
+ && abiversion (h->root.u.def.section->owner) >= 2);
+}
+
/* Return true if symbol is defined in a regular object file. */
static bfd_boolean
@@ -8328,6 +8346,11 @@ ppc64_elf_tls_setup (struct bfd_link_info *info)
else if (!htab->do_multi_toc)
htab->params->no_multi_toc = 1;
+ if (htab->params->plt_localentry0 < 0)
+ htab->params->plt_localentry0
+ = elf_link_hash_lookup (&htab->elf, "GLIBC_2.26",
+ FALSE, FALSE, FALSE) != NULL;
+
htab->tls_get_addr = ((struct ppc_link_hash_entry *)
elf_link_hash_lookup (&htab->elf, ".__tls_get_addr",
FALSE, FALSE, TRUE));
@@ -10548,7 +10571,12 @@ plt_stub_size (struct ppc_link_hash_table *htab,
&& (stub_entry->h == htab->tls_get_addr_fd
|| stub_entry->h == htab->tls_get_addr)
&& htab->params->tls_get_addr_opt)
- size += 13 * 4;
+ {
+ size += 7 * 4;
+ if (ALWAYS_EMIT_R2SAVE
+ || stub_entry->stub_type == ppc_stub_plt_call_r2save)
+ size += 6 * 4;
+ }
return size;
}
@@ -10775,11 +10803,17 @@ build_tls_get_addr_stub (struct ppc_link_hash_table *htab,
bfd_put_32 (obfd, ADD_R3_R12_R13, p), p += 4;
bfd_put_32 (obfd, BEQLR, p), p += 4;
bfd_put_32 (obfd, MR_R3_R0, p), p += 4;
+ if (r != NULL)
+ r[0].r_offset += 7 * 4;
+ if (!ALWAYS_EMIT_R2SAVE
+ && stub_entry->stub_type != ppc_stub_plt_call_r2save)
+ return build_plt_stub (htab, stub_entry, p, offset, r);
+
bfd_put_32 (obfd, MFLR_R11, p), p += 4;
bfd_put_32 (obfd, STD_R11_0R1 + STK_LINKER (htab), p), p += 4;
if (r != NULL)
- r[0].r_offset += 9 * 4;
+ r[0].r_offset += 2 * 4;
p = build_plt_stub (htab, stub_entry, p, offset, r);
bfd_put_32 (obfd, BCTRL, p - 4);
@@ -12598,17 +12632,24 @@ ppc64_elf_size_stubs (struct bfd_link_info *info)
continue;
}
- if (stub_type == ppc_stub_plt_call
- && irela + 1 < irelaend
- && irela[1].r_offset == irela->r_offset + 4
- && ELF64_R_TYPE (irela[1].r_info) == R_PPC64_TOCSAVE)
+ if (stub_type == ppc_stub_plt_call)
{
- if (!tocsave_find (htab, INSERT,
- &local_syms, irela + 1, input_bfd))
- goto error_ret_free_internal;
+ if (!htab->opd_abi
+ && htab->params->plt_localentry0 != 0
+ && is_elfv2_localentry0 (&hash->elf))
+ htab->has_plt_localentry0 = 1;
+ else if (irela + 1 < irelaend
+ && irela[1].r_offset == irela->r_offset + 4
+ && (ELF64_R_TYPE (irela[1].r_info)
+ == R_PPC64_TOCSAVE))
+ {
+ if (!tocsave_find (htab, INSERT,
+ &local_syms, irela + 1, input_bfd))
+ goto error_ret_free_internal;
+ }
+ else
+ stub_type = ppc_stub_plt_call_r2save;
}
- else if (stub_type == ppc_stub_plt_call)
- stub_type = ppc_stub_plt_call_r2save;
/* Support for grouping stub sections. */
id_sec = htab->sec_info[section->id].u.group->link_sec;
@@ -13160,6 +13201,8 @@ ppc64_elf_build_stubs (struct bfd_link_info *info,
p += 4;
bfd_put_32 (htab->glink->owner, MFLR_R11, p);
p += 4;
+ bfd_put_32 (htab->glink->owner, STD_R2_0R1 + 24, p);
+ p += 4;
bfd_put_32 (htab->glink->owner, LD_R2_0R11 | (-16 & 0xfffc), p);
p += 4;
bfd_put_32 (htab->glink->owner, MTLR_R0, p);
@@ -14170,10 +14213,19 @@ ppc64_elf_relocate_section (bfd *output_bfd,
{
bfd_boolean can_plt_call = FALSE;
- /* All of these stubs will modify r2, so there must be a
+ if (stub_entry->stub_type == ppc_stub_plt_call
+ && !htab->opd_abi
+ && htab->params->plt_localentry0 != 0
+ && is_elfv2_localentry0 (&h->elf))
+ {
+ /* The function doesn't use or change r2. */
+ can_plt_call = TRUE;
+ }
+
+ /* All of these stubs may modify r2, so there must be a
branch and link followed by a nop. The nop is
replaced by an insn to restore r2. */
- if (rel->r_offset + 8 <= input_section->size)
+ else if (rel->r_offset + 8 <= input_section->size)
{
unsigned long br;
@@ -15636,6 +15688,8 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,
case DT_PPC64_OPT:
if (htab->do_multi_toc && htab->multi_toc_needed)
dyn.d_un.d_val |= PPC64_OPT_MULTI_TOC;
+ if (htab->has_plt_localentry0)
+ dyn.d_un.d_val |= PPC64_OPT_LOCALENTRY;
break;
case DT_PPC64_OPDSZ:
diff --git a/bfd/elf64-ppc.h b/bfd/elf64-ppc.h
index 4609679..ca20fe4 100644
--- a/bfd/elf64-ppc.h
+++ b/bfd/elf64-ppc.h
@@ -48,6 +48,9 @@ struct ppc64_elf_params
/* Set if individual PLT call stubs should be aligned. */
int plt_stub_align;
+ /* Set if PLT call stubs for localentry:0 functions should omit r2 save. */
+ int plt_localentry0;
+
/* Whether to canonicalize .opd so that there are no overlapping
.opd entries. */
int non_overlapping_opd;
diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c
index b1f5b89..f85f8cd 100644
--- a/bfd/elf64-s390.c
+++ b/bfd/elf64-s390.c
@@ -25,6 +25,7 @@
#include "libbfd.h"
#include "elf-bfd.h"
#include "elf/s390.h"
+#include "elf-s390.h"
#include <stdarg.h>
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
@@ -660,6 +661,9 @@ struct elf_s390_link_hash_table
/* Small local sym cache. */
struct sym_cache sym_cache;
+
+ /* Options passed from the linker. */
+ struct s390_elf_params *params;
};
/* Get the s390 ELF linker hash table from a link_info structure. */
@@ -3197,8 +3201,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if (insn1 != 0x0004)
- invalid_tls_insn (input_bfd, input_section, rel);
- ry = 0;
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if ((insn0 & 0xff00f000) == 0xe3000000)
/* lg %rx,0(%ry,0) -> sllg %rx,%ry,0 */
ry = (insn0 & 0x000f0000);
@@ -3212,7 +3218,10 @@ elf_s390_relocate_section (bfd *output_bfd,
/* lg %rx,0(%r12,%ry) -> sllg %rx,%ry,0 */
ry = (insn0 & 0x0000f000) << 4;
else
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
insn0 = 0xeb000000 | (insn0 & 0x00f00000) | ry;
insn1 = 0x000d;
bfd_put_32 (output_bfd, insn0, contents + rel->r_offset);
@@ -3226,7 +3235,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if ((insn0 & 0xffff0000) != 0xc0e50000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
if (!bfd_link_pic (info) && (h == NULL || h->dynindx == -1))
{
/* GD->LE transition.
@@ -3253,7 +3265,10 @@ elf_s390_relocate_section (bfd *output_bfd,
insn0 = bfd_get_32 (input_bfd, contents + rel->r_offset);
insn1 = bfd_get_16 (input_bfd, contents + rel->r_offset + 4);
if ((insn0 & 0xffff0000) != 0xc0e50000)
- invalid_tls_insn (input_bfd, input_section, rel);
+ {
+ invalid_tls_insn (input_bfd, input_section, rel);
+ return FALSE;
+ }
/* LD->LE transition.
brasl %r14,__tls_get_addr@plt -> brcl 0,. */
insn0 = 0xc0040000;
@@ -3955,6 +3970,81 @@ elf64_s390_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
return elf_s390_merge_obj_attributes (ibfd, info);
}
+/* We may add a PT_S390_PGSTE program header. */
+
+static int
+elf_s390_additional_program_headers (bfd *abfd ATTRIBUTE_UNUSED,
+ struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab;
+
+ if (info)
+ {
+ htab = elf_s390_hash_table (info);
+ if (htab)
+ return htab->params->pgste;
+ }
+ return 0;
+}
+
+
+/* Add the PT_S390_PGSTE program header. */
+
+static bfd_boolean
+elf_s390_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
+{
+ struct elf_s390_link_hash_table *htab;
+ struct elf_segment_map *m, *pm = NULL;
+
+ if (!abfd || !info)
+ return TRUE;
+
+ htab = elf_s390_hash_table (info);
+ if (!htab || !htab->params->pgste)
+ return TRUE;
+
+ /* If there is already a PT_S390_PGSTE header, avoid adding
+ another. */
+ m = elf_seg_map (abfd);
+ while (m && m->p_type != PT_S390_PGSTE)
+ {
+ pm = m;
+ m = m->next;
+ }
+
+ if (m)
+ return TRUE;
+
+ m = (struct elf_segment_map *)
+ bfd_zalloc (abfd, sizeof (struct elf_segment_map));
+ if (m == NULL)
+ return FALSE;
+ m->p_type = PT_S390_PGSTE;
+ m->count = 0;
+ m->next = NULL;
+ if (pm)
+ pm->next = m;
+
+ return TRUE;
+}
+
+bfd_boolean
+bfd_elf_s390_set_options (struct bfd_link_info *info,
+ struct s390_elf_params *params)
+{
+ struct elf_s390_link_hash_table *htab;
+
+ if (info)
+ {
+ htab = elf_s390_hash_table (info);
+ if (htab)
+ htab->params = params;
+ }
+
+ return TRUE;
+}
+
+
/* Why was the hash table entry size definition changed from
ARCH_SIZE/8 to 4? This breaks the 64 bit dynamic linker and
this is the only reason for the s390_elf64_size_info structure. */
@@ -4035,6 +4125,8 @@ const struct elf_size_info s390_elf64_size_info =
#define elf_backend_plt_sym_val elf_s390_plt_sym_val
#define elf_backend_add_symbol_hook elf_s390_add_symbol_hook
#define elf_backend_sort_relocs_p elf_s390_elf_sort_relocs_p
+#define elf_backend_additional_program_headers elf_s390_additional_program_headers
+#define elf_backend_modify_segment_map elf_s390_modify_segment_map
#define bfd_elf64_mkobject elf_s390_mkobject
#define elf_backend_object_p elf_s390_object_p
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 7beb78e..8cef9f5 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -596,6 +596,32 @@ static const bfd_byte elf_x86_64_lazy_bnd_plt_entry[LAZY_PLT_ENTRY_SIZE] =
0x0f, 0x1f, 0x44, 0, 0 /* nopl 0(%rax,%rax,1) */
};
+/* The first entry in the IBT-enabled lazy procedure linkage table is the
+ the same as the lazy PLT with BND prefix so that bound registers are
+ preserved when control is passed to dynamic linker. Subsequent
+ entries for a IBT-enabled lazy procedure linkage table look like
+ this. */
+
+static const bfd_byte elf_x86_64_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xf3, 0x0f, 0x1e, 0xfa, /* endbr64 */
+ 0x68, 0, 0, 0, 0, /* pushq immediate */
+ 0xf2, 0xe9, 0, 0, 0, 0, /* bnd jmpq relative */
+ 0x90 /* nop */
+};
+
+/* The first entry in the x32 IBT-enabled lazy procedure linkage table
+ is the the same as the normal lazy PLT. Subsequent entries for an
+ x32 IBT-enabled lazy procedure linkage table look like this. */
+
+static const bfd_byte elf_x32_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xf3, 0x0f, 0x1e, 0xfa, /* endbr64 */
+ 0x68, 0, 0, 0, 0, /* pushq immediate */
+ 0xe9, 0, 0, 0, 0, /* jmpq relative */
+ 0x66, 0x90 /* xchg %ax,%ax */
+};
+
/* Entries in the non-lazey procedure linkage table look like this. */
static const bfd_byte elf_x86_64_non_lazy_plt_entry[NON_LAZY_PLT_ENTRY_SIZE] =
@@ -615,6 +641,30 @@ static const bfd_byte elf_x86_64_non_lazy_bnd_plt_entry[NON_LAZY_PLT_ENTRY_SIZE]
0x90 /* nop */
};
+/* Entries for branches with IBT-enabled in the non-lazey procedure
+ linkage table look like this. They have the same size as the lazy
+ PLT entry. */
+
+static const bfd_byte elf_x86_64_non_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xf3, 0x0f, 0x1e, 0xfa, /* endbr64 */
+ 0xf2, 0xff, 0x25, /* bnd jmpq *name@GOTPC(%rip) */
+ 0, 0, 0, 0, /* replaced with offset to this symbol in .got. */
+ 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nopl 0x0(%rax,%rax,1) */
+};
+
+/* Entries for branches with IBT-enabled in the x32 non-lazey procedure
+ linkage table look like this. They have the same size as the lazy
+ PLT entry. */
+
+static const bfd_byte elf_x32_non_lazy_ibt_plt_entry[LAZY_PLT_ENTRY_SIZE] =
+{
+ 0xf3, 0x0f, 0x1e, 0xfa, /* endbr64 */
+ 0xff, 0x25, /* jmpq *name@GOTPC(%rip) */
+ 0, 0, 0, 0, /* replaced with offset to this symbol in .got. */
+ 0x66, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nopw 0x0(%rax,%rax,1) */
+};
+
/* .eh_frame covering the lazy .plt section. */
static const bfd_byte elf_x86_64_eh_frame_lazy_plt[] =
@@ -689,6 +739,76 @@ static const bfd_byte elf_x86_64_eh_frame_lazy_bnd_plt[] =
DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop
};
+/* .eh_frame covering the lazy .plt section with IBT-enabled. */
+
+static const bfd_byte elf_x86_64_eh_frame_lazy_ibt_plt[] =
+{
+ PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */
+ 0, 0, 0, 0, /* CIE ID */
+ 1, /* CIE version */
+ 'z', 'R', 0, /* Augmentation string */
+ 1, /* Code alignment factor */
+ 0x78, /* Data alignment factor */
+ 16, /* Return address column */
+ 1, /* Augmentation size */
+ DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */
+ DW_CFA_def_cfa, 7, 8, /* DW_CFA_def_cfa: r7 (rsp) ofs 8 */
+ DW_CFA_offset + 16, 1, /* DW_CFA_offset: r16 (rip) at cfa-8 */
+ DW_CFA_nop, DW_CFA_nop,
+
+ PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */
+ PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */
+ 0, 0, 0, 0, /* R_X86_64_PC32 .plt goes here */
+ 0, 0, 0, 0, /* .plt size goes here */
+ 0, /* Augmentation size */
+ DW_CFA_def_cfa_offset, 16, /* DW_CFA_def_cfa_offset: 16 */
+ DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */
+ DW_CFA_def_cfa_offset, 24, /* DW_CFA_def_cfa_offset: 24 */
+ DW_CFA_advance_loc + 10, /* DW_CFA_advance_loc: 10 to __PLT__+16 */
+ DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */
+ 11, /* Block length */
+ DW_OP_breg7, 8, /* DW_OP_breg7 (rsp): 8 */
+ DW_OP_breg16, 0, /* DW_OP_breg16 (rip): 0 */
+ DW_OP_lit15, DW_OP_and, DW_OP_lit10, DW_OP_ge,
+ DW_OP_lit3, DW_OP_shl, DW_OP_plus,
+ DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop
+};
+
+/* .eh_frame covering the x32 lazy .plt section with IBT-enabled. */
+
+static const bfd_byte elf_x32_eh_frame_lazy_ibt_plt[] =
+{
+ PLT_CIE_LENGTH, 0, 0, 0, /* CIE length */
+ 0, 0, 0, 0, /* CIE ID */
+ 1, /* CIE version */
+ 'z', 'R', 0, /* Augmentation string */
+ 1, /* Code alignment factor */
+ 0x78, /* Data alignment factor */
+ 16, /* Return address column */
+ 1, /* Augmentation size */
+ DW_EH_PE_pcrel | DW_EH_PE_sdata4, /* FDE encoding */
+ DW_CFA_def_cfa, 7, 8, /* DW_CFA_def_cfa: r7 (rsp) ofs 8 */
+ DW_CFA_offset + 16, 1, /* DW_CFA_offset: r16 (rip) at cfa-8 */
+ DW_CFA_nop, DW_CFA_nop,
+
+ PLT_FDE_LENGTH, 0, 0, 0, /* FDE length */
+ PLT_CIE_LENGTH + 8, 0, 0, 0, /* CIE pointer */
+ 0, 0, 0, 0, /* R_X86_64_PC32 .plt goes here */
+ 0, 0, 0, 0, /* .plt size goes here */
+ 0, /* Augmentation size */
+ DW_CFA_def_cfa_offset, 16, /* DW_CFA_def_cfa_offset: 16 */
+ DW_CFA_advance_loc + 6, /* DW_CFA_advance_loc: 6 to __PLT__+6 */
+ DW_CFA_def_cfa_offset, 24, /* DW_CFA_def_cfa_offset: 24 */
+ DW_CFA_advance_loc + 10, /* DW_CFA_advance_loc: 10 to __PLT__+16 */
+ DW_CFA_def_cfa_expression, /* DW_CFA_def_cfa_expression */
+ 11, /* Block length */
+ DW_OP_breg7, 8, /* DW_OP_breg7 (rsp): 8 */
+ DW_OP_breg16, 0, /* DW_OP_breg16 (rip): 0 */
+ DW_OP_lit15, DW_OP_and, DW_OP_lit9, DW_OP_ge,
+ DW_OP_lit3, DW_OP_shl, DW_OP_plus,
+ DW_CFA_nop, DW_CFA_nop, DW_CFA_nop, DW_CFA_nop
+};
+
/* .eh_frame covering the non-lazy .plt section. */
static const bfd_byte elf_x86_64_eh_frame_non_lazy_plt[] =
@@ -862,6 +982,62 @@ static const struct elf_x86_64_non_lazy_plt_layout elf_x86_64_non_lazy_bnd_plt =
sizeof (elf_x86_64_eh_frame_non_lazy_plt) /* eh_frame_plt_size */
};
+static const struct elf_x86_64_lazy_plt_layout elf_x86_64_lazy_ibt_plt =
+ {
+ elf_x86_64_lazy_bnd_plt0_entry, /* plt0_entry */
+ elf_x86_64_lazy_ibt_plt_entry, /* plt_entry */
+ LAZY_PLT_ENTRY_SIZE, /* plt_entry_size */
+ 2, /* plt0_got1_offset */
+ 1+8, /* plt0_got2_offset */
+ 1+12, /* plt0_got2_insn_end */
+ 4+1+2, /* plt_got_offset */
+ 4+1, /* plt_reloc_offset */
+ 4+1+6, /* plt_plt_offset */
+ 4+1+6, /* plt_got_insn_size */
+ 4+1+5+5, /* plt_plt_insn_end */
+ 0, /* plt_lazy_offset */
+ elf_x86_64_eh_frame_lazy_ibt_plt, /* eh_frame_plt */
+ sizeof (elf_x86_64_eh_frame_lazy_ibt_plt) /* eh_frame_plt_size */
+ };
+
+static const struct elf_x86_64_lazy_plt_layout elf_x32_lazy_ibt_plt =
+ {
+ elf_x86_64_lazy_plt0_entry, /* plt0_entry */
+ elf_x32_lazy_ibt_plt_entry, /* plt_entry */
+ LAZY_PLT_ENTRY_SIZE, /* plt_entry_size */
+ 2, /* plt0_got1_offset */
+ 8, /* plt0_got2_offset */
+ 12, /* plt0_got2_insn_end */
+ 4+2, /* plt_got_offset */
+ 4+1, /* plt_reloc_offset */
+ 4+6, /* plt_plt_offset */
+ 4+6, /* plt_got_insn_size */
+ 4+5+5, /* plt_plt_insn_end */
+ 0, /* plt_lazy_offset */
+ elf_x32_eh_frame_lazy_ibt_plt, /* eh_frame_plt */
+ sizeof (elf_x32_eh_frame_lazy_ibt_plt) /* eh_frame_plt_size */
+ };
+
+static const struct elf_x86_64_non_lazy_plt_layout elf_x86_64_non_lazy_ibt_plt =
+ {
+ elf_x86_64_non_lazy_ibt_plt_entry, /* plt_entry */
+ LAZY_PLT_ENTRY_SIZE, /* plt_entry_size */
+ 4+1+2, /* plt_got_offset */
+ 4+1+6, /* plt_got_insn_size */
+ elf_x86_64_eh_frame_non_lazy_plt, /* eh_frame_plt */
+ sizeof (elf_x86_64_eh_frame_non_lazy_plt) /* eh_frame_plt_size */
+ };
+
+static const struct elf_x86_64_non_lazy_plt_layout elf_x32_non_lazy_ibt_plt =
+ {
+ elf_x32_non_lazy_ibt_plt_entry, /* plt_entry */
+ LAZY_PLT_ENTRY_SIZE, /* plt_entry_size */
+ 4+2, /* plt_got_offset */
+ 4+6, /* plt_got_insn_size */
+ elf_x86_64_eh_frame_non_lazy_plt, /* eh_frame_plt */
+ sizeof (elf_x86_64_eh_frame_non_lazy_plt) /* eh_frame_plt_size */
+ };
+
static const struct elf_x86_64_backend_data elf_x86_64_arch_bed =
{
is_normal /* os */
@@ -874,14 +1050,16 @@ static const struct elf_x86_64_backend_data elf_x86_64_arch_bed =
it isn't dynamic and
1. Has non-GOT/non-PLT relocations in text section. Or
2. Has no GOT/PLT relocation.
+ Local undefined weak symbol is always resolved to 0.
*/
#define UNDEFINED_WEAK_RESOLVED_TO_ZERO(INFO, GOT_RELOC, EH) \
((EH)->elf.root.type == bfd_link_hash_undefweak \
- && bfd_link_executable (INFO) \
- && (elf_x86_64_hash_table (INFO)->interp == NULL \
- || !(GOT_RELOC) \
- || (EH)->has_non_got_reloc \
- || !(INFO)->dynamic_undefined_weak))
+ && ((EH)->elf.forced_local \
+ || (bfd_link_executable (INFO) \
+ && (elf_x86_64_hash_table (INFO)->interp == NULL \
+ || !(GOT_RELOC) \
+ || (EH)->has_non_got_reloc \
+ || !(INFO)->dynamic_undefined_weak))))
/* x86-64 ELF linker hash entry. */
@@ -1920,21 +2098,25 @@ elf_x86_64_convert_load_reloc (bfd *abfd, asection *sec,
}
/* Avoid optimizing GOTPCREL relocations againt _DYNAMIC since
ld.so may use its link-time address. */
- else if ((h->def_regular
- || h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h != htab->elf.hdynamic
- && SYMBOL_REFERENCES_LOCAL (link_info, h))
+ else if (h->start_stop
+ || ((h->def_regular
+ || h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h != htab->elf.hdynamic
+ && SYMBOL_REFERENCES_LOCAL (link_info, h)))
{
/* bfd_link_hash_new or bfd_link_hash_undefined is
set by an assignment in a linker script in
- bfd_elf_record_link_assignment. */
- if (h->def_regular
- && (h->root.type == bfd_link_hash_new
- || h->root.type == bfd_link_hash_undefined
- || ((h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- && h->root.u.def.section == bfd_und_section_ptr)))
+ bfd_elf_record_link_assignment. start_stop is set
+ on __start_SECNAME/__stop_SECNAME which mark section
+ SECNAME. */
+ if (h->start_stop
+ || (h->def_regular
+ && (h->root.type == bfd_link_hash_new
+ || h->root.type == bfd_link_hash_undefined
+ || ((h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ && h->root.u.def.section == bfd_und_section_ptr))))
{
/* Skip since R_X86_64_32/R_X86_64_32S may overflow. */
if (require_reloc_pc32)
@@ -2281,6 +2463,8 @@ elf_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info,
goto error_return;
/* Fake a STT_GNU_IFUNC symbol. */
+ h->root.root.string = bfd_elf_sym_name (abfd, symtab_hdr,
+ isym, NULL);
h->type = STT_GNU_IFUNC;
h->def_regular = 1;
h->ref_regular = 1;
@@ -4422,6 +4606,10 @@ do_ifunc_pointer:
|| h->forced_local
|| bfd_link_executable (info))
{
+ info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
+ h->root.root.string,
+ h->root.u.def.section->owner);
+
/* This symbol is resolved locally. */
outrel.r_info = htab->r_info (0, R_X86_64_IRELATIVE);
outrel.r_addend = (h->root.u.def.value
@@ -5791,6 +5979,10 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
&& h->def_regular
&& h->type == STT_GNU_IFUNC))
{
+ info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
+ h->root.root.string,
+ h->root.u.def.section->owner);
+
/* If an STT_GNU_IFUNC symbol is locally defined, generate
R_X86_64_IRELATIVE instead of R_X86_64_JUMP_SLOT. */
rela.r_info = htab->r_info (0, R_X86_64_IRELATIVE);
@@ -5941,6 +6133,11 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
}
if (SYMBOL_REFERENCES_LOCAL (info, h))
{
+ info->callbacks->minfo (_("Local IFUNC function `%s' in %B\n"),
+ output_bfd,
+ h->root.root.string,
+ h->root.u.def.section->owner);
+
rela.r_info = htab->r_info (0,
R_X86_64_IRELATIVE);
rela.r_addend = (h->root.u.def.value
@@ -6489,6 +6686,8 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd,
const struct elf_x86_64_non_lazy_plt_layout *non_lazy_plt;
const struct elf_x86_64_lazy_plt_layout *lazy_bnd_plt;
const struct elf_x86_64_non_lazy_plt_layout *non_lazy_bnd_plt;
+ const struct elf_x86_64_lazy_plt_layout *lazy_ibt_plt;
+ const struct elf_x86_64_non_lazy_plt_layout *non_lazy_ibt_plt;
asection *plt;
char *names;
enum elf_x86_64_plt_type plt_type;
@@ -6529,6 +6728,16 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd,
non_lazy_plt = &elf_x86_64_non_lazy_plt;
lazy_bnd_plt = &elf_x86_64_lazy_bnd_plt;
non_lazy_bnd_plt = &elf_x86_64_non_lazy_bnd_plt;
+ if (ABI_64_P (abfd))
+ {
+ lazy_ibt_plt = &elf_x86_64_lazy_ibt_plt;
+ non_lazy_ibt_plt = &elf_x86_64_non_lazy_ibt_plt;
+ }
+ else
+ {
+ lazy_ibt_plt = &elf_x32_lazy_ibt_plt;
+ non_lazy_ibt_plt = &elf_x32_non_lazy_ibt_plt;
+ }
}
else
{
@@ -6536,6 +6745,8 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd,
non_lazy_plt = NULL;
lazy_bnd_plt = NULL;
non_lazy_bnd_plt = NULL;
+ lazy_ibt_plt = NULL;
+ non_lazy_ibt_plt = NULL;
}
count = 0;
@@ -6574,7 +6785,14 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd,
lazy_bnd_plt->plt0_entry + 6, 3) == 0))
{
plt_type = plt_lazy | plt_second;
- lazy_plt = lazy_bnd_plt;
+ /* The fist entry in the lazy IBT PLT is the same as the
+ lazy BND PLT. */
+ if ((memcmp (plt_contents + lazy_ibt_plt->plt_entry_size,
+ lazy_ibt_plt->plt_entry,
+ lazy_ibt_plt->plt_got_offset) == 0))
+ lazy_plt = lazy_ibt_plt;
+ else
+ lazy_plt = lazy_bnd_plt;
}
}
@@ -6587,16 +6805,25 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd,
plt_type = plt_non_lazy;
}
- if (non_lazy_bnd_plt != NULL
- && (plt_type == plt_unknown || plt_type == plt_second))
+ if (plt_type == plt_unknown || plt_type == plt_second)
{
- /* Match BND PLT. */
- if (memcmp (plt_contents, non_lazy_bnd_plt->plt_entry,
- non_lazy_bnd_plt->plt_got_offset) == 0)
+ if (non_lazy_bnd_plt != NULL
+ && (memcmp (plt_contents, non_lazy_bnd_plt->plt_entry,
+ non_lazy_bnd_plt->plt_got_offset) == 0))
{
+ /* Match BND PLT. */
plt_type = plt_second;
non_lazy_plt = non_lazy_bnd_plt;
}
+ else if (non_lazy_ibt_plt != NULL
+ && (memcmp (plt_contents,
+ non_lazy_ibt_plt->plt_entry,
+ non_lazy_ibt_plt->plt_got_offset) == 0))
+ {
+ /* Match IBT PLT. */
+ plt_type = plt_second;
+ non_lazy_plt = non_lazy_ibt_plt;
+ }
}
if (plt_type == plt_unknown)
@@ -6993,12 +7220,15 @@ elf_x86_64_parse_gnu_properties (bfd *abfd, unsigned int type,
{
case GNU_PROPERTY_X86_ISA_1_USED:
case GNU_PROPERTY_X86_ISA_1_NEEDED:
+ case GNU_PROPERTY_X86_FEATURE_1_AND:
if (datasz != 4)
{
_bfd_error_handler
((type == GNU_PROPERTY_X86_ISA_1_USED
? _("error: %B: <corrupt x86 ISA used size: 0x%x>")
- : _("error: %B: <corrupt x86 ISA needed size: 0x%x>")),
+ : (type == GNU_PROPERTY_X86_ISA_1_NEEDED
+ ? _("error: %B: <corrupt x86 ISA needed size: 0x%x>")
+ : _("error: %B: <corrupt x86 feature size: 0x%x>"))),
abfd, datasz);
return property_corrupt;
}
@@ -7020,11 +7250,12 @@ elf_x86_64_parse_gnu_properties (bfd *abfd, unsigned int type,
should be merged with ABFD. */
static bfd_boolean
-elf_x86_64_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
+elf_x86_64_merge_gnu_properties (struct bfd_link_info *info,
+ bfd *abfd ATTRIBUTE_UNUSED,
elf_property *aprop,
elf_property *bprop)
{
- unsigned int number;
+ unsigned int number, features;
bfd_boolean updated = FALSE;
unsigned int pr_type = aprop != NULL ? aprop->pr_type : bprop->pr_type;
@@ -7046,6 +7277,59 @@ elf_x86_64_merge_gnu_properties (bfd *abfd ATTRIBUTE_UNUSED,
}
break;
+ case GNU_PROPERTY_X86_FEATURE_1_AND:
+ /* Only one of APROP and BPROP can be NULL:
+ 1. APROP & BPROP when both APROP and BPROP aren't NULL.
+ 2. If APROP is NULL, remove x86 feature.
+ 3. Otherwise, do nothing.
+ */
+ if (aprop != NULL && bprop != NULL)
+ {
+ features = 0;
+ if (info->ibt)
+ features = GNU_PROPERTY_X86_FEATURE_1_IBT;
+ if (info->shstk)
+ features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+ number = aprop->u.number;
+ /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ aprop->u.number = (number & bprop->u.number) | features;
+ updated = number != (unsigned int) aprop->u.number;
+ /* Remove the property if all feature bits are cleared. */
+ if (aprop->u.number == 0)
+ aprop->pr_kind = property_remove;
+ }
+ else
+ {
+ features = 0;
+ if (info->ibt)
+ features = GNU_PROPERTY_X86_FEATURE_1_IBT;
+ if (info->shstk)
+ features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+ if (features)
+ {
+ /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ if (aprop != NULL)
+ {
+ number = aprop->u.number;
+ aprop->u.number = number | features;
+ updated = number != (unsigned int) aprop->u.number;
+ }
+ else
+ {
+ bprop->u.number |= features;
+ updated = TRUE;
+ }
+ }
+ else if (aprop != NULL)
+ {
+ aprop->pr_kind = property_remove;
+ updated = TRUE;
+ }
+ }
+ break;
+
default:
/* Never should happen. */
abort ();
@@ -7064,9 +7348,78 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
bfd_boolean lazy_plt;
asection *sec, *pltsec;
bfd *dynobj;
- unsigned int plt_alignment;
+ bfd_boolean use_ibt_plt;
+ unsigned int plt_alignment, features;
struct elf_x86_64_link_hash_table *htab;
- bfd *pbfd = _bfd_elf_link_setup_gnu_properties (info);
+ bfd *pbfd;
+
+ features = 0;
+ if (info->ibt)
+ features = GNU_PROPERTY_X86_FEATURE_1_IBT;
+ if (info->shstk)
+ features |= GNU_PROPERTY_X86_FEATURE_1_SHSTK;
+ if (features)
+ {
+ /* Turn on GNU_PROPERTY_X86_FEATURE_1_IBT and
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ bfd *ebfd = NULL;
+ elf_property *prop;
+
+ for (pbfd = info->input_bfds;
+ pbfd != NULL;
+ pbfd = pbfd->link.next)
+ if (bfd_get_flavour (pbfd) == bfd_target_elf_flavour
+ && bfd_count_sections (pbfd) != 0)
+ {
+ ebfd = pbfd;
+
+ if (elf_properties (pbfd) != NULL)
+ {
+ /* Find a normal input file with GNU property note. */
+ prop = _bfd_elf_get_property (pbfd,
+ GNU_PROPERTY_X86_FEATURE_1_AND,
+ 4);
+ /* Add GNU_PROPERTY_X86_FEATURE_1_IBT and
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK. */
+ prop->u.number |= features;
+ prop->pr_kind = property_number;
+ break;
+ }
+ }
+
+ if (pbfd == NULL && ebfd != NULL)
+ {
+ /* Create GNU_PROPERTY_X86_FEATURE_1_IBT if needed. */
+ prop = _bfd_elf_get_property (ebfd,
+ GNU_PROPERTY_X86_FEATURE_1_AND,
+ 4);
+ prop->u.number = features;
+ prop->pr_kind = property_number;
+
+ sec = bfd_make_section_with_flags (ebfd,
+ NOTE_GNU_PROPERTY_SECTION_NAME,
+ (SEC_ALLOC
+ | SEC_LOAD
+ | SEC_IN_MEMORY
+ | SEC_READONLY
+ | SEC_HAS_CONTENTS
+ | SEC_DATA));
+ if (sec == NULL)
+ info->callbacks->einfo (_("%F: failed to create GNU property section\n"));
+
+ if (!bfd_set_section_alignment (ebfd, sec,
+ ABI_64_P (ebfd) ? 3 : 2))
+ {
+error_alignment:
+ info->callbacks->einfo (_("%F%A: failed to align section\n"),
+ sec);
+ }
+
+ elf_section_type (sec) = SHT_NOTE;
+ }
+ }
+
+ pbfd = _bfd_elf_link_setup_gnu_properties (info);
if (bfd_link_relocatable (info))
return pbfd;
@@ -7075,26 +7428,54 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
if (htab == NULL)
return pbfd;
+ use_ibt_plt = info->ibtplt || info->ibt;
+ if (!use_ibt_plt && pbfd != NULL)
+ {
+ /* Check if GNU_PROPERTY_X86_FEATURE_1_IBT is on. */
+ elf_property_list *p;
+
+ /* The property list is sorted in order of type. */
+ for (p = elf_properties (pbfd); p; p = p->next)
+ {
+ if (GNU_PROPERTY_X86_FEATURE_1_AND == p->property.pr_type)
+ {
+ use_ibt_plt = !!(p->property.u.number
+ & GNU_PROPERTY_X86_FEATURE_1_IBT);
+ break;
+ }
+ else if (GNU_PROPERTY_X86_FEATURE_1_AND < p->property.pr_type)
+ break;
+ }
+ }
+
dynobj = htab->elf.dynobj;
/* Set htab->elf.dynobj here so that there is no need to check and
set it in check_relocs. */
if (dynobj == NULL)
{
- bfd *abfd;
-
- /* Find a normal input file to hold linker created
- sections. */
- for (abfd = info->input_bfds;
- abfd != NULL;
- abfd = abfd->link.next)
- if ((abfd->flags
- & (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0)
- {
- htab->elf.dynobj = abfd;
- dynobj = abfd;
- break;
- }
+ if (pbfd != NULL)
+ {
+ htab->elf.dynobj = pbfd;
+ dynobj = pbfd;
+ }
+ else
+ {
+ bfd *abfd;
+
+ /* Find a normal input file to hold linker created
+ sections. */
+ for (abfd = info->input_bfds;
+ abfd != NULL;
+ abfd = abfd->link.next)
+ if ((abfd->flags
+ & (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0)
+ {
+ htab->elf.dynobj = abfd;
+ dynobj = abfd;
+ break;
+ }
+ }
}
/* Even when lazy binding is disabled by "-z now", the PLT0 entry may
@@ -7105,7 +7486,20 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
if (get_elf_x86_64_backend_data (info->output_bfd)->os
== is_normal)
{
- if (info->bndplt)
+ if (use_ibt_plt)
+ {
+ if (ABI_64_P (dynobj))
+ {
+ htab->lazy_plt = &elf_x86_64_lazy_ibt_plt;
+ htab->non_lazy_plt = &elf_x86_64_non_lazy_ibt_plt;
+ }
+ else
+ {
+ htab->lazy_plt = &elf_x32_lazy_ibt_plt;
+ htab->non_lazy_plt = &elf_x32_non_lazy_ibt_plt;
+ }
+ }
+ else if (info->bndplt)
{
htab->lazy_plt = &elf_x86_64_lazy_bnd_plt;
htab->non_lazy_plt = &elf_x86_64_non_lazy_bnd_plt;
@@ -7178,11 +7572,7 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
properly aligned even if create_dynamic_sections isn't called. */
sec = htab->elf.sgot;
if (!bfd_set_section_alignment (dynobj, sec, 3))
- {
-error_alignment:
- info->callbacks->einfo (_("%F%A: failed to align section\n"),
- sec);
- }
+ goto error_alignment;
sec = htab->elf.sgotplt;
if (!bfd_set_section_alignment (dynobj, sec, 3))
@@ -7242,21 +7632,40 @@ error_alignment:
htab->plt_got = sec;
- /* MPX PLT is supported only for non-NaCl target in 64-bit
- mode and is needed only for lazy binding. */
- if (lazy_plt
- && info->bndplt && ABI_64_P (dynobj))
+ if (lazy_plt)
{
- /* Create the second PLT for Intel MPX support. */
- sec = bfd_make_section_anyway_with_flags (dynobj,
- ".plt.sec",
- pltflags);
- if (sec == NULL)
- info->callbacks->einfo (_("%F: failed to create BND PLT section\n"));
+ sec = NULL;
- if (!bfd_set_section_alignment (dynobj, sec,
- non_lazy_plt_alignment))
- goto error_alignment;
+ if (use_ibt_plt)
+ {
+ /* Create the second PLT for Intel IBT support. IBT
+ PLT is supported only for non-NaCl target and is
+ is needed only for lazy binding. */
+ sec = bfd_make_section_anyway_with_flags (dynobj,
+ ".plt.sec",
+ pltflags);
+ if (sec == NULL)
+ info->callbacks->einfo (_("%F: failed to create IBT-enabled PLT section\n"));
+
+ if (!bfd_set_section_alignment (dynobj, sec,
+ plt_alignment))
+ goto error_alignment;
+ }
+ else if (info->bndplt && ABI_64_P (dynobj))
+ {
+ /* Create the second PLT for Intel MPX support. MPX
+ PLT is supported only for non-NaCl target in 64-bit
+ mode and is needed only for lazy binding. */
+ sec = bfd_make_section_anyway_with_flags (dynobj,
+ ".plt.sec",
+ pltflags);
+ if (sec == NULL)
+ info->callbacks->einfo (_("%F: failed to create BND PLT section\n"));
+
+ if (!bfd_set_section_alignment (dynobj, sec,
+ non_lazy_plt_alignment))
+ goto error_alignment;
+ }
htab->plt_second = sec;
}
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 71da4c9..471e8ad 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -218,9 +218,13 @@ _bfd_elf_link_create_dynstrtab (bfd *abfd, struct bfd_link_info *info)
if ((abfd->flags & (DYNAMIC | BFD_PLUGIN)) != 0)
{
bfd *ibfd;
+ asection *s;
for (ibfd = info->input_bfds; ibfd; ibfd = ibfd->link.next)
if ((ibfd->flags
- & (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0)
+ & (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0
+ && bfd_get_flavour (ibfd) == bfd_target_elf_flavour
+ && !((s = ibfd->sections) != NULL
+ && s->sec_info_type == SEC_INFO_TYPE_JUST_SYMS))
{
abfd = ibfd;
break;
@@ -2450,8 +2454,7 @@ _bfd_elf_link_read_relocs (bfd *abfd,
{
bfd_size_type size;
- size = o->reloc_count;
- size *= bed->s->int_rels_per_ext_rel * sizeof (Elf_Internal_Rela);
+ size = (bfd_size_type) o->reloc_count * sizeof (Elf_Internal_Rela);
if (keep_memory)
internal_relocs = alloc2 = (Elf_Internal_Rela *) bfd_alloc (abfd, size);
else
@@ -5862,9 +5865,12 @@ bfd_boolean
_bfd_elf_size_group_sections (struct bfd_link_info *info)
{
bfd *ibfd;
+ asection *s;
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next)
if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour
+ && (s = ibfd->sections) != NULL
+ && s->sec_info_type != SEC_INFO_TYPE_JUST_SYMS
&& !_bfd_elf_fixup_group_sections (ibfd, bfd_abs_section_ptr))
return FALSE;
return TRUE;
@@ -6512,6 +6518,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
if (inputobj->flags
& (DYNAMIC | EXEC_P | BFD_PLUGIN | BFD_LINKER_CREATED))
continue;
+ s = inputobj->sections;
+ if (s == NULL || s->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ continue;
+
s = bfd_get_section_by_name (inputobj, ".note.GNU-stack");
if (s)
{
@@ -6661,9 +6671,10 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
bfd *sub;
asection *o;
- for (sub = info->input_bfds; sub != NULL;
- sub = sub->link.next)
- if (bfd_get_flavour (sub) == bfd_target_elf_flavour)
+ for (sub = info->input_bfds; sub != NULL; sub = sub->link.next)
+ if (bfd_get_flavour (sub) == bfd_target_elf_flavour
+ && (o = sub->sections) != NULL
+ && o->sec_info_type != SEC_INFO_TYPE_JUST_SYMS)
for (o = sub->sections; o != NULL; o = o->next)
if (elf_section_data (o)->this_hdr.sh_type
== SHT_PREINIT_ARRAY)
@@ -6941,7 +6952,7 @@ bfd_elf_size_dynsym_hash_dynstr (bfd *output_bfd, struct bfd_link_info *info)
= compute_bucket_count (info, hashcodes, nsyms, 0);
free (hashcodes);
- if (bucketcount == 0)
+ if (bucketcount == 0 && nsyms > 0)
return FALSE;
elf_hash_table (info)->bucketcount = bucketcount;
@@ -8548,7 +8559,8 @@ static bfd_boolean
elf_link_adjust_relocs (bfd *abfd,
asection *sec,
struct bfd_elf_section_reloc_data *reldata,
- bfd_boolean sort)
+ bfd_boolean sort,
+ struct bfd_link_info *info)
{
unsigned int i;
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
@@ -8596,6 +8608,20 @@ elf_link_adjust_relocs (bfd *abfd,
if (*rel_hash == NULL)
continue;
+ if ((*rel_hash)->indx == -2
+ && info->gc_sections
+ && ! info->gc_keep_exported)
+ {
+ /* PR 21524: Let the user know if a symbol was removed by garbage collection. */
+ _bfd_error_handler (_("%B:%A: error: relocation references symbol %s which was removed by garbage collection."),
+ abfd, sec,
+ (*rel_hash)->root.root.string);
+ _bfd_error_handler (_("%B:%A: error: try relinking with --gc-keep-exported enabled."),
+ abfd, sec,
+ (*rel_hash)->root.root.string);
+ bfd_set_error (bfd_error_invalid_operation);
+ return FALSE;
+ }
BFD_ASSERT ((*rel_hash)->indx >= 0);
(*swap_in) (abfd, erela, irela);
@@ -10278,7 +10304,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
continue;
}
- if (bfd_link_relocatable (flinfo->info)
+ if (!flinfo->info->resolve_section_groups
&& (o->flags & (SEC_LINKER_CREATED | SEC_GROUP)) == SEC_GROUP)
{
/* Deal with the group signature symbol. */
@@ -10286,6 +10312,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
unsigned long symndx = sec_data->this_hdr.sh_info;
asection *osec = o->output_section;
+ BFD_ASSERT (bfd_link_relocatable (flinfo->info));
if (symndx >= locsymcount
|| (elf_bad_symtab (input_bfd)
&& flinfo->sections[symndx] == NULL))
@@ -10402,7 +10429,8 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
".fini_array") == 0))
&& (o->name[6] == 0 || o->name[6] == '.'))
{
- if (o->size != o->reloc_count * address_size)
+ if (o->size * bed->s->int_rels_per_ext_rel
+ != o->reloc_count * address_size)
{
_bfd_error_handler
/* xgettext:c-format */
@@ -10426,7 +10454,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
relocs against removed link-once sections. */
rel = internal_relocs;
- relend = rel + o->reloc_count * bed->s->int_rels_per_ext_rel;
+ relend = rel + o->reloc_count;
for ( ; rel < relend; rel++)
{
unsigned long r_symndx = rel->r_info >> r_sym_shift;
@@ -10615,7 +10643,7 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
/* Adjust the reloc addresses and symbol indices. */
irela = internal_relocs;
- irelaend = irela + o->reloc_count * bed->s->int_rels_per_ext_rel;
+ irelaend = irela + o->reloc_count;
rel_hash = esdo->rel.hashes + esdo->rel.count;
/* We start processing the REL relocs, if any. When we reach
IRELAMID in the loop, we switch to the RELA relocs. */
@@ -10700,7 +10728,6 @@ elf_link_input_bfd (struct elf_final_link_info *flinfo, bfd *input_bfd)
used by a reloc. */
BFD_ASSERT (rh->indx < 0);
rh->indx = -2;
-
*rel_hash = rh;
continue;
@@ -11789,8 +11816,7 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
if (max_internal_reloc_count != 0)
{
- amt = max_internal_reloc_count * bed->s->int_rels_per_ext_rel;
- amt *= sizeof (Elf_Internal_Rela);
+ amt = max_internal_reloc_count * sizeof (Elf_Internal_Rela);
flinfo.internal_relocs = (Elf_Internal_Rela *) bfd_malloc (amt);
if (flinfo.internal_relocs == NULL)
goto error_return;
@@ -12168,15 +12194,16 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
{
struct bfd_elf_section_data *esdo = elf_section_data (o);
bfd_boolean sort;
+
if ((o->flags & SEC_RELOC) == 0)
continue;
sort = bed->sort_relocs_p == NULL || (*bed->sort_relocs_p) (o);
if (esdo->rel.hdr != NULL
- && !elf_link_adjust_relocs (abfd, o, &esdo->rel, sort))
+ && !elf_link_adjust_relocs (abfd, o, &esdo->rel, sort, info))
return FALSE;
if (esdo->rela.hdr != NULL
- && !elf_link_adjust_relocs (abfd, o, &esdo->rela, sort))
+ && !elf_link_adjust_relocs (abfd, o, &esdo->rela, sort, info))
return FALSE;
/* Set the reloc_count field to 0 to prevent write_relocs from
@@ -12464,10 +12491,11 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info)
}
}
- if (bfd_link_relocatable (info))
+ if (!info->resolve_section_groups)
{
bfd_boolean failed = FALSE;
+ BFD_ASSERT (bfd_link_relocatable (info));
bfd_map_over_sections (abfd, bfd_elf_set_group_contents, &failed);
if (failed)
goto error_return;
@@ -12573,8 +12601,6 @@ init_reloc_cookie_rels (struct elf_reloc_cookie *cookie,
struct bfd_link_info *info, bfd *abfd,
asection *sec)
{
- const struct elf_backend_data *bed;
-
if (sec->reloc_count == 0)
{
cookie->rels = NULL;
@@ -12582,15 +12608,12 @@ init_reloc_cookie_rels (struct elf_reloc_cookie *cookie,
}
else
{
- bed = get_elf_backend_data (abfd);
-
cookie->rels = _bfd_elf_link_read_relocs (abfd, sec, NULL, NULL,
info->keep_memory);
if (cookie->rels == NULL)
return FALSE;
cookie->rel = cookie->rels;
- cookie->relend = (cookie->rels
- + sec->reloc_count * bed->s->int_rels_per_ext_rel);
+ cookie->relend = cookie->rels + sec->reloc_count;
}
cookie->rel = cookie->rels;
return TRUE;
@@ -12687,55 +12710,6 @@ elf_gc_mark_debug_section (asection *sec ATTRIBUTE_UNUSED,
return NULL;
}
-/* For undefined __start_<name> and __stop_<name> symbols, return the
- first input section matching <name>. Return NULL otherwise. */
-
-asection *
-_bfd_elf_is_start_stop (const struct bfd_link_info *info,
- struct elf_link_hash_entry *h)
-{
- asection *s;
- const char *sec_name;
-
- if (h->root.type != bfd_link_hash_undefined
- && h->root.type != bfd_link_hash_undefweak)
- return NULL;
-
- s = h->root.u.undef.section;
- if (s != NULL)
- {
- if (s == (asection *) 0 - 1)
- return NULL;
- return s;
- }
-
- sec_name = NULL;
- if (strncmp (h->root.root.string, "__start_", 8) == 0)
- sec_name = h->root.root.string + 8;
- else if (strncmp (h->root.root.string, "__stop_", 7) == 0)
- sec_name = h->root.root.string + 7;
-
- if (sec_name != NULL && *sec_name != '\0')
- {
- bfd *i;
-
- for (i = info->input_bfds; i != NULL; i = i->link.next)
- {
- s = bfd_get_section_by_name (i, sec_name);
- if (s != NULL)
- {
- h->root.u.undef.section = s;
- break;
- }
- }
- }
-
- if (s == NULL)
- h->root.u.undef.section = (asection *) 0 - 1;
-
- return s;
-}
-
/* COOKIE->rel describes a relocation against section SEC, which is
a section we've decided to keep. Return the section that contains
the relocation symbol, or NULL if no section contains it. */
@@ -12776,15 +12750,12 @@ _bfd_elf_gc_mark_rsec (struct bfd_link_info *info, asection *sec,
if (start_stop != NULL)
{
- /* To work around a glibc bug, mark all XXX input sections
- when there is an as yet undefined reference to __start_XXX
- or __stop_XXX symbols. The linker will later define such
- symbols for orphan input sections that have a name
- representable as a C identifier. */
- asection *s = _bfd_elf_is_start_stop (info, h);
-
- if (s != NULL)
+ /* To work around a glibc bug, mark XXX input sections
+ when there is a reference to __start_XXX or __stop_XXX
+ symbols. */
+ if (h->start_stop)
{
+ asection *s = h->u2.start_stop_section;
*start_stop = !s->gc_mark;
return s;
}
@@ -12952,6 +12923,9 @@ _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info,
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
continue;
+ isec = ibfd->sections;
+ if (isec == NULL || isec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ continue;
/* Ensure all linker created sections are kept,
see if any other section is already marked,
@@ -13057,6 +13031,9 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info)
if (bfd_get_flavour (sub) != bfd_target_elf_flavour
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
continue;
+ o = sub->sections;
+ if (o == NULL || o->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ continue;
for (o = sub->sections; o != NULL; o = o->next)
{
@@ -13125,26 +13102,28 @@ static bfd_boolean
elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
{
/* Those that are not vtables. */
- if (h->vtable == NULL || h->vtable->parent == NULL)
+ if (h->start_stop
+ || h->u2.vtable == NULL
+ || h->u2.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)
+ if (h->u2.vtable->parent == (struct elf_link_hash_entry *) -1)
return TRUE;
/* If we've already been done, exit. */
- if (h->vtable->used && h->vtable->used[-1])
+ if (h->u2.vtable->used && h->u2.vtable->used[-1])
return TRUE;
/* Make sure the parent's table is up to date. */
- elf_gc_propagate_vtable_entries_used (h->vtable->parent, okp);
+ elf_gc_propagate_vtable_entries_used (h->u2.vtable->parent, okp);
- if (h->vtable->used == NULL)
+ if (h->u2.vtable->used == NULL)
{
/* None of this table's entries were referenced. Re-use the
parent's table. */
- h->vtable->used = h->vtable->parent->vtable->used;
- h->vtable->size = h->vtable->parent->vtable->size;
+ h->u2.vtable->used = h->u2.vtable->parent->u2.vtable->used;
+ h->u2.vtable->size = h->u2.vtable->parent->u2.vtable->size;
}
else
{
@@ -13152,9 +13131,9 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
bfd_boolean *cu, *pu;
/* Or the parent's entries into ours. */
- cu = h->vtable->used;
+ cu = h->u2.vtable->used;
cu[-1] = TRUE;
- pu = h->vtable->parent->vtable->used;
+ pu = h->u2.vtable->parent->u2.vtable->used;
if (pu != NULL)
{
const struct elf_backend_data *bed;
@@ -13162,7 +13141,7 @@ elf_gc_propagate_vtable_entries_used (struct elf_link_hash_entry *h, void *okp)
bed = get_elf_backend_data (h->root.u.def.section->owner);
log_file_align = bed->s->log_file_align;
- n = h->vtable->parent->vtable->size >> log_file_align;
+ n = h->u2.vtable->parent->u2.vtable->size >> log_file_align;
while (n--)
{
if (*pu)
@@ -13187,7 +13166,9 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
/* Take care of both those symbols that do not describe vtables as
well as those that are not loaded. */
- if (h->vtable == NULL || h->vtable->parent == NULL)
+ if (h->start_stop
+ || h->u2.vtable == NULL
+ || h->u2.vtable->parent == NULL)
return TRUE;
BFD_ASSERT (h->root.type == bfd_link_hash_defined
@@ -13203,17 +13184,17 @@ elf_gc_smash_unused_vtentry_relocs (struct elf_link_hash_entry *h, void *okp)
bed = get_elf_backend_data (sec->owner);
log_file_align = bed->s->log_file_align;
- relend = relstart + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+ relend = relstart + sec->reloc_count;
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->used
- && (rel->r_offset - hstart) < h->vtable->size)
+ if (h->u2.vtable->used
+ && (rel->r_offset - hstart) < h->u2.vtable->size)
{
bfd_vma entry = (rel->r_offset - hstart) >> log_file_align;
- if (h->vtable->used[entry])
+ if (h->u2.vtable->used[entry])
continue;
}
/* Otherwise, kill it. */
@@ -13290,6 +13271,9 @@ bfd_elf_parse_eh_frame_entries (bfd *abfd ATTRIBUTE_UNUSED,
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour)
continue;
+ sec = ibfd->sections;
+ if (sec == NULL || sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ continue;
if (!init_reloc_cookie (&cookie, info, ibfd))
return FALSE;
@@ -13337,6 +13321,9 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
asection *sec;
struct elf_reloc_cookie cookie;
+ sec = sub->sections;
+ if (sec == NULL || sec->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ continue;
sec = bfd_get_section_by_name (sub, ".eh_frame");
while (sec && init_reloc_cookie_for_section (&cookie, info, sec))
{
@@ -13373,6 +13360,10 @@ bfd_elf_gc_sections (bfd *abfd, struct bfd_link_info *info)
|| !(*bed->relocs_compatible) (sub->xvec, abfd->xvec))
continue;
+ o = sub->sections;
+ if (o == NULL || o->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ continue;
+
/* Start at sections marked with SEC_KEEP (ref _bfd_elf_gc_keep).
Also treat note sections as a root, if the section is not part
of a group. */
@@ -13437,11 +13428,11 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
return FALSE;
win:
- if (!child->vtable)
+ if (!child->u2.vtable)
{
- child->vtable = ((struct elf_link_virtual_table_entry *)
- bfd_zalloc (abfd, sizeof (*child->vtable)));
- if (!child->vtable)
+ child->u2.vtable = ((struct elf_link_virtual_table_entry *)
+ bfd_zalloc (abfd, sizeof (*child->u2.vtable)));
+ if (!child->u2.vtable)
return FALSE;
}
if (!h)
@@ -13451,10 +13442,10 @@ bfd_elf_gc_record_vtinherit (bfd *abfd,
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;
+ child->u2.vtable->parent = (struct elf_link_hash_entry *) -1;
}
else
- child->vtable->parent = h;
+ child->u2.vtable->parent = h;
return TRUE;
}
@@ -13470,18 +13461,18 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
const struct elf_backend_data *bed = get_elf_backend_data (abfd);
unsigned int log_file_align = bed->s->log_file_align;
- if (!h->vtable)
+ if (!h->u2.vtable)
{
- h->vtable = ((struct elf_link_virtual_table_entry *)
- bfd_zalloc (abfd, sizeof (*h->vtable)));
- if (!h->vtable)
+ h->u2.vtable = ((struct elf_link_virtual_table_entry *)
+ bfd_zalloc (abfd, sizeof (*h->u2.vtable)));
+ if (!h->u2.vtable)
return FALSE;
}
- if (addend >= h->vtable->size)
+ if (addend >= h->u2.vtable->size)
{
size_t size, bytes, file_align;
- bfd_boolean *ptr = h->vtable->used;
+ bfd_boolean *ptr = h->u2.vtable->used;
/* While the symbol is undefined, we have to be prepared to handle
a zero size. */
@@ -13512,7 +13503,7 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
{
size_t oldbytes;
- oldbytes = (((h->vtable->size >> log_file_align) + 1)
+ oldbytes = (((h->u2.vtable->size >> log_file_align) + 1)
* sizeof (bfd_boolean));
memset (((char *) ptr) + oldbytes, 0, bytes - oldbytes);
}
@@ -13524,11 +13515,11 @@ bfd_elf_gc_record_vtentry (bfd *abfd ATTRIBUTE_UNUSED,
return FALSE;
/* And arrange for that done flag to be at index -1. */
- h->vtable->used = ptr + 1;
- h->vtable->size = size;
+ h->u2.vtable->used = ptr + 1;
+ h->u2.vtable->size = size;
}
- h->vtable->used[addend >> log_file_align] = TRUE;
+ h->u2.vtable->used[addend >> log_file_align] = TRUE;
return TRUE;
}
@@ -13877,9 +13868,13 @@ bfd_elf_discard_info (bfd *output_bfd, struct bfd_link_info *info)
for (abfd = info->input_bfds; abfd != NULL; abfd = abfd->link.next)
{
const struct elf_backend_data *bed;
+ asection *s;
if (bfd_get_flavour (abfd) != bfd_target_elf_flavour)
continue;
+ s = abfd->sections;
+ if (s == NULL || s->sec_info_type == SEC_INFO_TYPE_JUST_SYMS)
+ continue;
bed = get_elf_backend_data (abfd);
@@ -14228,3 +14223,25 @@ elf_append_rel (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
BFD_ASSERT (loc + bed->s->sizeof_rel <= s->contents + s->size);
bed->s->swap_reloc_out (abfd, rel, loc);
}
+
+/* Define __start, __stop, .startof. or .sizeof. symbol. */
+
+struct bfd_link_hash_entry *
+bfd_elf_define_start_stop (struct bfd_link_info *info,
+ const char *symbol, asection *sec)
+{
+ struct bfd_link_hash_entry *h;
+
+ h = bfd_generic_define_start_stop (info, symbol, sec);
+ if (h != NULL)
+ {
+ struct elf_link_hash_entry *eh = (struct elf_link_hash_entry *) h;
+ eh->start_stop = 1;
+ eh->u2.start_stop_section = sec;
+ _bfd_elf_link_hash_hide_symbol (info, eh, TRUE);
+ if (ELF_ST_VISIBILITY (eh->other) != STV_INTERNAL)
+ eh->other = ((eh->other & ~ELF_ST_VISIBILITY (-1))
+ | STV_HIDDEN);
+ }
+ return h;
+}
diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c
index 2ff2120..b61bb8a 100644
--- a/bfd/elfnn-aarch64.c
+++ b/bfd/elfnn-aarch64.c
@@ -249,7 +249,7 @@
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_OFF_G0_NC \
|| (R_TYPE) == BFD_RELOC_AARCH64_TLSDESC_OFF_G1)
-#define ELIMINATE_COPY_RELOCS 0
+#define ELIMINATE_COPY_RELOCS 1
/* Return size of a relocation entry. HTAB is the bfd's
elf_aarch64_link_hash_entry. */
@@ -5169,12 +5169,25 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
/* When generating a shared object or relocatable executable, these
relocations are copied into the output file to be resolved at
run time. */
- if ((bfd_link_pic (info)
- || globals->root.is_relocatable_executable)
- && (input_section->flags & SEC_ALLOC)
- && (h == NULL
- || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || h->root.type != bfd_link_hash_undefweak))
+ if (((bfd_link_pic (info)
+ || globals->root.is_relocatable_executable)
+ && (input_section->flags & SEC_ALLOC)
+ && (h == NULL
+ || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
+ || h->root.type != bfd_link_hash_undefweak))
+ /* Or 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. */
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (input_section->flags & SEC_ALLOC)
+ && h->dynindx != -1
+ && !h->non_got_ref
+ && ((h->def_dynamic
+ && !h->def_regular)
+ || h->root.type == bfd_link_hash_undefweak
+ || h->root.type == bfd_link_hash_undefined)))
{
Elf_Internal_Rela outrel;
bfd_byte *loc;
@@ -5316,15 +5329,15 @@ elfNN_aarch64_final_link_relocate (reloc_howto_type *howto,
if (bfd_link_pic (info)
&& (input_section->flags & SEC_ALLOC) != 0
&& (input_section->flags & SEC_READONLY) != 0
- && h != NULL
- && !h->def_regular)
+ && !SYMBOL_REFERENCES_LOCAL (info, h))
{
int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
_bfd_error_handler
/* xgettext:c-format */
- (_("%B: relocation %s against external symbol `%s' can not be used"
- " when making a shared object; recompile with -fPIC"),
+ (_("%B: relocation %s against symbol `%s' which may bind "
+ "externally can not be used when making a shared object; "
+ "recompile with -fPIC"),
input_bfd, elfNN_aarch64_howto_table[howto_index].name,
h->root.root.string);
bfd_set_error (bfd_error_bad_value);
@@ -6846,15 +6859,22 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd,
h->plt.refcount -= 1;
break;
+ case BFD_RELOC_AARCH64_ADD_LO12:
case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
+ case BFD_RELOC_AARCH64_LDST128_LO12:
+ case BFD_RELOC_AARCH64_LDST16_LO12:
+ case BFD_RELOC_AARCH64_LDST32_LO12:
+ case BFD_RELOC_AARCH64_LDST64_LO12:
+ case BFD_RELOC_AARCH64_LDST8_LO12:
+ case BFD_RELOC_AARCH64_LD_LO19_PCREL:
case BFD_RELOC_AARCH64_MOVW_G0_NC:
case BFD_RELOC_AARCH64_MOVW_G1_NC:
case BFD_RELOC_AARCH64_MOVW_G2_NC:
case BFD_RELOC_AARCH64_MOVW_G3:
case BFD_RELOC_AARCH64_NN:
- if (h != NULL && bfd_link_executable (info))
+ if (h != NULL && !bfd_link_pic (info))
{
if (h->plt.refcount > 0)
h->plt.refcount -= 1;
@@ -6869,6 +6889,31 @@ elfNN_aarch64_gc_sweep_hook (bfd *abfd,
return TRUE;
}
+/* Return true if we need copy relocation against EH. */
+
+static bfd_boolean
+need_copy_relocation_p (struct elf_aarch64_link_hash_entry *eh)
+{
+ struct elf_dyn_relocs *p;
+ asection *s;
+
+ for (p = eh->dyn_relocs; p != NULL; p = p->next)
+ {
+ /* If there is any pc-relative reference, we need to keep copy relocation
+ to avoid propagating the relocation into runtime that current glibc
+ does not support. */
+ if (p->pc_count)
+ return TRUE;
+
+ s = p->sec->output_section;
+ /* Need copy relocation if it's against read-only section. */
+ if (s != NULL && (s->flags & SEC_READONLY) != 0)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
/* 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
@@ -6942,6 +6987,19 @@ elfNN_aarch64_adjust_dynamic_symbol (struct bfd_link_info *info,
return TRUE;
}
+ if (ELIMINATE_COPY_RELOCS)
+ {
+ struct elf_aarch64_link_hash_entry *eh;
+ /* 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. */
+ eh = (struct elf_aarch64_link_hash_entry *) h;
+ if (!need_copy_relocation_p (eh))
+ {
+ h->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
@@ -7196,6 +7254,41 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
switch (bfd_r_type)
{
+ case BFD_RELOC_AARCH64_MOVW_G0_NC:
+ case BFD_RELOC_AARCH64_MOVW_G1_NC:
+ case BFD_RELOC_AARCH64_MOVW_G2_NC:
+ case BFD_RELOC_AARCH64_MOVW_G3:
+ if (bfd_link_pic (info))
+ {
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%B: relocation %s against `%s' can not be used when making "
+ "a shared object; recompile with -fPIC"),
+ abfd, elfNN_aarch64_howto_table[howto_index].name,
+ (h) ? h->root.root.string : "a local symbol");
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+ /* Fall through. */
+
+ case BFD_RELOC_AARCH64_16_PCREL:
+ case BFD_RELOC_AARCH64_32_PCREL:
+ case BFD_RELOC_AARCH64_64_PCREL:
+ case BFD_RELOC_AARCH64_ADD_LO12:
+ case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
+ case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
+ case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
+ case BFD_RELOC_AARCH64_LDST128_LO12:
+ case BFD_RELOC_AARCH64_LDST16_LO12:
+ case BFD_RELOC_AARCH64_LDST32_LO12:
+ case BFD_RELOC_AARCH64_LDST64_LO12:
+ case BFD_RELOC_AARCH64_LDST8_LO12:
+ case BFD_RELOC_AARCH64_LD_LO19_PCREL:
+ if (h == NULL || bfd_link_pic (info))
+ break;
+ /* Fall through. */
+
case BFD_RELOC_AARCH64_NN:
/* We don't need to handle relocs into sections not going into
@@ -7214,12 +7307,32 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
/* No need to do anything if we're not creating a shared
object. */
- if (! bfd_link_pic (info))
+ if (!(bfd_link_pic (info)
+ /* 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.
+
+ NOTE: Currently, there is no support of copy relocs
+ elimination on pc-relative relocation types, because there is
+ no dynamic relocation support for them in glibc. We still
+ record the dynamic symbol reference for them. This is
+ because one symbol may be referenced by both absolute
+ relocation (for example, BFD_RELOC_AARCH64_NN) and
+ pc-relative relocation. We need full symbol reference
+ information to make correct decision later in
+ elfNN_aarch64_adjust_dynamic_symbol. */
+ || (ELIMINATE_COPY_RELOCS
+ && !bfd_link_pic (info)
+ && h != NULL
+ && (h->root.type == bfd_link_hash_defweak
+ || !h->def_regular))))
break;
{
struct elf_dyn_relocs *p;
struct elf_dyn_relocs **head;
+ int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
/* We must copy these reloc types into the output file.
Create a reloc section in dynobj and make room for
@@ -7283,6 +7396,8 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
p->count += 1;
+ if (elfNN_aarch64_howto_table[howto_index].pc_relative)
+ p->pc_count += 1;
}
break;
@@ -7386,44 +7501,6 @@ elfNN_aarch64_check_relocs (bfd *abfd, struct bfd_link_info *info,
break;
}
- case BFD_RELOC_AARCH64_MOVW_G0_NC:
- case BFD_RELOC_AARCH64_MOVW_G1_NC:
- case BFD_RELOC_AARCH64_MOVW_G2_NC:
- case BFD_RELOC_AARCH64_MOVW_G3:
- if (bfd_link_pic (info))
- {
- int howto_index = bfd_r_type - BFD_RELOC_AARCH64_RELOC_START;
- _bfd_error_handler
- /* xgettext:c-format */
- (_("%B: relocation %s against `%s' can not be used when making "
- "a shared object; recompile with -fPIC"),
- abfd, elfNN_aarch64_howto_table[howto_index].name,
- (h) ? h->root.root.string : "a local symbol");
- bfd_set_error (bfd_error_bad_value);
- return FALSE;
- }
- /* Fall through. */
-
- case BFD_RELOC_AARCH64_ADR_HI21_NC_PCREL:
- case BFD_RELOC_AARCH64_ADR_HI21_PCREL:
- case BFD_RELOC_AARCH64_ADR_LO21_PCREL:
- if (h != NULL && bfd_link_executable (info))
- {
- /* If this reloc is in a read-only section, we might
- need a copy reloc. We can't check reliably at this
- stage whether the section is read-only, as input
- sections have not yet been mapped to output sections.
- Tentatively set the flag for now, and correct in
- adjust_dynamic_symbol. */
- h->non_got_ref = 1;
- h->plt.refcount += 1;
- h->pointer_equality_needed = 1;
- }
- /* FIXME:: RR need to handle these in shared libraries
- and essentially bomb out as these being non-PIC
- relocations in shared libraries. */
- break;
-
case BFD_RELOC_AARCH64_CALL26:
case BFD_RELOC_AARCH64_JUMP26:
/* If this is a local symbol then we resolve it
@@ -8949,7 +9026,7 @@ elfNN_aarch64_finish_dynamic_symbol (bfd *output_bfd,
}
else if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h))
{
- if (!h->def_regular)
+ if (!(h->def_regular || ELF_COMMON_DEF_P (h)))
return FALSE;
BFD_ASSERT ((h->got.offset & 1) != 0);
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index cbf39c0..e326edd 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -8102,7 +8102,7 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
extsymoff = (elf_bad_symtab (abfd)) ? 0 : symtab_hdr->sh_info;
bed = get_elf_backend_data (abfd);
- rel_end = relocs + sec->reloc_count * bed->s->int_rels_per_ext_rel;
+ rel_end = relocs + sec->reloc_count;
/* Check for the mips16 stub sections. */
@@ -10031,10 +10031,8 @@ _bfd_mips_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
const Elf_Internal_Rela *relend;
bfd_vma addend = 0;
bfd_boolean use_saved_addend_p = FALSE;
- const struct elf_backend_data *bed;
- bed = get_elf_backend_data (output_bfd);
- relend = relocs + input_section->reloc_count * bed->s->int_rels_per_ext_rel;
+ relend = relocs + input_section->reloc_count;
for (rel = relocs; rel < relend; ++rel)
{
const char *name;
@@ -11865,6 +11863,10 @@ mips_set_isa_flags (bfd *abfd)
val = E_MIPS_ARCH_2;
break;
+ case bfd_mach_mips4010:
+ val = E_MIPS_ARCH_2 | E_MIPS_MACH_4010;
+ break;
+
case bfd_mach_mips4000:
case bfd_mach_mips4300:
case bfd_mach_mips4400:
@@ -11872,10 +11874,6 @@ mips_set_isa_flags (bfd *abfd)
val = E_MIPS_ARCH_3;
break;
- case bfd_mach_mips4010:
- val = E_MIPS_ARCH_3 | E_MIPS_MACH_4010;
- break;
-
case bfd_mach_mips4100:
val = E_MIPS_ARCH_3 | E_MIPS_MACH_4100;
break;
@@ -14026,7 +14024,6 @@ static const struct mips_mach_extension mips_mach_extensions[] =
{ bfd_mach_mips4400, bfd_mach_mips4000 },
{ bfd_mach_mips4300, bfd_mach_mips4000 },
{ bfd_mach_mips4100, bfd_mach_mips4000 },
- { bfd_mach_mips4010, bfd_mach_mips4000 },
{ bfd_mach_mips5900, bfd_mach_mips4000 },
/* MIPS32 extensions. */
@@ -14035,6 +14032,7 @@ static const struct mips_mach_extension mips_mach_extensions[] =
/* MIPS II extensions. */
{ bfd_mach_mips4000, bfd_mach_mips6000 },
{ bfd_mach_mipsisa32, bfd_mach_mips6000 },
+ { bfd_mach_mips4010, bfd_mach_mips6000 },
/* MIPS I extensions. */
{ bfd_mach_mips6000, bfd_mach_mips3000 },
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 072efaa..551883f 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -269,6 +269,9 @@
#ifndef bfd_elfNN_bfd_link_add_symbols
#define bfd_elfNN_bfd_link_add_symbols bfd_elf_link_add_symbols
#endif
+#ifndef bfd_elfNN_bfd_define_start_stop
+#define bfd_elfNN_bfd_define_start_stop bfd_elf_define_start_stop
+#endif
#ifndef bfd_elfNN_bfd_final_link
#define bfd_elfNN_bfd_final_link bfd_elf_final_link
#endif
@@ -289,6 +292,9 @@
#ifndef bfd_elfNN_bfd_link_add_symbols
#define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols
#endif
+#ifndef bfd_elfNN_bfd_define_start_stop
+#define bfd_elfNN_bfd_define_start_stop bfd_generic_define_start_stop
+#endif
#ifndef bfd_elfNN_bfd_final_link
#define bfd_elfNN_bfd_final_link _bfd_generic_final_link
#endif
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index 5062506..62d2696 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -149,6 +149,7 @@ msdos_set_section_contents (bfd *abfd,
#define msdos_section_already_linked \
_bfd_generic_section_already_linked
#define msdos_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define msdos_bfd_define_start_stop bfd_generic_define_start_stop
#define msdos_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define msdos_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define msdos_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c
index 7f79b23..78c58fd 100644
--- a/bfd/i386os9k.c
+++ b/bfd/i386os9k.c
@@ -178,6 +178,7 @@ os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define os9k_section_already_linked \
_bfd_generic_section_already_linked
#define os9k_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define os9k_bfd_define_start_stop bfd_generic_define_start_stop
#define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define os9k_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define os9k_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/ieee.c b/bfd/ieee.c
index 763c2b8..958a40b 100644
--- a/bfd/ieee.c
+++ b/bfd/ieee.c
@@ -170,7 +170,7 @@ ieee_write_id (bfd *abfd, const char *id)
standard requires. */
#define this_byte(ieee) *((ieee)->input_p)
-#define this_byte_and_next(ieee) (*((ieee)->input_p++))
+#define this_byte_and_next(ieee) ((ieee)->input_p < (ieee)->end_p ? *((ieee)->input_p++) : 0)
static bfd_boolean
next_byte (common_header_type * ieee)
@@ -220,6 +220,15 @@ read_id (common_header_type *ieee)
length = (length * 256) + this_byte_and_next (ieee);
}
+ /* PR 21612: Check for an invalid length. */
+ if (ieee->input_p + length >= ieee->end_p)
+ {
+ _bfd_error_handler (_("IEEE parser: string length: %#lx longer than buffer: %#lx"),
+ length, (long) (ieee->end_p - ieee->input_p));
+ bfd_set_error (bfd_error_invalid_operation);
+ return NULL;
+ }
+
/* Buy memory and read string. */
string = bfd_alloc (ieee->abfd, (bfd_size_type) length + 1);
if (!string)
@@ -699,12 +708,12 @@ ieee_seek (ieee_data_type * ieee, file_ptr offset)
if (offset < 0 || (bfd_size_type) offset >= ieee->h.total_amt)
{
ieee->h.input_p = ieee->h.first_byte + ieee->h.total_amt;
- ieee->h.last_byte = ieee->h.input_p;
+ ieee->h.end_p = ieee->h.last_byte = ieee->h.input_p;
return FALSE;
}
ieee->h.input_p = ieee->h.first_byte + offset;
- ieee->h.last_byte = (ieee->h.first_byte + ieee_part_after (ieee, offset));
+ ieee->h.end_p = ieee->h.last_byte = (ieee->h.first_byte + ieee_part_after (ieee, offset));
return TRUE;
}
@@ -1237,6 +1246,8 @@ ieee_slurp_sections (bfd *abfd)
/* Read section name, use it if non empty. */
name = read_id (&ieee->h);
+ if (name == NULL)
+ return FALSE;
if (name[0])
section->name = name;
@@ -1355,7 +1366,7 @@ ieee_archive_p (bfd *abfd)
{
char *library;
unsigned int i;
- unsigned char buffer[512];
+ static unsigned char buffer[512];
file_ptr buffer_offset = 0;
ieee_ar_data_type *save = abfd->tdata.ieee_ar_data;
ieee_ar_data_type *ieee;
@@ -1375,6 +1386,8 @@ ieee_archive_p (bfd *abfd)
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
+ ieee->h.total_amt = sizeof (buffer);
+ ieee->h.end_p = buffer + sizeof (buffer);
ieee->h.abfd = abfd;
@@ -1384,6 +1397,8 @@ ieee_archive_p (bfd *abfd)
(void) next_byte (&(ieee->h));
library = read_id (&(ieee->h));
+ if (library == NULL)
+ goto got_wrong_format_error;
if (strcmp (library, "LIBRARY") != 0)
goto got_wrong_format_error;
@@ -1442,6 +1457,8 @@ ieee_archive_p (bfd *abfd)
bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
+ ieee->h.total_amt = sizeof (buffer);
+ ieee->h.end_p = buffer + sizeof (buffer);
}
}
@@ -1465,6 +1482,8 @@ ieee_archive_p (bfd *abfd)
bfd_bread ((void *) buffer, (bfd_size_type) sizeof (buffer), abfd);
ieee->h.first_byte = buffer;
ieee->h.input_p = buffer;
+ ieee->h.total_amt = sizeof (buffer);
+ ieee->h.end_p = buffer + sizeof (buffer);
(void) next_byte (&(ieee->h)); /* Drop F8. */
if (! next_byte (&(ieee->h))) /* Drop 14. */
@@ -1873,7 +1892,7 @@ ieee_object_p (bfd *abfd)
char *processor;
unsigned int part;
ieee_data_type *ieee;
- unsigned char buffer[300];
+ static unsigned char buffer[300];
ieee_data_type *save = IEEE_DATA (abfd);
bfd_size_type amt;
@@ -1890,6 +1909,8 @@ ieee_object_p (bfd *abfd)
ieee->h.input_p = buffer;
ieee->h.total_amt = sizeof (buffer);
+ ieee->h.end_p = buffer + sizeof (buffer);
+
if (this_byte_and_next (&(ieee->h)) != Module_Beginning)
goto got_wrong_format;
@@ -1905,9 +1926,13 @@ ieee_object_p (bfd *abfd)
ieee->section_table_size = 0;
processor = ieee->mb.processor = read_id (&(ieee->h));
+ if (processor == NULL)
+ goto got_wrong_format;
if (strcmp (processor, "LIBRARY") == 0)
goto got_wrong_format;
ieee->mb.module_name = read_id (&(ieee->h));
+ if (ieee->mb.module_name == NULL)
+ goto got_wrong_format;
if (abfd->filename == (const char *) NULL)
abfd->filename = xstrdup (ieee->mb.module_name);
@@ -3872,6 +3897,7 @@ ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define ieee_section_already_linked \
_bfd_generic_section_already_linked
#define ieee_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define ieee_bfd_define_start_stop bfd_generic_define_start_stop
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ieee_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/ihex.c b/bfd/ihex.c
index 6dda98f..a0c704a 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -945,6 +945,7 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define ihex_bfd_discard_group bfd_generic_discard_group
#define ihex_section_already_linked _bfd_generic_section_already_linked
#define ihex_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define ihex_bfd_define_start_stop bfd_generic_define_start_stop
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ihex_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index 2d1bf27..7adee99 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -515,6 +515,9 @@ extern bfd_boolean _bfd_generic_set_section_contents
#define _bfd_nolink_bfd_define_common_symbol \
((bfd_boolean (*) (bfd *, struct bfd_link_info *, \
struct bfd_link_hash_entry *)) bfd_false)
+#define _bfd_nolink_bfd_define_start_stop \
+ ((struct bfd_link_hash_entry * (*) (struct bfd_link_info *, \
+ const char *, asection *)) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_check_relocs \
_bfd_generic_link_check_relocs
diff --git a/bfd/libbfd.c b/bfd/libbfd.c
index 554234f..b8c65b5 100644
--- a/bfd/libbfd.c
+++ b/bfd/libbfd.c
@@ -789,6 +789,7 @@ _bfd_generic_get_section_contents (bfd *abfd,
bfd_size_type count)
{
bfd_size_type sz;
+ file_ptr filesz;
if (count == 0)
return TRUE;
@@ -811,8 +812,15 @@ _bfd_generic_get_section_contents (bfd *abfd,
sz = section->rawsize;
else
sz = section->size;
+ filesz = bfd_get_file_size (abfd);
+ if (filesz < 0)
+ {
+ /* This should never happen. */
+ abort ();
+ }
if (offset + count < count
- || offset + count > sz)
+ || offset + count > sz
+ || (section->filepos + offset + count) > (bfd_size_type) filesz)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
@@ -835,6 +843,7 @@ _bfd_generic_get_section_contents_in_window
{
#ifdef USE_MMAP
bfd_size_type sz;
+ file_ptr filesz;
if (count == 0)
return TRUE;
@@ -867,7 +876,14 @@ _bfd_generic_get_section_contents_in_window
sz = section->rawsize;
else
sz = section->size;
+ filesz = bfd_get_file_size (abfd);
+ if (filesz < 0)
+ {
+ /* This should never happen. */
+ abort ();
+ }
if (offset + count > sz
+ || (section->filepos + offset + sz) > (bfd_size_type) filesz
|| ! bfd_get_file_window (abfd, section->filepos + offset, count, w,
TRUE))
return FALSE;
diff --git a/bfd/libbfd.h b/bfd/libbfd.h
index 7e58598..09df3b2 100644
--- a/bfd/libbfd.h
+++ b/bfd/libbfd.h
@@ -520,6 +520,9 @@ extern bfd_boolean _bfd_generic_set_section_contents
#define _bfd_nolink_bfd_define_common_symbol \
((bfd_boolean (*) (bfd *, struct bfd_link_info *, \
struct bfd_link_hash_entry *)) bfd_false)
+#define _bfd_nolink_bfd_define_start_stop \
+ ((struct bfd_link_hash_entry * (*) (struct bfd_link_info *, \
+ const char *, asection *)) bfd_nullvoidptr)
#define _bfd_nolink_bfd_link_check_relocs \
_bfd_generic_link_check_relocs
diff --git a/bfd/libieee.h b/bfd/libieee.h
index ace4ed3..8a07248 100644
--- a/bfd/libieee.h
+++ b/bfd/libieee.h
@@ -64,6 +64,7 @@ typedef struct ieee_per_section
typedef struct {
unsigned char *input_p;
+ unsigned char *end_p;
unsigned char *first_byte;
unsigned char *last_byte;
bfd_size_type total_amt;
diff --git a/bfd/linker.c b/bfd/linker.c
index 9861259..72d5705 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -2091,7 +2091,7 @@ _bfd_generic_link_output_symbols (bfd *output_bfd,
&& bfd_hash_lookup (info->keep_hash, bfd_asymbol_name (sym),
FALSE, FALSE) == NULL))
output = FALSE;
- else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
+ else if ((sym->flags & (BSF_GLOBAL | BSF_WEAK | BSF_GNU_UNIQUE)) != 0)
{
/* If this symbol is marked as occurring now, rather
than at the end, output it now. This is used for
@@ -3097,6 +3097,43 @@ bfd_generic_define_common_symbol (bfd *output_bfd,
/*
FUNCTION
+ bfd_generic_define_start_stop
+
+SYNOPSIS
+ struct bfd_link_hash_entry *bfd_generic_define_start_stop
+ (struct bfd_link_info *info,
+ const char *symbol, asection *sec);
+
+DESCRIPTION
+ Define a __start, __stop, .startof. or .sizeof. symbol.
+ Return the symbol or NULL if no such undefined symbol exists.
+
+.#define bfd_define_start_stop(output_bfd, info, symbol, sec) \
+. BFD_SEND (output_bfd, _bfd_define_start_stop, (info, symbol, sec))
+.
+*/
+
+struct bfd_link_hash_entry *
+bfd_generic_define_start_stop (struct bfd_link_info *info,
+ const char *symbol, asection *sec)
+{
+ struct bfd_link_hash_entry *h;
+
+ h = bfd_link_hash_lookup (info->hash, symbol, FALSE, FALSE, TRUE);
+ if (h != NULL
+ && (h->type == bfd_link_hash_undefined
+ || h->type == bfd_link_hash_undefweak))
+ {
+ h->type = bfd_link_hash_defined;
+ h->u.def.section = sec;
+ h->u.def.value = 0;
+ return h;
+ }
+ return NULL;
+}
+
+/*
+FUNCTION
bfd_find_version_for_sym
SYNOPSIS
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index c25a743..9c01df8 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -55,6 +55,7 @@
#define bfd_mach_o_bfd_discard_group bfd_generic_discard_group
#define bfd_mach_o_section_already_linked _bfd_generic_section_already_linked
#define bfd_mach_o_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define bfd_mach_o_bfd_define_start_stop bfd_generic_define_start_stop
#define bfd_mach_o_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
#define bfd_mach_o_core_file_matches_executable_p generic_core_file_matches_executable_p
#define bfd_mach_o_core_file_pid _bfd_nocore_core_file_pid
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 6b2772b..99a591b 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3320,6 +3320,7 @@ mmo_write_object_contents (bfd *abfd)
#define mmo_section_already_linked \
_bfd_generic_section_already_linked
#define mmo_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define mmo_bfd_define_start_stop bfd_generic_define_start_stop
/* We want to copy time of creation, otherwise we'd use
BFD_JUMP_TABLE_COPY (_bfd_generic). */
diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h
index 872ee32..4dadb33 100644
--- a/bfd/nlm-target.h
+++ b/bfd/nlm-target.h
@@ -53,6 +53,7 @@
#define nlm_bfd_discard_group bfd_generic_discard_group
#define nlm_section_already_linked _bfd_generic_section_already_linked
#define nlm_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define nlm_bfd_define_start_stop bfd_generic_define_start_stop
#define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define nlm_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/oasys.c b/bfd/oasys.c
index defb25a..efe0d7c 100644
--- a/bfd/oasys.c
+++ b/bfd/oasys.c
@@ -1186,6 +1186,7 @@ oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define oasys_bfd_discard_group bfd_generic_discard_group
#define oasys_section_already_linked _bfd_generic_section_already_linked
#define oasys_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define oasys_bfd_define_start_stop bfd_generic_define_start_stop
#define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define oasys_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define oasys_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 994b950..913341c 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -1825,6 +1825,7 @@ get_build_id (bfd *abfd)
Elf_External_Note *enote;
bfd_byte *contents;
asection *sect;
+ bfd_size_type size;
BFD_ASSERT (abfd);
@@ -1839,8 +1840,9 @@ get_build_id (bfd *abfd)
return NULL;
}
+ size = bfd_get_section_size (sect);
/* FIXME: Should we support smaller build-id notes ? */
- if (bfd_get_section_size (sect) < 0x24)
+ if (size < 0x24)
{
bfd_set_error (bfd_error_invalid_operation);
return NULL;
@@ -1853,6 +1855,17 @@ get_build_id (bfd *abfd)
return NULL;
}
+ /* FIXME: Paranoia - allow for compressed build-id sections.
+ Maybe we should complain if this size is different from
+ the one obtained above... */
+ size = bfd_get_section_size (sect);
+ if (size < sizeof (Elf_External_Note))
+ {
+ bfd_set_error (bfd_error_invalid_operation);
+ free (contents);
+ return NULL;
+ }
+
enote = (Elf_External_Note *) contents;
inote.type = H_GET_32 (abfd, enote->type);
inote.namesz = H_GET_32 (abfd, enote->namesz);
@@ -1864,7 +1877,8 @@ get_build_id (bfd *abfd)
if (inote.descsz == 0
|| inote.type != NT_GNU_BUILD_ID
|| inote.namesz != 4 /* sizeof "GNU" */
- || strcmp (inote.namedata, "GNU") != 0)
+ || strncmp (inote.namedata, "GNU", 4) != 0
+ || size < (12 + BFD_ALIGN (inote.namesz, 4) + inote.descsz))
{
free (contents);
bfd_set_error (bfd_error_invalid_operation);
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 27a75b3..a18e0b2 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -1432,6 +1432,11 @@ pe_print_idata (bfd * abfd, void * vfile)
bfd_size_type maxlen = (char *)(data + datasize) - dll - 1;
fprintf (file, _("\n\tDLL Name: %.*s\n"), (int) maxlen, dll);
+ /* PR 21546: When the Hint Address is zero,
+ we try the First Thunk instead. */
+ if (hint_addr == 0)
+ hint_addr = first_thunk;
+
if (hint_addr != 0)
{
bfd_byte *ft_data;
diff --git a/bfd/pef.c b/bfd/pef.c
index 5f64d44..7f03d17 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -59,6 +59,7 @@
#define bfd_pef_bfd_discard_group bfd_generic_discard_group
#define bfd_pef_section_already_linked _bfd_generic_section_already_linked
#define bfd_pef_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define bfd_pef_bfd_define_start_stop bfd_generic_define_start_stop
#define bfd_pef_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define bfd_pef_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define bfd_pef_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 1c8c3fb..af50be1 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -105,6 +105,7 @@ dlerror (void)
#define bfd_plugin_bfd_discard_group bfd_generic_discard_group
#define bfd_plugin_section_already_linked _bfd_generic_section_already_linked
#define bfd_plugin_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define bfd_plugin_bfd_define_start_stop bfd_generic_define_start_stop
#define bfd_plugin_bfd_copy_link_hash_symbol_type _bfd_generic_copy_link_hash_symbol_type
#define bfd_plugin_bfd_link_check_relocs _bfd_generic_link_check_relocs
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index e27e915..a0f9621 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -461,6 +461,7 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg)
#define ppcboot_section_already_linked \
_bfd_generic_section_already_linked
#define ppcboot_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define ppcboot_bfd_define_start_stop bfd_generic_define_start_stop
#define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define ppcboot_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define ppcboot_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 8dedfe8..024056f 100644
--- a/bfd/reloc.c
+++ b/bfd/reloc.c
@@ -7120,13 +7120,13 @@ ENUM
ENUMDOC
Unsigned 12 bit byte offset for 64 bit load/store from the page of
the GOT entry for this symbol. Used in conjunction with
- BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in LP64 ABI only.
+ BFD_RELOC_AARCH64_ADR_GOT_PAGE. Valid in LP64 ABI only.
ENUM
BFD_RELOC_AARCH64_LD32_GOT_LO12_NC
ENUMDOC
Unsigned 12 bit byte offset for 32 bit load/store from the page of
the GOT entry for this symbol. Used in conjunction with
- BFD_RELOC_AARCH64_ADR_GOTPAGE. Valid in ILP32 ABI only.
+ BFD_RELOC_AARCH64_ADR_GOT_PAGE. Valid in ILP32 ABI only.
ENUM
BFD_RELOC_AARCH64_MOVW_GOTOFF_G0_NC
ENUMDOC
@@ -8126,6 +8126,9 @@ bfd_generic_get_relocated_section_contents (bfd *abfd,
if (!bfd_get_full_section_contents (input_bfd, input_section, &data))
return NULL;
+ if (data == NULL)
+ return NULL;
+
if (reloc_size == 0)
return data;
diff --git a/bfd/som.c b/bfd/som.c
index 496040c..98c4124 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -2083,8 +2083,8 @@ setup_sections (bfd *abfd,
/* First, read in space names. */
amt = file_hdr->space_strings_size;
- space_strings = bfd_malloc (amt);
- if (!space_strings && amt != 0)
+ space_strings = bfd_malloc (amt + 1);
+ if (space_strings == NULL && amt != 0)
goto error_return;
if (bfd_seek (abfd, current_offset + file_hdr->space_strings_location,
@@ -2092,6 +2092,8 @@ setup_sections (bfd *abfd,
goto error_return;
if (bfd_bread (space_strings, amt, abfd) != amt)
goto error_return;
+ /* Make sure that the string table is NUL terminated. */
+ space_strings[amt] = 0;
/* Loop over all of the space dictionaries, building up sections. */
for (space_index = 0; space_index < file_hdr->space_total; space_index++)
@@ -2119,6 +2121,9 @@ setup_sections (bfd *abfd,
som_swap_space_dictionary_in (&ext_space, &space);
/* Setup the space name string. */
+ if (space.name >= file_hdr->space_strings_size)
+ goto error_return;
+
space_name = space.name + space_strings;
/* Make a section out of it. */
@@ -6754,6 +6759,7 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
#define som_bfd_discard_group bfd_generic_discard_group
#define som_section_already_linked _bfd_generic_section_already_linked
#define som_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define som_bfd_define_start_stop bfd_generic_define_start_stop
#define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
#define som_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
diff --git a/bfd/srec.c b/bfd/srec.c
index 6d9b9a4..d7b240d 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1278,6 +1278,7 @@ srec_print_symbol (bfd *abfd,
#define srec_bfd_discard_group bfd_generic_discard_group
#define srec_section_already_linked _bfd_generic_section_already_linked
#define srec_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define srec_bfd_define_start_stop bfd_generic_define_start_stop
#define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define srec_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define srec_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/targets.c b/bfd/targets.c
index 2f3ea13..05224c4 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -462,7 +462,8 @@ BFD_JUMP_TABLE macros.
. NAME##_bfd_is_group_section, \
. NAME##_bfd_discard_group, \
. NAME##_section_already_linked, \
-. NAME##_bfd_define_common_symbol
+. NAME##_bfd_define_common_symbol, \
+. NAME##_bfd_define_start_stop
.
. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
. bfd_byte * (*_bfd_get_relocated_section_contents)
@@ -526,6 +527,11 @@ BFD_JUMP_TABLE macros.
. bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *,
. struct bfd_link_hash_entry *);
.
+. {* Define a __start, __stop, .startof. or .sizeof. symbol. *}
+. struct bfd_link_hash_entry *(*_bfd_define_start_stop) (struct bfd_link_info *,
+. const char *,
+. asection *);
+.
. {* Routines to handle dynamic symbols and relocs. *}
.#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
. NAME##_get_dynamic_symtab_upper_bound, \
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index bbc2ccd..cfa75d5 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -273,6 +273,9 @@ getvalue (char **srcp, bfd_vma *valuep, char * endp)
bfd_vma value = 0;
unsigned int len;
+ if (src >= endp)
+ return FALSE;
+
if (!ISHEX (*src))
return FALSE;
@@ -514,9 +517,10 @@ pass_over (bfd *abfd, bfd_boolean (*func) (bfd *, int, char *, char *))
/* To the front of the file. */
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
return FALSE;
+
while (! is_eof)
{
- char src[MAXCHUNK];
+ static char src[MAXCHUNK];
char type;
/* Find first '%'. */
@@ -977,6 +981,7 @@ tekhex_print_symbol (bfd *abfd,
#define tekhex_bfd_discard_group bfd_generic_discard_group
#define tekhex_section_already_linked _bfd_generic_section_already_linked
#define tekhex_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define tekhex_bfd_define_start_stop bfd_generic_define_start_stop
#define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define tekhex_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define tekhex_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/versados.c b/bfd/versados.c
index 2efbcff..d9ede27 100644
--- a/bfd/versados.c
+++ b/bfd/versados.c
@@ -149,7 +149,7 @@ versados_mkobject (bfd *abfd)
if (abfd->tdata.versados_data == NULL)
{
bfd_size_type amt = sizeof (tdata_type);
- tdata_type *tdata = bfd_alloc (abfd, amt);
+ tdata_type *tdata = bfd_zalloc (abfd, amt);
if (tdata == NULL)
return FALSE;
@@ -345,13 +345,13 @@ reloc_howto_type versados_howto_table[] =
};
static int
-get_offset (int len, unsigned char *ptr)
+get_offset (unsigned int len, unsigned char *ptr)
{
int val = 0;
if (len)
{
- int i;
+ unsigned int i;
val = *ptr++;
if (val & 0x80)
@@ -394,9 +394,13 @@ process_otr (bfd *abfd, struct ext_otr *otr, int pass)
int flag = *srcp++;
int esdids = (flag >> 5) & 0x7;
int sizeinwords = ((flag >> 3) & 1) ? 2 : 1;
- int offsetlen = flag & 0x7;
+ unsigned int offsetlen = flag & 0x7;
int j;
+ /* PR 21591: Check for invalid lengths. */
+ if (srcp + esdids + offsetlen >= endp)
+ return;
+
if (esdids == 0)
{
/* A zero esdid means the new pc is the offset given. */
@@ -867,6 +871,7 @@ versados_canonicalize_reloc (bfd *abfd,
#define versados_bfd_discard_group bfd_generic_discard_group
#define versados_section_already_linked _bfd_generic_section_already_linked
#define versados_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define versados_bfd_define_start_stop bfd_generic_define_start_stop
#define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define versados_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define versados_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/bfd/version.h b/bfd/version.h
index 2f6bdbf..30db890 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -1,4 +1,4 @@
-#define BFD_VERSION_DATE 20170531
+#define BFD_VERSION_DATE 20170626
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index a321aff..a2cfa33 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -521,8 +521,10 @@ _bfd_vms_slurp_eisd (bfd *abfd, unsigned int offset)
asection *section;
flagword bfd_flags;
- /* PR 17512: file: 3d9e9fe9. */
- if (offset >= PRIV (recrd.rec_size))
+ /* PR 17512: file: 3d9e9fe9.
+ 12 is the offset of the eisdsize field from the start of the record (8)
+ plus the size of the eisdsize field (4). */
+ if (offset >= PRIV (recrd.rec_size) - 12)
return FALSE;
eisd = (struct vms_eisd *)(PRIV (recrd.rec) + offset);
rec_size = bfd_getl32 (eisd->eisdsize);
@@ -535,8 +537,16 @@ _bfd_vms_slurp_eisd (bfd *abfd, unsigned int offset)
offset = (offset + VMS_BLOCK_SIZE) & ~(VMS_BLOCK_SIZE - 1);
continue;
}
- else
- offset += rec_size;
+
+ /* Make sure that there is enough data present in the record. */
+ /* FIXME: Should we use sizeof (struct vms_eisd) rather than just 32 here ? */
+ if (rec_size < 32)
+ return FALSE;
+ /* Make sure that the record is not too big either. */
+ if (offset + rec_size >= PRIV (recrd.rec_size))
+ return FALSE;
+
+ offset += rec_size;
size = bfd_getl32 (eisd->secsize);
vaddr = bfd_getl64 (eisd->virt_addr);
@@ -574,7 +584,13 @@ _bfd_vms_slurp_eisd (bfd *abfd, unsigned int offset)
if (flags & EISD__M_GBL)
{
- name = _bfd_vms_save_counted_string (eisd->gblnam);
+ if (rec_size < offsetof (struct vms_eisd, gblnam))
+ return FALSE;
+ else if (rec_size < sizeof (struct vms_eisd))
+ name = _bfd_vms_save_counted_string (eisd->gblnam,
+ rec_size - offsetof (struct vms_eisd, gblnam));
+ else
+ name = _bfd_vms_save_counted_string (eisd->gblnam, EISD__K_GBLNAMLEN);
bfd_flags |= SEC_COFF_SHARED_LIBRARY;
bfd_flags &= ~(SEC_ALLOC | SEC_LOAD);
}
@@ -622,14 +638,29 @@ static bfd_boolean
_bfd_vms_slurp_eihs (bfd *abfd, unsigned int offset)
{
unsigned char *p = PRIV (recrd.rec) + offset;
- unsigned int gstvbn = bfd_getl32 (p + EIHS__L_GSTVBN);
- unsigned int gstsize ATTRIBUTE_UNUSED = bfd_getl32 (p + EIHS__L_GSTSIZE);
- unsigned int dstvbn = bfd_getl32 (p + EIHS__L_DSTVBN);
- unsigned int dstsize = bfd_getl32 (p + EIHS__L_DSTSIZE);
- unsigned int dmtvbn = bfd_getl32 (p + EIHS__L_DMTVBN);
- unsigned int dmtbytes = bfd_getl32 (p + EIHS__L_DMTBYTES);
+ unsigned int gstvbn;
+ unsigned int gstsize ATTRIBUTE_UNUSED;
+ unsigned int dstvbn;
+ unsigned int dstsize;
+ unsigned int dmtvbn;
+ unsigned int dmtbytes;
asection *section;
+ /* PR 21611: Check that offset is valid. */
+ if (offset > PRIV (recrd.rec_size) - (EIHS__L_DMTBYTES + 4))
+ {
+ _bfd_error_handler (_("Unable to read EIHS record at offset %#x"), offset);
+ bfd_set_error (bfd_error_file_truncated);
+ return FALSE;
+ }
+
+ gstvbn = bfd_getl32 (p + EIHS__L_GSTVBN);
+ gstsize = bfd_getl32 (p + EIHS__L_GSTSIZE);
+ dstvbn = bfd_getl32 (p + EIHS__L_DSTVBN);
+ dstsize = bfd_getl32 (p + EIHS__L_DSTSIZE);
+ dmtvbn = bfd_getl32 (p + EIHS__L_DMTVBN);
+ dmtbytes = bfd_getl32 (p + EIHS__L_DMTBYTES);
+
#if VMS_DEBUG
vms_debug (8, "_bfd_vms_slurp_ihs\n");
vms_debug (4, "EIHS record gstvbn %d gstsize %d dstvbn %d dstsize %d dmtvbn %d dmtbytes %d\n",
@@ -864,7 +895,7 @@ _bfd_vms_slurp_ehdr (bfd *abfd)
vms_rec = PRIV (recrd.rec);
/* PR 17512: file: 62736583. */
- end = PRIV (recrd.buf) + PRIV (recrd.buf_size);
+ end = vms_rec + PRIV (recrd.buf_size);
vms_debug2 ((2, "HDR/EMH\n"));
@@ -884,11 +915,11 @@ _bfd_vms_slurp_ehdr (bfd *abfd)
PRIV (hdr_data).hdr_l_recsiz = bfd_getl32 (vms_rec + 16);
if ((vms_rec + 20 + vms_rec[20] + 1) >= end)
goto fail;
- PRIV (hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 20);
+ PRIV (hdr_data).hdr_t_name = _bfd_vms_save_counted_string (vms_rec + 20, vms_rec[20]);
ptr = vms_rec + 20 + vms_rec[20] + 1;
if ((ptr + *ptr + 1) >= end)
goto fail;
- PRIV (hdr_data).hdr_t_version =_bfd_vms_save_counted_string (ptr);
+ PRIV (hdr_data).hdr_t_version =_bfd_vms_save_counted_string (ptr, *ptr);
ptr += *ptr + 1;
if (ptr + 17 >= end)
goto fail;
@@ -1121,19 +1152,28 @@ add_symbol (bfd *abfd, const unsigned char *ascic)
static bfd_boolean
_bfd_vms_slurp_egsd (bfd *abfd)
{
- int gsd_type, gsd_size;
+ int gsd_type;
+ unsigned int gsd_size;
unsigned char *vms_rec;
unsigned long base_addr;
vms_debug2 ((2, "EGSD\n"));
+ if (PRIV (recrd.rec_size) < 8)
+ {
+ _bfd_error_handler (_("Corrupt EGSD record: its size (%#x) is too small"),
+ PRIV (recrd.rec_size));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
PRIV (recrd.rec) += 8; /* Skip type, size, align pad. */
PRIV (recrd.rec_size) -= 8;
/* Calculate base address for each section. */
base_addr = 0L;
- while (PRIV (recrd.rec_size) > 0)
+ while (PRIV (recrd.rec_size) > 4)
{
vms_rec = PRIV (recrd.rec);
@@ -1142,6 +1182,23 @@ _bfd_vms_slurp_egsd (bfd *abfd)
vms_debug2 ((3, "egsd_type %d\n", gsd_type));
+ /* PR 21615: Check for size overflow. */
+ if (PRIV (recrd.rec_size) < gsd_size)
+ {
+ _bfd_error_handler (_("Corrupt EGSD record: size (%#x) is larger than remaining space (%#x)"),
+ gsd_size, PRIV (recrd.rec_size));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
+ if (gsd_size < 4)
+ {
+ _bfd_error_handler (_("Corrupt EGSD record: size (%#x) is too small"),
+ gsd_size);
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
switch (gsd_type)
{
case EGSD__C_PSC:
@@ -1164,7 +1221,7 @@ _bfd_vms_slurp_egsd (bfd *abfd)
char *name;
unsigned long align_addr;
- name = _bfd_vms_save_counted_string (&egps->namlng);
+ name = _bfd_vms_save_counted_string (&egps->namlng, gsd_size - 4);
section = bfd_make_section (abfd, name);
if (!section)
@@ -1257,6 +1314,8 @@ _bfd_vms_slurp_egsd (bfd *abfd)
struct vms_esdf *esdf = (struct vms_esdf *)vms_rec;
entry->value = bfd_getl64 (esdf->value);
+ if (PRIV (sections) == NULL)
+ return FALSE;
entry->section = PRIV (sections)[bfd_getl32 (esdf->psindx)];
if (old_flags & EGSY__V_NORM)
@@ -1291,7 +1350,11 @@ _bfd_vms_slurp_egsd (bfd *abfd)
entry->symbol_vector = bfd_getl32 (egst->value);
if (old_flags & EGSY__V_REL)
- entry->section = PRIV (sections)[bfd_getl32 (egst->psindx)];
+ {
+ if (PRIV (sections) == NULL)
+ return FALSE;
+ entry->section = PRIV (sections)[bfd_getl32 (egst->psindx)];
+ }
else
entry->section = bfd_abs_section_ptr;
@@ -1323,6 +1386,8 @@ _bfd_vms_slurp_egsd (bfd *abfd)
PRIV (recrd.rec) += gsd_size;
}
+ /* FIXME: Should we complain if PRIV (recrd.rec_size) is not zero ? */
+
if (PRIV (gsd_sym_count) > 0)
abfd->flags |= HAS_SYMS;
@@ -1379,6 +1444,8 @@ image_set_ptr (bfd *abfd, bfd_vma vma, int sect, struct bfd_link_info *info)
vms_debug2 ((4, "image_set_ptr (0x%08x, sect=%d)\n", (unsigned)vma, sect));
+ if (PRIV (sections) == NULL)
+ return;
sec = PRIV (sections)[sect];
if (info)
@@ -1456,7 +1523,7 @@ dst_retrieve_location (bfd *abfd, unsigned int loc)
/* Write multiple bytes to section image. */
static bfd_boolean
-image_write (bfd *abfd, unsigned char *ptr, int size)
+image_write (bfd *abfd, unsigned char *ptr, unsigned int size)
{
#if VMS_DEBUG
_bfd_vms_debug (8, "image_write from (%p, %d) to (%ld)\n", ptr, size,
@@ -1603,14 +1670,16 @@ _bfd_vms_etir_name (int cmd)
#define HIGHBIT(op) ((op & 0x80000000L) == 0x80000000L)
static void
-_bfd_vms_get_value (bfd *abfd, const unsigned char *ascic,
+_bfd_vms_get_value (bfd *abfd,
+ const unsigned char *ascic,
+ const unsigned char *max_ascic,
struct bfd_link_info *info,
bfd_vma *vma,
struct alpha_vms_link_hash_entry **hp)
{
char name[257];
- int len;
- int i;
+ unsigned int len;
+ unsigned int i;
struct alpha_vms_link_hash_entry *h;
/* Not linking. Do not try to resolve the symbol. */
@@ -1622,6 +1691,14 @@ _bfd_vms_get_value (bfd *abfd, const unsigned char *ascic,
}
len = *ascic;
+ if (ascic + len >= max_ascic)
+ {
+ _bfd_error_handler (_("Corrupt vms value"));
+ *vma = 0;
+ *hp = NULL;
+ return;
+ }
+
for (i = 0; i < len; i++)
name[i] = ascic[i + 1];
name[i] = 0;
@@ -1691,7 +1768,12 @@ static bfd_vma
alpha_vms_fix_sec_rel (bfd *abfd, struct bfd_link_info *info,
unsigned int rel, bfd_vma vma)
{
- asection *sec = PRIV (sections)[rel & RELC_MASK];
+ asection *sec;
+
+ if (PRIV (sections) == NULL)
+ return 0;
+
+ sec = PRIV (sections)[rel & RELC_MASK];
if (info)
{
@@ -1735,6 +1817,15 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
ptr += 4;
+ /* PR 21589 and 21579: Check for a corrupt ETIR record. */
+ if (cmd_length < 4 || (ptr + cmd_length > maxptr + 4))
+ {
+ corrupt_etir:
+ _bfd_error_handler (_("Corrupt ETIR record encountered"));
+ bfd_set_error (bfd_error_bad_value);
+ return FALSE;
+ }
+
#if VMS_DEBUG
_bfd_vms_debug (4, "etir: %s(%d)\n",
_bfd_vms_etir_name (cmd), cmd);
@@ -1748,7 +1839,7 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
stack 32 bit value of symbol (high bits set to 0). */
case ETIR__C_STA_GBL:
- _bfd_vms_get_value (abfd, ptr, info, &op1, &h);
+ _bfd_vms_get_value (abfd, ptr, maxptr, info, &op1, &h);
_bfd_vms_push (abfd, op1, alpha_vms_sym_to_ctxt (h));
break;
@@ -1757,6 +1848,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
stack 32 bit value, sign extend to 64 bit. */
case ETIR__C_STA_LW:
+ if (ptr + 4 >= maxptr)
+ goto corrupt_etir;
_bfd_vms_push (abfd, bfd_getl32 (ptr), RELC_NONE);
break;
@@ -1765,6 +1858,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
stack 64 bit value of symbol. */
case ETIR__C_STA_QW:
+ if (ptr + 8 >= maxptr)
+ goto corrupt_etir;
_bfd_vms_push (abfd, bfd_getl64 (ptr), RELC_NONE);
break;
@@ -1778,6 +1873,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
{
int psect;
+ if (ptr + 12 >= maxptr)
+ goto corrupt_etir;
psect = bfd_getl32 (ptr);
if ((unsigned int) psect >= PRIV (section_count))
{
@@ -1867,6 +1964,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
{
int size;
+ if (ptr + 4 >= maxptr)
+ goto corrupt_etir;
size = bfd_getl32 (ptr);
_bfd_vms_pop (abfd, &op1, &rel1);
if (rel1 != RELC_NONE)
@@ -1879,7 +1978,7 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
/* Store global: write symbol value
arg: cs global symbol name. */
case ETIR__C_STO_GBL:
- _bfd_vms_get_value (abfd, ptr, info, &op1, &h);
+ _bfd_vms_get_value (abfd, ptr, maxptr, info, &op1, &h);
if (h && h->sym)
{
if (h->sym->typ == EGSD__C_SYMG)
@@ -1901,7 +2000,7 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
/* Store code address: write address of entry point
arg: cs global symbol name (procedure). */
case ETIR__C_STO_CA:
- _bfd_vms_get_value (abfd, ptr, info, &op1, &h);
+ _bfd_vms_get_value (abfd, ptr, maxptr, info, &op1, &h);
if (h && h->sym)
{
if (h->sym->flags & EGSY__V_NORM)
@@ -1946,8 +2045,10 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
da data. */
case ETIR__C_STO_IMM:
{
- int size;
+ unsigned int size;
+ if (ptr + 4 >= maxptr)
+ goto corrupt_etir;
size = bfd_getl32 (ptr);
image_write (abfd, ptr + 4, size);
}
@@ -1960,7 +2061,7 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
store global longword: store 32bit value of symbol
arg: cs symbol name. */
case ETIR__C_STO_GBL_LW:
- _bfd_vms_get_value (abfd, ptr, info, &op1, &h);
+ _bfd_vms_get_value (abfd, ptr, maxptr, info, &op1, &h);
#if 0
abort ();
#endif
@@ -2013,7 +2114,7 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
da signature. */
case ETIR__C_STC_LP_PSB:
- _bfd_vms_get_value (abfd, ptr + 4, info, &op1, &h);
+ _bfd_vms_get_value (abfd, ptr + 4, maxptr, info, &op1, &h);
if (h && h->sym)
{
if (h->sym->typ == EGSD__C_SYMG)
@@ -2109,6 +2210,8 @@ _bfd_vms_slurp_etir (bfd *abfd, struct bfd_link_info *info)
/* Augment relocation base: increment image location counter by offset
arg: lw offset value. */
case ETIR__C_CTL_AUGRB:
+ if (ptr + 4 >= maxptr)
+ goto corrupt_etir;
op1 = bfd_getl32 (ptr);
image_inc_ptr (abfd, op1);
break;
@@ -4044,7 +4147,8 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
{
case DST__K_MODBEG:
module->name
- = _bfd_vms_save_counted_string (ptr + DST_S_B_MODBEG_NAME);
+ = _bfd_vms_save_counted_string (ptr + DST_S_B_MODBEG_NAME,
+ maxptr - (ptr + DST_S_B_MODBEG_NAME));
curr_pc = 0;
prev_pc = 0;
@@ -4061,7 +4165,8 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
funcinfo = (struct funcinfo *)
bfd_zalloc (abfd, sizeof (struct funcinfo));
funcinfo->name
- = _bfd_vms_save_counted_string (ptr + DST_S_B_RTNBEG_NAME);
+ = _bfd_vms_save_counted_string (ptr + DST_S_B_RTNBEG_NAME,
+ maxptr - (ptr + DST_S_B_RTNBEG_NAME));
funcinfo->low = bfd_getl32 (ptr + DST_S_L_RTNBEG_ADDRESS);
funcinfo->next = module->func_table;
module->func_table = funcinfo;
@@ -4112,8 +4217,10 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
unsigned int fileid
= bfd_getl16 (src_ptr + DST_S_W_SRC_DF_FILEID);
char *filename
- = _bfd_vms_save_counted_string (src_ptr
- + DST_S_B_SRC_DF_FILENAME);
+ = _bfd_vms_save_counted_string (src_ptr + DST_S_B_SRC_DF_FILENAME,
+ (ptr + rec_length) -
+ (src_ptr + DST_S_B_SRC_DF_FILENAME)
+ );
while (fileid >= module->file_table_count)
{
@@ -5005,6 +5112,8 @@ alpha_vms_slurp_relocs (bfd *abfd)
return FALSE;
}
+ if (PRIV (sections) == NULL)
+ return FALSE;
sec = PRIV (sections)[cur_psect];
if (sec == bfd_abs_section_ptr)
{
@@ -5063,8 +5172,12 @@ alpha_vms_slurp_relocs (bfd *abfd)
reloc->sym_ptr_ptr = sym;
}
else if (cur_psidx >= 0)
- reloc->sym_ptr_ptr =
- PRIV (sections)[cur_psidx]->symbol_ptr_ptr;
+ {
+ if (PRIV (sections) == NULL)
+ return FALSE;
+ reloc->sym_ptr_ptr =
+ PRIV (sections)[cur_psidx]->symbol_ptr_ptr;
+ }
else
reloc->sym_ptr_ptr = NULL;
@@ -5578,6 +5691,13 @@ evax_bfd_print_emh (FILE *file, unsigned char *rec, unsigned int rec_len)
/* xgettext:c-format */
fprintf (file, _(" EMH %u (len=%u): "), subtype, rec_len);
+ /* PR 21618: Check for invalid lengths. */
+ if (rec_len < sizeof (* emh))
+ {
+ fprintf (file, _(" Error: The length is less than the length of an EMH record\n"));
+ return;
+ }
+
switch (subtype)
{
case EMH__C_MHD:
@@ -5641,6 +5761,14 @@ evax_bfd_print_eeom (FILE *file, unsigned char *rec, unsigned int rec_len)
struct vms_eeom *eeom = (struct vms_eeom *)rec;
fprintf (file, _(" EEOM (len=%u):\n"), rec_len);
+
+ /* PR 21618: Check for invalid lengths. */
+ if (rec_len < sizeof (* eeom))
+ {
+ fprintf (file, _(" Error: The length is less than the length of an EEOM record\n"));
+ return;
+ }
+
fprintf (file, _(" number of cond linkage pairs: %u\n"),
(unsigned)bfd_getl32 (eeom->total_lps));
fprintf (file, _(" completion code: %u\n"),
@@ -5730,6 +5858,12 @@ evax_bfd_print_egsd (FILE *file, unsigned char *rec, unsigned int rec_len)
n, type, len);
n++;
+ if (off + len > rec_len || off + len < off)
+ {
+ fprintf (file, _(" Error: length larger than remaining space in record\n"));
+ return;
+ }
+
switch (type)
{
case EGSD__C_PSC:
@@ -5975,6 +6109,12 @@ evax_bfd_print_etir (FILE *file, const char *name,
size = bfd_getl16 (etir->size);
buf = rec + off + sizeof (struct vms_etir);
+ if (off + size > rec_len || off + size < off)
+ {
+ fprintf (file, _(" Error: length larger than remaining space in record\n"));
+ return;
+ }
+
/* xgettext:c-format */
fprintf (file, _(" (type: %3u, size: 4+%3u): "), type, size - 4);
switch (type)
@@ -9280,6 +9420,7 @@ bfd_vms_get_data (bfd *abfd)
#define vms_bfd_discard_group bfd_generic_discard_group
#define vms_section_already_linked _bfd_generic_section_already_linked
#define vms_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define vms_bfd_define_start_stop bfd_generic_define_start_stop
#define vms_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
#define vms_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
@@ -9327,6 +9468,7 @@ bfd_vms_get_data (bfd *abfd)
_bfd_generic_section_already_linked
#define alpha_vms_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define alpha_vms_bfd_define_start_stop bfd_generic_define_start_stop
#define alpha_vms_bfd_link_just_syms _bfd_generic_link_just_syms
#define alpha_vms_bfd_copy_link_hash_symbol_type \
_bfd_generic_copy_link_hash_symbol_type
diff --git a/bfd/vms-misc.c b/bfd/vms-misc.c
index 40c6cc2..7497f02 100644
--- a/bfd/vms-misc.c
+++ b/bfd/vms-misc.c
@@ -139,7 +139,7 @@ _bfd_hexdump (int level, unsigned char *ptr, int size, int offset)
size is string size (size of record) */
char *
-_bfd_vms_save_sized_string (unsigned char *str, int size)
+_bfd_vms_save_sized_string (unsigned char *str, unsigned int size)
{
char *newstr = bfd_malloc ((bfd_size_type) size + 1);
@@ -155,10 +155,12 @@ _bfd_vms_save_sized_string (unsigned char *str, int size)
ptr points to size byte on entry */
char *
-_bfd_vms_save_counted_string (unsigned char *ptr)
+_bfd_vms_save_counted_string (unsigned char *ptr, unsigned int maxlen)
{
- int len = *ptr++;
+ unsigned int len = *ptr++;
+ if (len > maxlen)
+ return NULL;
return _bfd_vms_save_sized_string (ptr, len);
}
diff --git a/bfd/vms.h b/bfd/vms.h
index e1c5d83..230ff7f 100644
--- a/bfd/vms.h
+++ b/bfd/vms.h
@@ -118,8 +118,8 @@ extern void vms_time_t_to_vms_time (time_t ut, unsigned int *hi, unsigned int *l
extern void vms_get_time (unsigned int *hi, unsigned int *lo);
extern void vms_raw_get_time (unsigned char *buf);
-extern char * _bfd_vms_save_sized_string (unsigned char *, int);
-extern char * _bfd_vms_save_counted_string (unsigned char *);
+extern char * _bfd_vms_save_sized_string (unsigned char *, unsigned);
+extern char * _bfd_vms_save_counted_string (unsigned char *, unsigned);
extern void _bfd_vms_output_begin (struct vms_rec_wr *, int);
extern void _bfd_vms_output_alignment (struct vms_rec_wr *, int);
extern void _bfd_vms_output_begin_subrec (struct vms_rec_wr *, int);
diff --git a/bfd/xsym.c b/bfd/xsym.c
index 6a4a750..3160c10 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -51,6 +51,7 @@
#define bfd_sym_bfd_discard_group bfd_generic_discard_group
#define bfd_sym_section_already_linked _bfd_generic_section_already_linked
#define bfd_sym_bfd_define_common_symbol bfd_generic_define_common_symbol
+#define bfd_sym_bfd_define_start_stop bfd_generic_define_start_stop
#define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
#define bfd_sym_bfd_link_add_symbols _bfd_generic_link_add_symbols
#define bfd_sym_bfd_link_just_syms _bfd_generic_link_just_syms
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 1ecb042..af2a348 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,82 @@
+2017-06-26 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21665
+ * objdump.c (disassemble_section): Skip any section that is bigger
+ than the entire file.
+
+2017-06-26 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21659
+ * bucomm.c (get_file_size): Explicitly warn if the file is a
+ directory.
+
+2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * readelf.c (arm_attr_tag_CPU_arch): Fill value for ARMv8-R.
+
+2017-06-23 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21659
+ * strings.c (strings_file): Warn about attempts to run strings on
+ a directory.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * readelf.c (decode_x86_feature): Decode
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK.
+ * testsuite/binutils-all/i386/shstk.d: New file.
+ * testsuite/binutils-all/i386/shstk.s: Likewise.
+ * testsuite/binutils-all/x86-64/shstk-x32.d: Likewise.
+ * testsuite/binutils-all/x86-64/shstk.d: Likewise.
+ * testsuite/binutils-all/x86-64/shstk.s: Likewise.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * readelf.c (decode_x86_feature): New.
+ (print_gnu_property_note): Call decode_x86_feature on
+ GNU_PROPERTY_X86_FEATURE_1_AND.
+ * testsuite/binutils-all/i386/empty.d: New file.
+ * testsuite/binutils-all/i386/empty.s: Likewise.
+ * testsuite/binutils-all/i386/ibt.d: Likewise.
+ * testsuite/binutils-all/i386/ibt.s: Likewise.
+ * testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
+ * testsuite/binutils-all/x86-64/empty.d: Likewise.
+ * testsuite/binutils-all/x86-64/empty.s: Likewise.
+ * testsuite/binutils-all/x86-64/ibt-x32.d: Likewise.
+ * testsuite/binutils-all/x86-64/ibt.d: Likewise.
+ * testsuite/binutils-all/x86-64/ibt.s: Likewise.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * dwarf.c (READ_ULEB): Use DWARF_VMA_FMT to report error.
+ (READ_SLEB): Likewise.
+
+2017-06-21 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21648
+ * dwarf.c (LEB): Rename to SKIP_ULEB and READ_ULEB. Add check for
+ reading a value that is too big for the containing variable.
+ (SLEB): Rename to SKIP_SLEB and READ_SLEB. Add similar check.
+ Replace uses of LEB and SLEB with appropriate new macro.
+ (display_debug_frames): Use an unsigned int for the 'reg'
+ variable. Use a signed long for the 'l' variable.
+
+2017-06-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * readelf.c (get_s390_segment_type): Add support for the new
+ segment type PT_S390_PGSTE.
+ (get_segment_type): Call get_s390_segment_type.
+
+2017-06-19 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21619
+ * objdump.c (disassemble_bytes): Check that there is sufficient
+ data available before attempting to display it.
+
+2017-06-06 Simon Marchi <simon.marchi@ericsson.com>
+
+ * sysinfo.y: Free memory allocated by token NAME.
+
2017-05-30 Anton Kolesov <anton.kolesov@synopsys.com>
* doc/binutils.texi: Document new cpu=... disassembler options for ARC.
diff --git a/binutils/bucomm.c b/binutils/bucomm.c
index fd6f356..5a0b634 100644
--- a/binutils/bucomm.c
+++ b/binutils/bucomm.c
@@ -598,6 +598,8 @@ get_file_size (const char * file_name)
non_fatal (_("Warning: could not locate '%s'. reason: %s"),
file_name, strerror (errno));
}
+ else if (S_ISDIR (statbuf.st_mode))
+ non_fatal (_("Warning: '%s' is a directory"), file_name);
else if (! S_ISREG (statbuf.st_mode))
non_fatal (_("Warning: '%s' is not an ordinary file"), file_name);
else if (statbuf.st_size < 0)
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index cdedbb2..5195f8d 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -313,6 +313,35 @@ read_uleb128 (unsigned char * data,
return read_leb128 (data, length_return, FALSE, end);
}
+#define SKIP_ULEB() read_uleb128 (start, & length_return, end); start += length_return
+#define SKIP_SLEB() read_sleb128 (start, & length_return, end); start += length_return
+
+#define READ_ULEB(var) \
+ do \
+ { \
+ dwarf_vma _val; \
+ \
+ (var) = _val = read_uleb128 (start, &length_return, end); \
+ if ((var) != _val) \
+ error (_("Internal error: %s%d: LEB value (%#" DWARF_VMA_FMT "x) too large for containing variable\n"), \
+ __FILE__, __LINE__, _val); \
+ start += length_return; \
+ } \
+ while (0)
+
+#define READ_SLEB(var) \
+ do \
+ { \
+ dwarf_signed_vma _val; \
+ \
+ (var) = _val = read_sleb128 (start, &length_return, end); \
+ if ((var) != _val) \
+ error (_("Internal error: %s%d: LEB value (%#" DWARF_VMA_FMT "x) too large for containing variable\n"), \
+ __FILE__, __LINE__, _val); \
+ start += length_return; \
+ } \
+ while (0)
+
#define SAFE_BYTE_GET(VAL, PTR, AMOUNT, END) \
do \
{ \
@@ -6421,6 +6450,7 @@ static const char *
regname (unsigned int regno, int row)
{
static char reg[64];
+
if (dwarf_regnames
&& regno < dwarf_regnames_count
&& dwarf_regnames [regno] != NULL)
@@ -6509,8 +6539,6 @@ frame_display_row (Frame_Chunk *fc, int *need_col_headers, unsigned int *max_reg
}
#define GET(VAR, N) SAFE_BYTE_GET_AND_INC (VAR, start, N, end)
-#define LEB() read_uleb128 (start, & length_return, end); start += length_return
-#define SLEB() read_sleb128 (start, & length_return, end); start += length_return
static unsigned char *
read_cie (unsigned char *start, unsigned char *end,
@@ -6575,26 +6603,27 @@ read_cie (unsigned char *start, unsigned char *end,
fc->ptr_size = eh_addr_size;
fc->segment_size = 0;
}
- fc->code_factor = LEB ();
- fc->data_factor = SLEB ();
+ READ_ULEB (fc->code_factor);
+ READ_SLEB (fc->data_factor);
if (version == 1)
{
GET (fc->ra, 1);
}
else
{
- fc->ra = LEB ();
+ READ_ULEB (fc->ra);
}
if (fc->augmentation[0] == 'z')
{
- augmentation_data_len = LEB ();
+ READ_ULEB (augmentation_data_len);
augmentation_data = start;
start += augmentation_data_len;
/* PR 17512: file: 11042-2589-0.004. */
if (start > end)
{
- warn (_("Augmentation data too long: 0x%lx\n"), augmentation_data_len);
+ warn (_("Augmentation data too long: %#lx, expected at most %#lx\n"),
+ augmentation_data_len, (long)((end - start) + augmentation_data_len));
return end;
}
}
@@ -6929,7 +6958,7 @@ display_debug_frames (struct dwarf_section *section,
if (cie->augmentation[0] == 'z')
{
- augmentation_data_len = LEB ();
+ READ_ULEB (augmentation_data_len);
augmentation_data = start;
start += augmentation_data_len;
/* PR 17512: file: 722-8446-0.004. */
@@ -6999,7 +7028,7 @@ display_debug_frames (struct dwarf_section *section,
case DW_CFA_advance_loc:
break;
case DW_CFA_offset:
- LEB ();
+ SKIP_ULEB ();
if (frame_need_space (fc, opa) >= 0)
fc->col_type[opa] = DW_CFA_undefined;
break;
@@ -7021,41 +7050,44 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_offset_extended:
case DW_CFA_val_offset:
- reg = LEB (); LEB ();
+ READ_ULEB (reg);
+ SKIP_ULEB ();
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_restore_extended:
- reg = LEB ();
+ READ_ULEB (reg);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_undefined:
- reg = LEB ();
+ READ_ULEB (reg);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_same_value:
- reg = LEB ();
+ READ_ULEB (reg);
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_register:
- reg = LEB (); LEB ();
+ READ_ULEB (reg);
+ SKIP_ULEB ();
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_def_cfa:
- LEB (); LEB ();
+ SKIP_ULEB ();
+ SKIP_ULEB ();
break;
case DW_CFA_def_cfa_register:
- LEB ();
+ SKIP_ULEB ();
break;
case DW_CFA_def_cfa_offset:
- LEB ();
+ SKIP_ULEB ();
break;
case DW_CFA_def_cfa_expression:
- temp = LEB ();
+ READ_ULEB (temp);
new_start = start + temp;
if (new_start < start)
{
@@ -7067,8 +7099,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_expression:
case DW_CFA_val_expression:
- reg = LEB ();
- temp = LEB ();
+ READ_ULEB (reg);
+ READ_ULEB (temp);
new_start = start + temp;
if (new_start < start)
{
@@ -7083,24 +7115,27 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_offset_extended_sf:
case DW_CFA_val_offset_sf:
- reg = LEB (); SLEB ();
+ READ_ULEB (reg);
+ SKIP_SLEB ();
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
case DW_CFA_def_cfa_sf:
- LEB (); SLEB ();
+ SKIP_ULEB ();
+ SKIP_SLEB ();
break;
case DW_CFA_def_cfa_offset_sf:
- SLEB ();
+ SKIP_SLEB ();
break;
case DW_CFA_MIPS_advance_loc8:
start += 8;
break;
case DW_CFA_GNU_args_size:
- LEB ();
+ SKIP_ULEB ();
break;
case DW_CFA_GNU_negative_offset_extended:
- reg = LEB (); LEB ();
+ READ_ULEB (reg);
+ SKIP_ULEB ();
if (frame_need_space (fc, reg) >= 0)
fc->col_type[reg] = DW_CFA_undefined;
break;
@@ -7120,8 +7155,12 @@ display_debug_frames (struct dwarf_section *section,
{
unsigned char * tmp;
unsigned op, opa;
- unsigned long ul, reg, roffs;
- dwarf_vma l;
+ unsigned long ul, roffs;
+ /* Note: It is tempting to use an unsigned long for 'reg' but there
+ are various functions, notably frame_space_needed() that assume that
+ reg is an unsigned int. */
+ unsigned int reg;
+ dwarf_signed_vma l;
dwarf_vma ofs;
dwarf_vma vma;
const char *reg_prefix = "";
@@ -7152,7 +7191,7 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_offset:
- roffs = LEB ();
+ READ_ULEB (roffs);
if (opa >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7239,8 +7278,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_offset_extended:
- reg = LEB ();
- roffs = LEB ();
+ READ_ULEB (reg);
+ READ_ULEB (roffs);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7255,8 +7294,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_val_offset:
- reg = LEB ();
- roffs = LEB ();
+ READ_ULEB (reg);
+ READ_ULEB (roffs);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7271,7 +7310,7 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_restore_extended:
- reg = LEB ();
+ READ_ULEB (reg);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7293,7 +7332,7 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_undefined:
- reg = LEB ();
+ READ_ULEB (reg);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7307,7 +7346,7 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_same_value:
- reg = LEB ();
+ READ_ULEB (reg);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7321,8 +7360,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_register:
- reg = LEB ();
- roffs = LEB ();
+ READ_ULEB (reg);
+ READ_ULEB (roffs);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7385,8 +7424,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_def_cfa:
- fc->cfa_reg = LEB ();
- fc->cfa_offset = LEB ();
+ READ_SLEB (fc->cfa_reg);
+ READ_ULEB (fc->cfa_offset);
fc->cfa_exp = 0;
if (! do_debug_frames_interp)
printf (" DW_CFA_def_cfa: %s ofs %d\n",
@@ -7394,7 +7433,7 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_def_cfa_register:
- fc->cfa_reg = LEB ();
+ READ_SLEB (fc->cfa_reg);
fc->cfa_exp = 0;
if (! do_debug_frames_interp)
printf (" DW_CFA_def_cfa_register: %s\n",
@@ -7402,7 +7441,7 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_def_cfa_offset:
- fc->cfa_offset = LEB ();
+ READ_ULEB (fc->cfa_offset);
if (! do_debug_frames_interp)
printf (" DW_CFA_def_cfa_offset: %d\n", (int) fc->cfa_offset);
break;
@@ -7413,7 +7452,7 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_def_cfa_expression:
- ul = LEB ();
+ READ_ULEB (ul);
if (start >= block_end || ul > (unsigned long) (block_end - start))
{
printf (_(" DW_CFA_def_cfa_expression: <corrupt len %lu>\n"), ul);
@@ -7431,8 +7470,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_expression:
- reg = LEB ();
- ul = LEB ();
+ READ_ULEB (reg);
+ READ_ULEB (ul);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
/* PR 17512: file: 069-133014-0.006. */
@@ -7457,8 +7496,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_val_expression:
- reg = LEB ();
- ul = LEB ();
+ READ_ULEB (reg);
+ READ_ULEB (ul);
if (reg >= (unsigned int) fc->ncols)
reg_prefix = bad_reg;
tmp = start + ul;
@@ -7481,8 +7520,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_offset_extended_sf:
- reg = LEB ();
- l = SLEB ();
+ READ_ULEB (reg);
+ READ_SLEB (l);
if (frame_need_space (fc, reg) < 0)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7497,8 +7536,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_val_offset_sf:
- reg = LEB ();
- l = SLEB ();
+ READ_ULEB (reg);
+ READ_SLEB (l);
if (frame_need_space (fc, reg) < 0)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7513,8 +7552,8 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_def_cfa_sf:
- fc->cfa_reg = LEB ();
- fc->cfa_offset = SLEB ();
+ READ_SLEB (fc->cfa_reg);
+ READ_ULEB (fc->cfa_offset);
fc->cfa_offset = fc->cfa_offset * fc->data_factor;
fc->cfa_exp = 0;
if (! do_debug_frames_interp)
@@ -7523,7 +7562,7 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_def_cfa_offset_sf:
- fc->cfa_offset = SLEB ();
+ READ_ULEB (fc->cfa_offset);
fc->cfa_offset *= fc->data_factor;
if (! do_debug_frames_interp)
printf (" DW_CFA_def_cfa_offset_sf: %d\n", (int) fc->cfa_offset);
@@ -7548,14 +7587,15 @@ display_debug_frames (struct dwarf_section *section,
break;
case DW_CFA_GNU_args_size:
- ul = LEB ();
+ READ_ULEB (ul);
if (! do_debug_frames_interp)
printf (" DW_CFA_GNU_args_size: %ld\n", ul);
break;
case DW_CFA_GNU_negative_offset_extended:
- reg = LEB ();
- l = - LEB ();
+ READ_ULEB (reg);
+ READ_SLEB (l);
+ l = - l;
if (frame_need_space (fc, reg) < 0)
reg_prefix = bad_reg;
if (! do_debug_frames_interp || *reg_prefix != '\0')
@@ -7592,8 +7632,6 @@ display_debug_frames (struct dwarf_section *section,
}
#undef GET
-#undef LEB
-#undef SLEB
static int
display_gdb_index (struct dwarf_section *section,
diff --git a/binutils/objdump.c b/binutils/objdump.c
index 6dc8318..ed8c645 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -1918,20 +1918,23 @@ disassemble_bytes (struct disassemble_info * inf,
for (j = addr_offset * opb; j < addr_offset * opb + pb; j += bpc)
{
- int k;
-
- if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE)
- {
- for (k = bpc - 1; k >= 0; k--)
- printf ("%02x", (unsigned) data[j + k]);
- putchar (' ');
- }
- else
+ /* PR 21580: Check for a buffer ending early. */
+ if (j + bpc <= stop_offset * opb)
{
- for (k = 0; k < bpc; k++)
- printf ("%02x", (unsigned) data[j + k]);
- putchar (' ');
+ int k;
+
+ if (inf->display_endian == BFD_ENDIAN_LITTLE)
+ {
+ for (k = bpc - 1; k >= 0; k--)
+ printf ("%02x", (unsigned) data[j + k]);
+ }
+ else
+ {
+ for (k = 0; k < bpc; k++)
+ printf ("%02x", (unsigned) data[j + k]);
+ }
}
+ putchar (' ');
}
for (; pb < octets_per_line; pb += bpc)
@@ -1979,20 +1982,23 @@ disassemble_bytes (struct disassemble_info * inf,
pb = octets;
for (; j < addr_offset * opb + pb; j += bpc)
{
- int k;
-
- if (bpc > 1 && inf->display_endian == BFD_ENDIAN_LITTLE)
- {
- for (k = bpc - 1; k >= 0; k--)
- printf ("%02x", (unsigned) data[j + k]);
- putchar (' ');
- }
- else
+ /* PR 21619: Check for a buffer ending early. */
+ if (j + bpc <= stop_offset * opb)
{
- for (k = 0; k < bpc; k++)
- printf ("%02x", (unsigned) data[j + k]);
- putchar (' ');
+ int k;
+
+ if (inf->display_endian == BFD_ENDIAN_LITTLE)
+ {
+ for (k = bpc - 1; k >= 0; k--)
+ printf ("%02x", (unsigned) data[j + k]);
+ }
+ else
+ {
+ for (k = 0; k < bpc; k++)
+ printf ("%02x", (unsigned) data[j + k]);
+ }
}
+ putchar (' ');
}
}
}
@@ -2108,7 +2114,7 @@ disassemble_section (bfd *abfd, asection *section, void *inf)
return;
datasize = bfd_get_section_size (section);
- if (datasize == 0)
+ if (datasize == 0 || datasize >= (bfd_size_type) bfd_get_file_size (abfd))
return;
if (start_address == (bfd_vma) -1
@@ -2979,7 +2985,7 @@ dump_target_specific (bfd *abfd)
static void
dump_section (bfd *abfd, asection *section, void *dummy ATTRIBUTE_UNUSED)
{
- bfd_byte *data = 0;
+ bfd_byte *data = NULL;
bfd_size_type datasize;
bfd_vma addr_offset;
bfd_vma start_offset;
diff --git a/binutils/readelf.c b/binutils/readelf.c
index bb6bb79..916c6cb 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -3726,6 +3726,16 @@ get_arm_segment_type (unsigned long type)
}
static const char *
+get_s390_segment_type (unsigned long type)
+{
+ switch (type)
+ {
+ case PT_S390_PGSTE: return "S390_PGSTE";
+ default: return NULL;
+ }
+}
+
+static const char *
get_mips_segment_type (unsigned long type)
{
switch (type)
@@ -3858,6 +3868,10 @@ get_segment_type (unsigned long p_type)
case EM_TI_C6000:
result = get_tic6x_segment_type (p_type);
break;
+ case EM_S390:
+ case EM_S390_OLD:
+ result = get_s390_segment_type (p_type);
+ break;
default:
result = NULL;
break;
@@ -13698,7 +13712,7 @@ typedef struct
static const char * arm_attr_tag_CPU_arch[] =
{"Pre-v4", "v4", "v4T", "v5T", "v5TE", "v5TEJ", "v6", "v6KZ", "v6T2",
- "v6K", "v7", "v6-M", "v6S-M", "v7E-M", "v8", "", "v8-M.baseline",
+ "v6K", "v7", "v6-M", "v6S-M", "v7E-M", "v8", "v8-R", "v8-M.baseline",
"v8-M.mainline"};
static const char * arm_attr_tag_ARM_ISA_use[] = {"No", "Yes"};
static const char * arm_attr_tag_THUMB_ISA_use[] =
@@ -16338,6 +16352,47 @@ decode_x86_isa (unsigned int bitmask)
}
static void
+decode_x86_feature (unsigned int type, unsigned int bitmask)
+{
+ while (bitmask)
+ {
+ unsigned int bit = bitmask & (- bitmask);
+
+ bitmask &= ~ bit;
+ switch (bit)
+ {
+ case GNU_PROPERTY_X86_FEATURE_1_IBT:
+ switch (type)
+ {
+ case GNU_PROPERTY_X86_FEATURE_1_AND:
+ printf ("IBT");
+ break;
+ default:
+ /* This should never happen. */
+ abort ();
+ }
+ break;
+ case GNU_PROPERTY_X86_FEATURE_1_SHSTK:
+ switch (type)
+ {
+ case GNU_PROPERTY_X86_FEATURE_1_AND:
+ printf ("SHSTK");
+ break;
+ default:
+ /* This should never happen. */
+ abort ();
+ }
+ break;
+ default:
+ printf (_("<unknown: %x>"), bit);
+ break;
+ }
+ if (bitmask)
+ printf (", ");
+ }
+}
+
+static void
print_gnu_property_note (Elf_Internal_Note * pnote)
{
unsigned char * ptr = (unsigned char *) pnote->descdata;
@@ -16391,6 +16446,14 @@ print_gnu_property_note (Elf_Internal_Note * pnote)
decode_x86_isa (byte_get (ptr, 4));
goto next;
+ case GNU_PROPERTY_X86_FEATURE_1_AND:
+ printf ("x86 feature: ");
+ if (datasz != 4)
+ printf (_("<corrupt length: %#x> "), datasz);
+ else
+ decode_x86_feature (type, byte_get (ptr, 4));
+ goto next;
+
default:
break;
}
diff --git a/binutils/strings.c b/binutils/strings.c
index 13e2619..77d89eb 100644
--- a/binutils/strings.c
+++ b/binutils/strings.c
@@ -446,6 +446,11 @@ strings_file (char *file)
file, strerror (errno));
return FALSE;
}
+ else if (S_ISDIR (st.st_mode))
+ {
+ non_fatal (_("Warning: '%s' is a directory"), file);
+ return FALSE;
+ }
/* If we weren't told to scan the whole file,
try to open it as an object file and only look at
diff --git a/binutils/sysinfo.y b/binutils/sysinfo.y
index 62758de..1c8f1ff2 100644
--- a/binutils/sysinfo.y
+++ b/binutils/sysinfo.y
@@ -21,6 +21,7 @@
%{
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
static char writecode;
static char *it;
@@ -159,6 +160,8 @@ it:
case 'c':
printf("}\n");
}
+
+ free (it);
}
;
@@ -204,6 +207,8 @@ repeat_it_field: '(' REPEAT NAME
it_field_list ')'
{
+ free (repeat);
+
repeat = oldrepeat;
oldrepeat =0;
rdepth--;
@@ -230,6 +235,8 @@ cond_it_field: '(' COND NAME
printf("\tif (%s) {\n", $3);
break;
}
+
+ free ($3);
}
it_field_list ')'
@@ -348,6 +355,9 @@ char *ptr = pnames[rdepth];
else abort();
break;
}
+
+ free (desc);
+ free (id);
}
;
@@ -371,7 +381,7 @@ attr_size:
attr_id:
'(' NAME ')' { $$ = $2; }
- | { $$ = "dummy";}
+ | { $$ = strdup ("dummy");}
;
enums:
@@ -388,6 +398,9 @@ enum_list:
case 'c':
printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name, names[rdepth],$4,$3);
}
+
+ free ($3);
+ free ($4);
}
;
diff --git a/binutils/testsuite/binutils-all/i386/empty.d b/binutils/testsuite/binutils-all/i386/empty.d
new file mode 100644
index 0000000..5f4cc56
--- /dev/null
+++ b/binutils/testsuite/binutils-all/i386/empty.d
@@ -0,0 +1,9 @@
+#PROG: objcopy
+#as: --32
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature:
diff --git a/binutils/testsuite/binutils-all/i386/empty.s b/binutils/testsuite/binutils-all/i386/empty.s
new file mode 100644
index 0000000..6a6b517
--- /dev/null
+++ b/binutils/testsuite/binutils-all/i386/empty.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x0
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/binutils/testsuite/binutils-all/i386/ibt.d b/binutils/testsuite/binutils-all/i386/ibt.d
new file mode 100644
index 0000000..dfd7676
--- /dev/null
+++ b/binutils/testsuite/binutils-all/i386/ibt.d
@@ -0,0 +1,9 @@
+#PROG: objcopy
+#as: --32
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/binutils/testsuite/binutils-all/i386/ibt.s b/binutils/testsuite/binutils-all/i386/ibt.s
new file mode 100644
index 0000000..84ee964
--- /dev/null
+++ b/binutils/testsuite/binutils-all/i386/ibt.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/binutils/testsuite/binutils-all/i386/shstk.d b/binutils/testsuite/binutils-all/i386/shstk.d
new file mode 100644
index 0000000..933704c
--- /dev/null
+++ b/binutils/testsuite/binutils-all/i386/shstk.d
@@ -0,0 +1,9 @@
+#PROG: objcopy
+#as: --32
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/binutils/testsuite/binutils-all/i386/shstk.s b/binutils/testsuite/binutils-all/i386/shstk.s
new file mode 100644
index 0000000..4c3218a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/i386/shstk.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/binutils/testsuite/binutils-all/x86-64/empty-x32.d b/binutils/testsuite/binutils-all/x86-64/empty-x32.d
new file mode 100644
index 0000000..4193818
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/empty-x32.d
@@ -0,0 +1,10 @@
+#source: empty.s
+#PROG: objcopy
+#as: --x32
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature:
diff --git a/binutils/testsuite/binutils-all/x86-64/empty.d b/binutils/testsuite/binutils-all/x86-64/empty.d
new file mode 100644
index 0000000..777efbb
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/empty.d
@@ -0,0 +1,9 @@
+#PROG: objcopy
+#as: --64 -defsym __64_bit__=1
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature:
diff --git a/binutils/testsuite/binutils-all/x86-64/empty.s b/binutils/testsuite/binutils-all/x86-64/empty.s
new file mode 100644
index 0000000..6a6b517
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/empty.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x0
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/binutils/testsuite/binutils-all/x86-64/ibt-x32.d b/binutils/testsuite/binutils-all/x86-64/ibt-x32.d
new file mode 100644
index 0000000..5be7c98
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/ibt-x32.d
@@ -0,0 +1,10 @@
+#source: ibt.s
+#PROG: objcopy
+#as: --x32
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/binutils/testsuite/binutils-all/x86-64/ibt.d b/binutils/testsuite/binutils-all/x86-64/ibt.d
new file mode 100644
index 0000000..7bedff5
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/ibt.d
@@ -0,0 +1,9 @@
+#PROG: objcopy
+#as: --64 -defsym __64_bit__=1
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/binutils/testsuite/binutils-all/x86-64/ibt.s b/binutils/testsuite/binutils-all/x86-64/ibt.s
new file mode 100644
index 0000000..84ee964
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/ibt.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/binutils/testsuite/binutils-all/x86-64/shstk-x32.d b/binutils/testsuite/binutils-all/x86-64/shstk-x32.d
new file mode 100644
index 0000000..1dfc4fd
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/shstk-x32.d
@@ -0,0 +1,10 @@
+#source: shstk.s
+#PROG: objcopy
+#as: --x32
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/binutils/testsuite/binutils-all/x86-64/shstk.d b/binutils/testsuite/binutils-all/x86-64/shstk.d
new file mode 100644
index 0000000..1f131b8
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/shstk.d
@@ -0,0 +1,9 @@
+#PROG: objcopy
+#as: --64 -defsym __64_bit__=1
+#objcopy:
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/binutils/testsuite/binutils-all/x86-64/shstk.s b/binutils/testsuite/binutils-all/x86-64/shstk.s
new file mode 100644
index 0000000..4c3218a
--- /dev/null
+++ b/binutils/testsuite/binutils-all/x86-64/shstk.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/elfcpp/ChangeLog b/elfcpp/ChangeLog
index 6a61d61..3ce59f3 100644
--- a/elfcpp/ChangeLog
+++ b/elfcpp/ChangeLog
@@ -1,3 +1,13 @@
+2017-06-21 Alan Modra <amodra@gmail.com>
+
+ * elfcpp.h (DT_PPC64_OPT): Define.
+ * powerpc.h (PPC64_OPT_TLS, PPC64_OPT_MULTI_TOC,
+ PPC64_OPT_LOCALENTRY): Define.
+
+2017-06-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * elfcpp.h (enum PT): Add PT_S390_PGSTE to enum.
+
2017-01-02 Alan Modra <amodra@gmail.com>
Update year range in copyright notice of all files.
diff --git a/elfcpp/elfcpp.h b/elfcpp/elfcpp.h
index cce40d4..a57f547 100644
--- a/elfcpp/elfcpp.h
+++ b/elfcpp/elfcpp.h
@@ -515,7 +515,9 @@ enum PT
// Platform architecture compatibility information
PT_AARCH64_ARCHEXT = 0x70000000,
// Exception unwind tables
- PT_AARCH64_UNWIND = 0x70000001
+ PT_AARCH64_UNWIND = 0x70000001,
+ // 4k page table size
+ PT_S390_PGSTE = 0x70000000,
};
// The valid bit flags found in the Phdr p_flags field.
@@ -773,6 +775,9 @@ enum DT
DT_PPC64_OPD = 0x70000001,
DT_PPC64_OPDSZ = 0x70000002,
+ // Specify whether various optimisations are possible.
+ DT_PPC64_OPT = 0x70000003,
+
// The index of an STT_SPARC_REGISTER symbol within the DT_SYMTAB
// symbol table. One dynamic entry exists for every STT_SPARC_REGISTER
// symbol in the symbol table.
diff --git a/elfcpp/powerpc.h b/elfcpp/powerpc.h
index 99647bd..3dc0828 100644
--- a/elfcpp/powerpc.h
+++ b/elfcpp/powerpc.h
@@ -228,6 +228,14 @@ enum
EF_PPC64_ABI = 3
};
+// DT_PPC64_OPT bits
+enum
+{
+ PPC64_OPT_TLS = 1,
+ PPC64_OPT_MULTI_TOC = 2,
+ PPC64_OPT_LOCALENTRY = 4
+};
+
enum
{
// The ELFv2 ABI uses three bits in the symbol st_other field of a
diff --git a/gas/ChangeLog b/gas/ChangeLog
index d8b9d2e..6d3281d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,302 @@
+2017-06-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR gas/21661
+ * config/obj-elf.c (obj_elf_symver): Don't allow .symver with
+ common symbol.
+ (elf_frob_symbol): Likewise.
+ * testsuite/gas/elf/elf.exp: Run pr21661.
+ * testsuite/gas/elf/pr21661.d: New file.
+ * testsuite/gas/elf/pr21661.s: Likewise.
+
+2017-06-26 Nick Clifton <nickc@redhat.com>
+
+ * config/tc-arm.c (fpu_any): Only define for ELF based targets.
+
+2017-06-26 Claudiu Zissulescu <claziss@synopsys.com>
+
+ * /config/tc-arc.c (is_br_jmp_insn_p): Update macro with known
+ instructions to be accounted as jumps.
+ (assemble_insn): Check for limms into the delay slots. Emit an
+ error if so.
+ * testsuite/gas/arc/asm-errors-3.d: New file.
+ * testsuite/gas/arc/asm-errors-3.err: Likewise.
+ * testsuite/gas/arc/asm-errors-3.s: Likewise.
+
+2017-06-26 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * NEWS: Mention support of ARM Cortex-R52 processor.
+ * config/tc-arm.c (arm_cpus): Add entry for ARM Cortex-R52 processor.
+ * doc/c-arm.texi: Mention support for -mcpu=cortex-r52.
+
+2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * NEWS: Mention support for ARMv8-R architecture.
+ * config/tc-arm.c (arm_archs): Add entry for ARMv8-R.
+ (arm_extensions): Restrict pan, ras and rdma extension to
+ ARMv8-A and make crypto, fp and simd extensions available to
+ ARMv8-R.
+ (cpu_arch_ver): Add entry for ARMv8-R.
+ (aeabi_set_public_attributes): Update gas_assert for Tag_DIV_use
+ logic.
+ * testsuite/gas/arm/armv8-a+fp.s: Rename into ...
+ * testsuite/gas/arm/armv8-ar+fp.s: This. Remove .arch directive.
+ * testsuite/gas/arm/armv8-a+fp.d: Specify source to assemble and
+ architecture to assemble for.
+ * testsuite/gas/arm/armv8-r+fp.d: New.
+ * testsuite/gas/arm/armv8-a+simd.s: Rename into ...
+ * testsuite/gas/arm/armv8-ar+simd.s: This. Remove .arch directive.
+ * testsuite/gas/arm/armv8-a+simd.d: Specify source to assemble and
+ architecture to assemble for.
+ * testsuite/gas/arm/armv8-r+simd.d: New.
+ * testsuite/gas/arm/armv8-a-bad.s: Rename into ...
+ * testsuite/gas/arm/armv8-ar-bad.s: This. Remove .arch directive.
+ * testsuite/gas/arm/armv8-a-bad.l: Rename into ...
+ * testsuite/gas/arm/armv8-ar-bad.l: This. Decrement line number by 1.
+ * testsuite/gas/arm/armv8-a-bad.d: Specify source to assemble,
+ architecture to assemble for and adjust error output file.
+ * testsuite/gas/arm/armv8-r-bad.d: New.
+ * testsuite/gas/arm/armv8-a-barrier.s: Rename into ...
+ * testsuite/gas/arm/armv8-ar-barrier.s: This.
+ * testsuite/gas/arm/armv8-a-barrier-arm.d: Adjust source.
+ * testsuite/gas/arm/armv8-a-barrier-thumb.d: Likewise.
+ * testsuite/gas/arm/armv8-r-barrier-arm.d: New.
+ * testsuite/gas/arm/armv8-r-barrier-thumb.d: New.
+ * testsuite/gas/arm/armv8-a-it-bad.s: Rename into ...
+ * testsuite/gas/arm/armv8-ar-it-bad.s: This. Remove .arch directive.
+ * testsuite/gas/arm/armv8-a-it-bad.l: Rename into ...
+ * testsuite/gas/arm/armv8-ar-it-bad.l: This. Decrement line number
+ by 1.
+ * testsuite/gas/arm/armv8-a-it-bad.d: Specify source to assemble,
+ architecture to assemble for and adjust error output file.
+ * testsuite/gas/arm/armv8-r-it-bad.d: New.
+ * testsuite/gas/arm/armv8-a.s: Rename into ...
+ * testsuite/gas/arm/armv8-ar.s: This. Remove .arch directive.
+ * testsuite/gas/arm/armv8-a.d: Specify source to assemble and
+ architecture to assemble for.
+ * testsuite/gas/arm/armv8-r.d: New.
+ * testsuite/gas/arm/attr-march-armv8-r+crypto.d: New.
+ * testsuite/gas/arm/attr-march-armv8-r+fp.d: New.
+ * testsuite/gas/arm/attr-march-armv8-r+simd.d: New.
+ * testsuite/gas/arm/attr-march-armv8-r.d: New.
+ * testsuite/gas/arm/crc32.s: Rename into ...
+ * testsuite/gas/arm/crc32-armv8-ar.s: This.
+ * testsuite/gas/arm/crc32.d: Rename into ...
+ * testsuite/gas/arm/crc32-armv8-a.d: This. Specify source to assemble.
+ * testsuite/gas/arm/crc32-armv8-r.d: New.
+ * testsuite/gas/arm/crc32-bad.s: Rename into ...
+ * testsuite/gas/arm/crc32-armv8-ar-bad.s: This.
+ * testsuite/gas/arm/crc32-bad.d: Rename into ...
+ * testsuite/gas/arm/crc32-armv8-a-bad.d: This. Specify source to
+ assemble.
+ * testsuite/gas/arm/crc32-armv8-r-bad.d: New.
+ * testsuite/gas/arm/mask_1.s: Rename into ...
+ * testsuite/gas/arm/mask_1-armv8-ar.s: This.
+ * testsuite/gas/arm/mask_1.d: Rename into ...
+ * testsuite/gas/arm/mask_1-armv8-a.d: This. Specify source to
+ assemble.
+ * testsuite/gas/arm/mask_1-armv8-r.d: new.
+
+2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/tc-arm.c (arm_ext_v6m): Delete.
+ (arm_ext_v7m): Delete.
+ (arm_ext_m): Remove ARM_EXT_OS from the set of feature defined M
+ profile.
+ (arm_arch_v6m_only): Delete.
+ (do_t_swi): Remove special case for ARMv6S-M.
+ (md_assemble): Display error message previously in do_t_swi when
+ SVC is not available.
+ (insns): Guard swi and svc by arm_ext_os for Thumb mode.
+ (aeabi_set_public_attributes): Remove special case for ARMv6S-M.
+
+2017-05-11 Andrew Waterman <andrew@sifive.com>
+
+ * config/tc-riscv.c (riscv_ip): Changes as_warn to as_bad for improper
+ shift amounts.
+
+2017-06-22 Nick Clifton <nickc@redhat.com>
+
+ * config/tc-arm.c (arm_ext_v7m): Add ATTRIBUTE_UNUSED.
+
+2017-06-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/tc-arm.c (fpu_any): Defined from FPU_ANY.
+ (cpu_arch_ver): Add all architectures and sort by release date.
+ (have_ext_for_needed_feat_p): New.
+ (get_aeabi_cpu_arch_from_fset): New.
+ (aeabi_set_public_attributes): Call above function to determine
+ Tag_CPU_arch and Tag_CPU_arch_profile values. Adapt Tag_ARM_ISA_use
+ and Tag_THUMB_ISA_use selection logic to check absence of feature bit
+ accordingly.
+ * testsuite/gas/arm/attr-march-armv1.d: Fix expected Tag_CPU_arch build
+ attribute value.
+ * testsuite/gas/arm/attr-march-armv2.d: Likewise.
+ * testsuite/gas/arm/attr-march-armv2a.d: Likewise.
+ * testsuite/gas/arm/attr-march-armv2s.d: Likewise.
+ * testsuite/gas/arm/attr-march-armv3.d: Likewise.
+ * testsuite/gas/arm/attr-march-armv3m.d: Likewise.
+ * testsuite/gas/arm/pr12198-2.d: Likewise.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/gas/i386/cet-intel.d: Updated.
+ * testsuite/gas/i386/cet.d: Likewise.
+ * testsuite/gas/i386/x86-64-cet-intel.d: Likewise.
+ * testsuite/gas/i386/x86-64-cet.d: Likewise.
+ * testsuite/gas/i386/cet.s: Update incsspd and setssbsy tests.
+ * testsuite/gas/i386/x86-64-cet.s: Likewise.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/gas/i386/cet-intel.d: Updated.
+ * testsuite/gas/i386/cet.d: Likewise.
+ * testsuite/gas/i386/x86-64-cet-intel.d: Likewise.
+ * testsuite/gas/i386/x86-64-cet.d: Likewise.
+ * testsuite/gas/i386/cet.s: Replace savessp with saveprevssp.
+ * testsuite/gas/i386/x86-64-cet.s: Likewise.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * config/tc-i386.c (md_assemble): Update NOTRACK prefix check.
+ * testsuite/gas/i386/notrack-intel.d: Updated.
+ * testsuite/gas/i386/notrack.d: Likewise.
+ * testsuite/gas/i386/notrackbad.l: Likewise.
+ * testsuite/gas/i386/x86-64-notrack-intel.d: Likewise.
+ * testsuite/gas/i386/x86-64-notrack.d: Likewise.
+ * testsuite/gas/i386/x86-64-notrackbad.l: Likewise.
+ * testsuite/gas/i386/notrack.s: Add NOTRACK prefix tests with
+ memory indirect branch.
+ * testsuite/gas/i386/x86-64-notrack.s: Likewise.
+ * testsuite/gas/i386/notrackbad.s: Remove memory indirect branch
+ with NOTRACK prefix.
+ * testsuite/gas/i386/x86-64-notrackbad.s: Likewise.
+
+2017-06-20 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/tc-arm.c (arm_extensions): New duplicate idiv entry to enable
+ Thumb division for ARMv7 architecture.
+ (arm_parse_extension): Document expected behavior for duplicate
+ entries.
+ (s_arm_arch_extension): Likewise.
+ * testsuite/gas/arm/forbid-armv7-idiv-ext.d: New test.
+ * testsuite/gas/arm/forbid-armv7-idiv-ext.l: New expected output for
+ above test.
+
+2017-06-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/tc-arm.c (aeabi_set_public_attributes): Populate flags from
+ feature bits used or selected_cpu depending on whether a CPU was
+ selected by the user.
+
+2017-06-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/tc-arm.c (aeabi_set_public_attributes): Test *mcpu_ext_opt to
+ decide whether to set Tag_DSP_extension build attribute value. Remove
+ now useless arm_arch variable.
+
+2017-06-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/tc-arm.c (dyn_mcpu_ext_opt): New static variable.
+ (dyn_march_ext_opt): Likewise.
+ (md_begin): Copy extension feature bits alongside architecture ones.
+ Merge extensions feature bits in selected_cpu and cpu_variant if there
+ is some.
+ (arm_parse_extension): Pass architecture and extension feature bits in
+ separate parameters, with architecture bits being read only. Update
+ **opt_p directly rather than *ext_set and initialize it if needed.
+ (arm_parse_cpu): Stop merging architecture and extension feature bits
+ and instead use mcpu_cpu_opt and dyn_mcpu_ext_opt to memorize them
+ respectively. Adapt to change in parameters of arm_parse_extension.
+ (arm_parse_arch): Adapt to change in parameters of arm_parse_extension.
+ (aeabi_set_attribute_string): Make function static.
+ (arm_md_post_relax): New function.
+ (s_arm_cpu): Stop merging architecture and extension feature bits and
+ instead use mcpu_cpu_opt and dyn_mcpu_ext_opt to memorize them
+ respectively. Merge extension feature bits in cpu_variant
+ if there is any.
+ (s_arm_arch): Reset extension feature bit. Set selected_cpu from
+ *mcpu_cpu_opt and cpu_variant from selected_cpu and *mfpu_opt for
+ consistency with s_arm_cpu.
+ (s_arm_arch_extension): Update *dyn_mcpu_ext_opt rather than
+ selected_cpu, allocating it before hand if needed. Set selected_cpu
+ from it and then cpu_variant.
+ (s_arm_fpu): Merge *mcpu_ext_opt feature bits if any in cpu_variant.
+ * config/tc-arm.h (md_post_relax_hook): Set to arm_md_post_relax.
+ (aeabi_set_public_attributes): Delete external declaration.
+ (arm_md_post_relax): Declare externally.
+
+2017-06-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * config/tc-arm.c (struct arm_cpu_option_table): New ext field.
+ (ARM_CPU_OPT): Add parameter to set new ext field and reorder canonical
+ name field just after the name field.
+ (arm_cpus): Move extension feature bit from value field to ext field,
+ reorder parameter according to changes in ARM_CPU_OPT and reindent.
+ (arm_parse_cpu): Point mcpu_cpu_opt to a bitfield merging the value and
+ ext field from the selected arm_cpus entry.
+ (s_arm_cpu): Likewise.
+
+2017-06-21 James Greenhalgh <james.greenhalgh@arm.com>
+
+ * config/tc-aarch64.c (aarch64_cpus): Add cortex-a55 and cortex-a75.
+ * doc/c-aarch64.texi (-mcpu): Document cortex-a55 and cortex-a75.
+
+2017-06-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/21594
+ * testsuite/gas/i386/mpx.s: Add 2 tests with invalid bnd
+ register.
+ * testsuite/gas/i386/x86-64-mpx.s: Likewise.
+ * testsuite/gas/i386/mpx.d: Updated.
+ * testsuite/gas/i386/x86-64-mpx.d: Likewise.
+
+2017-06-14 Max Filippov <jcmvbkbc@gmail.com>
+
+ * config/tc-xtensa.c (density_supported, xtensa_fetch_width,
+ absolute_literals_supported): Leave definitions uninitialized.
+ (directive_state): Leave entries for directive_density and
+ directive_absolute_literals initialized to false.
+ (xg_init_global_config, xtensa_init): New functions.
+ * config/tc-xtensa.h (TARGET_BYTES_BIG_ENDIAN): Define as 0.
+ (HOST_SPECIAL_INIT): New definition.
+ (xtensa_init): New declaration.
+
+2017-06-07 Michael Collison <michael.collison@arm.com>
+
+ * config/tc-aarch64.c (reg_entry_reg_names): Add IP0,
+ IP1, FP, and LR as register aliases of register 16, 17, 29
+ and 30 respectively.
+ * testsuite/gas/aarch64/diagnostic.l: Remove diagnostic
+ prohibiting register 'lr' which is now an alias.
+ * testsuite/gas/aarch64/diagnostic.s: Remove instruction
+ utilizing register 'lr' which is now an alias.
+
+2017-06-06 Jiong Wang <jiong.wang@arm.com>
+
+ * config/tc-arm.c (reject_bad_reg): Allow REG_SP on ARMv8-A.
+ (parse_operands): Allow REG_SP for OP_oRRnpcsp and OP_RRnpcsp on
+ ARMv8-A.
+ (do_co_reg): Allow REG_SP for Rd on ARMv8-A.
+ (do_t_add_sub): Likewise.
+ (do_t_mov_cmp): Likewise.
+ (do_t_tb): Likewise.
+ * testsuite/gas/arm/ld-sp-warn.l: Delete the warning on REG_SP as Rt for
+ ldrsb.
+ * testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d: New test.
+ * testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l: New test.
+ * testsuite/gas/arm/sp-pc-validations-bad-t.d: Specifies -march=armv7-a.
+ * testsuite/gas/arm/sp-pc-validations-bad-t.s: Remove ".arch armv7-a".
+ * testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d: New test.
+ * testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l: New test.
+ * testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d: New test.
+ * testsuite/gas/arm/sp-usage-thumb2-relax.s: New test.
+ * testsuite/gas/arm/strex-bad-t.d: Specifies -march=armv7-a.
+
+2017-06-05 Jim Wilson <jim.wilson@linaro.org>
+
+ * config/tc-arm.c (arm_cpus): Delete falkor and qdf24xx entries.
+ * doc/c-arm.texi (-mcpu): Likewise.
+
2017-05-30 Anton Kolesov <anton.kolesov@synopsys.com>
* config/tc-arc.c (cpu_types): Include arc-cpu.def
diff --git a/gas/NEWS b/gas/NEWS
index 2078d29..b4ee6b6 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -10,6 +10,9 @@
* Add support for the Texas Instruments PRU processor.
+* Support for the ARMv8-R architecture and Cortex-R52 processor has been
+ added to the ARM port.
+
Changes in 2.28:
* Add support for the RISC-V architecture.
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 3696d5e..49d99a4 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -1414,6 +1414,14 @@ obj_elf_symver (int ignore ATTRIBUTE_UNUSED)
c = get_symbol_name (& name);
lex_type[(unsigned char) '@'] = old_lexat;
+ if (S_IS_COMMON (sym))
+ {
+ as_bad (_("`%s' can't be versioned to common symbol '%s'"),
+ name, S_GET_NAME (sym));
+ ignore_rest_of_line ();
+ return;
+ }
+
if (symbol_get_obj (sym)->versioned_name == NULL)
{
symbol_get_obj (sym)->versioned_name = xstrdup (name);
@@ -2277,6 +2285,13 @@ elf_frob_symbol (symbolS *symp, int *puntp)
symp2 = symbol_find_or_make (sy_obj->versioned_name);
/* Now we act as though we saw symp2 = sym. */
+ if (S_IS_COMMON (symp))
+ {
+ as_bad (_("`%s' can't be versioned to common symbol '%s'"),
+ sy_obj->versioned_name, S_GET_NAME (symp));
+ *puntp = TRUE;
+ return;
+ }
S_SET_SEGMENT (symp2, S_GET_SEGMENT (symp));
diff --git a/gas/config/tc-aarch64.c b/gas/config/tc-aarch64.c
index cdb2903..fae29b4 100644
--- a/gas/config/tc-aarch64.c
+++ b/gas/config/tc-aarch64.c
@@ -6797,6 +6797,11 @@ static const reg_entry reg_names[] = {
REGDEF (wzr, 31, Z_32), REGDEF (WZR, 31, Z_32),
REGDEF (xzr, 31, Z_64), REGDEF (XZR, 31, Z_64),
+ REGDEF (ip0, 16, R_64), REGDEF (IP0, 16, R_64),
+ REGDEF (ip1, 17, R_64), REGDEF (IP1, 17, R_64),
+ REGDEF (fp, 29, R_64), REGDEF (FP, 29, R_64),
+ REGDEF (lr, 30, R_64), REGDEF (LR, 30, R_64),
+
/* Floating-point single precision registers. */
REGSET (s, FP_S), REGSET (S, FP_S),
@@ -8390,6 +8395,12 @@ static const struct aarch64_cpu_option_table aarch64_cpus[] = {
AARCH64_FEATURE_CRC), "Cortex-A72"},
{"cortex-a73", AARCH64_FEATURE (AARCH64_ARCH_V8,
AARCH64_FEATURE_CRC), "Cortex-A73"},
+ {"cortex-a55", AARCH64_FEATURE (AARCH64_ARCH_V8_2,
+ AARCH64_FEATURE_RCPC | AARCH64_FEATURE_F16),
+ "Cortex-A55"},
+ {"cortex-a75", AARCH64_FEATURE (AARCH64_ARCH_V8_2,
+ AARCH64_FEATURE_RCPC | AARCH64_FEATURE_F16),
+ "Cortex-A75"},
{"exynos-m1", AARCH64_FEATURE (AARCH64_ARCH_V8,
AARCH64_FEATURE_CRC | AARCH64_FEATURE_CRYPTO),
"Samsung Exynos M1"},
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 55aaf07..dd67d77 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -107,8 +107,18 @@ enum arc_rlx_types
#define is_spfp_p(op) (((sc) == SPX))
#define is_dpfp_p(op) (((sc) == DPX))
#define is_fpuda_p(op) (((sc) == DPA))
-#define is_br_jmp_insn_p(op) (((op)->insn_class == BRANCH \
- || (op)->insn_class == JUMP))
+#define is_br_jmp_insn_p(op) (((op)->insn_class == BRANCH \
+ || (op)->insn_class == JUMP \
+ || (op)->insn_class == BRCC \
+ || (op)->insn_class == BBIT0 \
+ || (op)->insn_class == BBIT1 \
+ || (op)->insn_class == BI \
+ || (op)->insn_class == EI \
+ || (op)->insn_class == ENTER \
+ || (op)->insn_class == JLI \
+ || (op)->insn_class == LOOP \
+ || (op)->insn_class == LEAVE \
+ ))
#define is_kernel_insn_p(op) (((op)->insn_class == KERNEL))
#define is_nps400_p(op) (((sc) == NPS400))
@@ -3280,10 +3290,7 @@ md_undefined_symbol (char *name)
GOTPC reference to _GLOBAL_OFFSET_TABLE_. */
if (((*name == '_')
&& (*(name+1) == 'G')
- && (strcmp (name, GLOBAL_OFFSET_TABLE_NAME) == 0))
- || ((*name == '_')
- && (*(name+1) == 'D')
- && (strcmp (name, DYNAMIC_STRUCT_NAME) == 0)))
+ && (strcmp (name, GLOBAL_OFFSET_TABLE_NAME) == 0)))
{
if (!GOT_symbol)
{
@@ -4110,6 +4117,11 @@ assemble_insn (const struct arc_opcode *opcode,
as_bad (_("Insn %s has a jump/branch instruction %s in its delay slot."),
arc_last_insns[1].opcode->name,
arc_last_insns[0].opcode->name);
+ if (arc_last_insns[1].has_delay_slot
+ && arc_last_insns[0].has_limm)
+ as_bad (_("Insn %s has an instruction %s with limm in its delay slot."),
+ arc_last_insns[1].opcode->name,
+ arc_last_insns[0].opcode->name);
}
void
diff --git a/gas/config/tc-arc.h b/gas/config/tc-arc.h
index f4cafe9..f887fcc 100644
--- a/gas/config/tc-arc.h
+++ b/gas/config/tc-arc.h
@@ -171,7 +171,6 @@ extern long md_pcrel_from_section (struct fix *, segT);
#define tc_frob_label(S) arc_frob_label (S)
#define GLOBAL_OFFSET_TABLE_NAME "_GLOBAL_OFFSET_TABLE_"
-#define DYNAMIC_STRUCT_NAME "_DYNAMIC"
/* We need to take care of not having section relative fixups for the
fixups with respect to Position Independent Code. */
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 08824b4..f0b11f4 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -147,8 +147,10 @@ static const arm_feature_set *legacy_cpu = NULL;
static const arm_feature_set *legacy_fpu = NULL;
static const arm_feature_set *mcpu_cpu_opt = NULL;
+static arm_feature_set *dyn_mcpu_ext_opt = NULL;
static const arm_feature_set *mcpu_fpu_opt = NULL;
static const arm_feature_set *march_cpu_opt = NULL;
+static arm_feature_set *dyn_march_ext_opt = NULL;
static const arm_feature_set *march_fpu_opt = NULL;
static const arm_feature_set *mfpu_opt = NULL;
static const arm_feature_set *object_arch = NULL;
@@ -187,7 +189,6 @@ static const arm_feature_set arm_ext_v5j = ARM_FEATURE_CORE_LOW (ARM_EXT_V5J);
static const arm_feature_set arm_ext_v6 = ARM_FEATURE_CORE_LOW (ARM_EXT_V6);
static const arm_feature_set arm_ext_v6k = ARM_FEATURE_CORE_LOW (ARM_EXT_V6K);
static const arm_feature_set arm_ext_v6t2 = ARM_FEATURE_CORE_LOW (ARM_EXT_V6T2);
-static const arm_feature_set arm_ext_v6m = ARM_FEATURE_CORE_LOW (ARM_EXT_V6M);
static const arm_feature_set arm_ext_v6_notm =
ARM_FEATURE_CORE_LOW (ARM_EXT_V6_NOTM);
static const arm_feature_set arm_ext_v6_dsp =
@@ -201,11 +202,11 @@ static const arm_feature_set arm_ext_v7 = ARM_FEATURE_CORE_LOW (ARM_EXT_V7);
static const arm_feature_set arm_ext_v7a = ARM_FEATURE_CORE_LOW (ARM_EXT_V7A);
static const arm_feature_set arm_ext_v7r = ARM_FEATURE_CORE_LOW (ARM_EXT_V7R);
#ifdef OBJ_ELF
-static const arm_feature_set arm_ext_v7m = ARM_FEATURE_CORE_LOW (ARM_EXT_V7M);
+static const arm_feature_set ATTRIBUTE_UNUSED arm_ext_v7m = ARM_FEATURE_CORE_LOW (ARM_EXT_V7M);
#endif
static const arm_feature_set arm_ext_v8 = ARM_FEATURE_CORE_LOW (ARM_EXT_V8);
static const arm_feature_set arm_ext_m =
- ARM_FEATURE_CORE (ARM_EXT_V6M | ARM_EXT_OS | ARM_EXT_V7M,
+ ARM_FEATURE_CORE (ARM_EXT_V6M | ARM_EXT_V7M,
ARM_EXT2_V8M | ARM_EXT2_V8M_MAIN);
static const arm_feature_set arm_ext_mp = ARM_FEATURE_CORE_LOW (ARM_EXT_MP);
static const arm_feature_set arm_ext_sec = ARM_FEATURE_CORE_LOW (ARM_EXT_SEC);
@@ -238,12 +239,12 @@ static const arm_feature_set arm_ext_v8_3 =
ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8_3A);
static const arm_feature_set arm_arch_any = ARM_ANY;
+#ifdef OBJ_ELF
+static const arm_feature_set fpu_any = FPU_ANY;
+#endif
static const arm_feature_set arm_arch_full ATTRIBUTE_UNUSED = ARM_FEATURE (-1, -1, -1);
static const arm_feature_set arm_arch_t2 = ARM_ARCH_THUMB2;
static const arm_feature_set arm_arch_none = ARM_ARCH_NONE;
-#ifdef OBJ_ELF
-static const arm_feature_set arm_arch_v6m_only = ARM_ARCH_V6M_ONLY;
-#endif
static const arm_feature_set arm_cext_iwmmxt2 =
ARM_FEATURE_COPROC (ARM_CEXT_IWMMXT2);
@@ -7189,8 +7190,14 @@ parse_operands (char *str, const unsigned int *pattern, bfd_boolean thumb)
{
if (inst.operands[i].reg == REG_PC)
inst.error = BAD_PC;
- else if (inst.operands[i].reg == REG_SP)
- inst.error = BAD_SP;
+ else if (inst.operands[i].reg == REG_SP
+ /* The restriction on Rd/Rt/Rt2 on Thumb mode has been
+ relaxed since ARMv8-A. */
+ && !ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
+ {
+ gas_assert (thumb);
+ inst.error = BAD_SP;
+ }
}
break;
@@ -7288,14 +7295,23 @@ parse_operands (char *str, const unsigned int *pattern, bfd_boolean thumb)
/* Reject "bad registers" for Thumb-2 instructions. Many Thumb-2
instructions are unpredictable if these registers are used. This
- is the BadReg predicate in ARM's Thumb-2 documentation. */
-#define reject_bad_reg(reg) \
- do \
- if (reg == REG_SP || reg == REG_PC) \
- { \
- inst.error = (reg == REG_SP) ? BAD_SP : BAD_PC; \
- return; \
- } \
+ is the BadReg predicate in ARM's Thumb-2 documentation.
+
+ Before ARMv8-A, REG_PC and REG_SP were not allowed in quite a few
+ places, while the restriction on REG_SP was relaxed since ARMv8-A. */
+#define reject_bad_reg(reg) \
+ do \
+ if (reg == REG_PC) \
+ { \
+ inst.error = BAD_PC; \
+ return; \
+ } \
+ else if (reg == REG_SP \
+ && !ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8)) \
+ { \
+ inst.error = BAD_SP; \
+ return; \
+ } \
while (0)
/* If REG is R13 (the stack pointer), warn that its use is
@@ -8659,7 +8675,7 @@ do_co_reg (void)
|| inst.instruction == 0xfe000010)
/* MCR, MCR2 */
reject_bad_reg (Rd);
- else
+ else if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
/* MRC, MRC2 */
constraint (Rd == REG_SP, BAD_SP);
}
@@ -10529,7 +10545,8 @@ do_t_add_sub (void)
{
int add;
- constraint (Rd == REG_SP && Rs != REG_SP, BAD_SP);
+ if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
+ constraint (Rd == REG_SP && Rs != REG_SP, BAD_SP);
add = (inst.instruction == T_MNEM_add
|| inst.instruction == T_MNEM_adds);
@@ -10653,7 +10670,8 @@ do_t_add_sub (void)
}
constraint (Rd == REG_PC, BAD_PC);
- constraint (Rd == REG_SP && Rs != REG_SP, BAD_SP);
+ if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
+ constraint (Rd == REG_SP && Rs != REG_SP, BAD_SP);
constraint (Rs == REG_PC, BAD_PC);
reject_bad_reg (Rn);
@@ -11906,7 +11924,8 @@ do_t_mov_cmp (void)
/* This is mov.w. */
constraint (Rn == REG_PC, BAD_PC);
constraint (Rm == REG_PC, BAD_PC);
- constraint (Rn == REG_SP && Rm == REG_SP, BAD_SP);
+ if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
+ constraint (Rn == REG_SP && Rm == REG_SP, BAD_SP);
}
}
else
@@ -13099,17 +13118,6 @@ do_t_sxth (void)
static void
do_t_swi (void)
{
- /* We have to do the following check manually as ARM_EXT_OS only applies
- to ARM_EXT_V6M. */
- if (ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v6m))
- {
- if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_os)
- /* This only applies to the v6m however, not later architectures. */
- && ! ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v7))
- as_bad (_("SVC is not permitted on this architecture"));
- ARM_MERGE_FEATURE_SETS (thumb_arch_used, thumb_arch_used, arm_ext_os);
- }
-
inst.reloc.type = BFD_RELOC_ARM_SWI;
}
@@ -13127,7 +13135,8 @@ do_t_tb (void)
Rn = inst.operands[0].reg;
Rm = inst.operands[0].imm;
- constraint (Rn == REG_SP, BAD_SP);
+ if (!ARM_CPU_HAS_FEATURE (cpu_variant, arm_ext_v8))
+ constraint (Rn == REG_SP, BAD_SP);
reject_bad_reg (Rm);
constraint (!half && inst.operands[0].shifted,
@@ -18449,7 +18458,10 @@ md_assemble (char *str)
|| (thumb_mode == 1
&& !ARM_CPU_HAS_FEATURE (variant, *opcode->tvariant)))
{
- as_bad (_("selected processor does not support `%s' in Thumb mode"), str);
+ if (opcode->tencode == do_t_swi)
+ as_bad (_("SVC is not permitted on this architecture"));
+ else
+ as_bad (_("selected processor does not support `%s' in Thumb mode"), str);
return;
}
if (inst.cond != COND_ALWAYS && !unified_syntax
@@ -19273,8 +19285,6 @@ static const struct asm_opcode insns[] =
tC3("ldmia", 8900000, _ldmia, 2, (RRw, REGLST), ldmstm, t_ldmstm),
tC3("ldmfd", 8900000, _ldmia, 2, (RRw, REGLST), ldmstm, t_ldmstm),
- TCE("swi", f000000, df00, 1, (EXPi), swi, t_swi),
- TCE("svc", f000000, df00, 1, (EXPi), swi, t_swi),
tCE("b", a000000, _b, 1, (EXPr), branch, t_branch),
TCE("bl", b000000, f000f800, 1, (EXPr), bl, t_branch23),
@@ -19302,6 +19312,12 @@ static const struct asm_opcode insns[] =
TCE("rsb", 0600000, ebc00000, 3, (RR, oRR, SH), arit, t_rsb),
TC3("rsbs", 0700000, ebd00000, 3, (RR, oRR, SH), arit, t_rsb),
+#undef THUMB_VARIANT
+#define THUMB_VARIANT & arm_ext_os
+
+ TCE("swi", f000000, df00, 1, (EXPi), swi, t_swi),
+ TCE("svc", f000000, df00, 1, (EXPi), swi, t_swi),
+
#undef THUMB_VARIANT
#define THUMB_VARIANT & arm_ext_v6
@@ -25014,7 +25030,12 @@ md_begin (void)
mcpu_cpu_opt = legacy_cpu;
}
else if (!mcpu_cpu_opt)
- mcpu_cpu_opt = march_cpu_opt;
+ {
+ mcpu_cpu_opt = march_cpu_opt;
+ dyn_mcpu_ext_opt = dyn_march_ext_opt;
+ /* Avoid double free in arm_md_end. */
+ dyn_march_ext_opt = NULL;
+ }
if (legacy_fpu)
{
@@ -25054,16 +25075,22 @@ md_begin (void)
mcpu_cpu_opt = &cpu_default;
selected_cpu = cpu_default;
}
+ else if (dyn_mcpu_ext_opt)
+ ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
else
selected_cpu = *mcpu_cpu_opt;
#else
- if (mcpu_cpu_opt)
+ if (mcpu_cpu_opt && dyn_mcpu_ext_opt)
+ ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
+ else if (mcpu_cpu_opt)
selected_cpu = *mcpu_cpu_opt;
else
mcpu_cpu_opt = &arm_arch_any;
#endif
ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
+ if (dyn_mcpu_ext_opt)
+ ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
autoselect_thumb_from_cpu_variant ();
@@ -25438,6 +25465,7 @@ struct arm_cpu_option_table
const char *name;
size_t name_len;
const arm_feature_set value;
+ const arm_feature_set ext;
/* For some CPUs we assume an FPU unless the user explicitly sets
-mfpu=... */
const arm_feature_set default_fpu;
@@ -25448,181 +25476,381 @@ struct arm_cpu_option_table
/* This list should, at a minimum, contain all the cpu names
recognized by GCC. */
-#define ARM_CPU_OPT(N, V, DF, CN) { N, sizeof (N) - 1, V, DF, CN }
+#define ARM_CPU_OPT(N, CN, V, E, DF) { N, sizeof (N) - 1, V, E, DF, CN }
static const struct arm_cpu_option_table arm_cpus[] =
{
- ARM_CPU_OPT ("all", ARM_ANY, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm1", ARM_ARCH_V1, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm2", ARM_ARCH_V2, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm250", ARM_ARCH_V2S, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm3", ARM_ARCH_V2S, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm6", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm60", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm600", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm610", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm620", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7m", ARM_ARCH_V3M, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7d", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7dm", ARM_ARCH_V3M, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7di", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7dmi", ARM_ARCH_V3M, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm70", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm700", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm700i", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm710", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm710t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm720", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm720t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm740t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm710c", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7100", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7500", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7500fe", ARM_ARCH_V3, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7tdmi", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm7tdmi-s", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm8", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm810", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("strongarm", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("strongarm1", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("strongarm110", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("strongarm1100", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("strongarm1110", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm9", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm920", ARM_ARCH_V4T, FPU_ARCH_FPA, "ARM920T"),
- ARM_CPU_OPT ("arm920t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm922t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm940t", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("arm9tdmi", ARM_ARCH_V4T, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("fa526", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
- ARM_CPU_OPT ("fa626", ARM_ARCH_V4, FPU_ARCH_FPA, NULL),
+ ARM_CPU_OPT ("all", NULL, ARM_ANY,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm1", NULL, ARM_ARCH_V1,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm2", NULL, ARM_ARCH_V2,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm250", NULL, ARM_ARCH_V2S,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm3", NULL, ARM_ARCH_V2S,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm6", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm60", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm600", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm610", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm620", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7m", NULL, ARM_ARCH_V3M,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7d", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7dm", NULL, ARM_ARCH_V3M,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7di", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7dmi", NULL, ARM_ARCH_V3M,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm70", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm700", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm700i", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm710", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm710t", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm720", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm720t", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm740t", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm710c", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7100", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7500", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7500fe", NULL, ARM_ARCH_V3,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7t", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7tdmi", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm7tdmi-s", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm8", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm810", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("strongarm", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("strongarm1", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("strongarm110", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("strongarm1100", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("strongarm1110", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm9", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm920", "ARM920T", ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm920t", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm922t", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm940t", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("arm9tdmi", NULL, ARM_ARCH_V4T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("fa526", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+ ARM_CPU_OPT ("fa626", NULL, ARM_ARCH_V4,
+ ARM_ARCH_NONE,
+ FPU_ARCH_FPA),
+
/* For V5 or later processors we default to using VFP; but the user
should really set the FPU type explicitly. */
- ARM_CPU_OPT ("arm9e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm9e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm926ej", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, "ARM926EJ-S"),
- ARM_CPU_OPT ("arm926ejs", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, "ARM926EJ-S"),
- ARM_CPU_OPT ("arm926ej-s", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm946e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm946e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, "ARM946E-S"),
- ARM_CPU_OPT ("arm946e-s", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm966e-r0", ARM_ARCH_V5TExP, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm966e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, "ARM966E-S"),
- ARM_CPU_OPT ("arm966e-s", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm968e-s", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm10t", ARM_ARCH_V5T, FPU_ARCH_VFP_V1, NULL),
- ARM_CPU_OPT ("arm10tdmi", ARM_ARCH_V5T, FPU_ARCH_VFP_V1, NULL),
- ARM_CPU_OPT ("arm10e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm1020", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, "ARM1020E"),
- ARM_CPU_OPT ("arm1020t", ARM_ARCH_V5T, FPU_ARCH_VFP_V1, NULL),
- ARM_CPU_OPT ("arm1020e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm1022e", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm1026ejs", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2,
- "ARM1026EJ-S"),
- ARM_CPU_OPT ("arm1026ej-s", ARM_ARCH_V5TEJ, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("fa606te", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("fa616te", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("fa626te", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("fmp626", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("fa726te", ARM_ARCH_V5TE, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm1136js", ARM_ARCH_V6, FPU_NONE, "ARM1136J-S"),
- ARM_CPU_OPT ("arm1136j-s", ARM_ARCH_V6, FPU_NONE, NULL),
- ARM_CPU_OPT ("arm1136jfs", ARM_ARCH_V6, FPU_ARCH_VFP_V2,
- "ARM1136JF-S"),
- ARM_CPU_OPT ("arm1136jf-s", ARM_ARCH_V6, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("mpcore", ARM_ARCH_V6K, FPU_ARCH_VFP_V2, "MPCore"),
- ARM_CPU_OPT ("mpcorenovfp", ARM_ARCH_V6K, FPU_NONE, "MPCore"),
- ARM_CPU_OPT ("arm1156t2-s", ARM_ARCH_V6T2, FPU_NONE, NULL),
- ARM_CPU_OPT ("arm1156t2f-s", ARM_ARCH_V6T2, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("arm1176jz-s", ARM_ARCH_V6KZ, FPU_NONE, NULL),
- ARM_CPU_OPT ("arm1176jzf-s", ARM_ARCH_V6KZ, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("cortex-a5", ARM_ARCH_V7A_MP_SEC,
- FPU_NONE, "Cortex-A5"),
- ARM_CPU_OPT ("cortex-a7", ARM_ARCH_V7VE, FPU_ARCH_NEON_VFP_V4,
- "Cortex-A7"),
- ARM_CPU_OPT ("cortex-a8", ARM_ARCH_V7A_SEC,
- ARM_FEATURE_COPROC (FPU_VFP_V3
- | FPU_NEON_EXT_V1),
- "Cortex-A8"),
- ARM_CPU_OPT ("cortex-a9", ARM_ARCH_V7A_MP_SEC,
- ARM_FEATURE_COPROC (FPU_VFP_V3
- | FPU_NEON_EXT_V1),
- "Cortex-A9"),
- ARM_CPU_OPT ("cortex-a12", ARM_ARCH_V7VE, FPU_ARCH_NEON_VFP_V4,
- "Cortex-A12"),
- ARM_CPU_OPT ("cortex-a15", ARM_ARCH_V7VE, FPU_ARCH_NEON_VFP_V4,
- "Cortex-A15"),
- ARM_CPU_OPT ("cortex-a17", ARM_ARCH_V7VE, FPU_ARCH_NEON_VFP_V4,
- "Cortex-A17"),
- ARM_CPU_OPT ("cortex-a32", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Cortex-A32"),
- ARM_CPU_OPT ("cortex-a35", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Cortex-A35"),
- ARM_CPU_OPT ("cortex-a53", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Cortex-A53"),
- ARM_CPU_OPT ("cortex-a57", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Cortex-A57"),
- ARM_CPU_OPT ("cortex-a72", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Cortex-A72"),
- ARM_CPU_OPT ("cortex-a73", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Cortex-A73"),
- ARM_CPU_OPT ("cortex-r4", ARM_ARCH_V7R, FPU_NONE, "Cortex-R4"),
- ARM_CPU_OPT ("cortex-r4f", ARM_ARCH_V7R, FPU_ARCH_VFP_V3D16,
- "Cortex-R4F"),
- ARM_CPU_OPT ("cortex-r5", ARM_ARCH_V7R_IDIV,
- FPU_NONE, "Cortex-R5"),
- ARM_CPU_OPT ("cortex-r7", ARM_ARCH_V7R_IDIV,
- FPU_ARCH_VFP_V3D16,
- "Cortex-R7"),
- ARM_CPU_OPT ("cortex-r8", ARM_ARCH_V7R_IDIV,
- FPU_ARCH_VFP_V3D16,
- "Cortex-R8"),
- ARM_CPU_OPT ("cortex-m33", ARM_ARCH_V8M_MAIN_DSP,
- FPU_NONE, "Cortex-M33"),
- ARM_CPU_OPT ("cortex-m23", ARM_ARCH_V8M_BASE,
- FPU_NONE, "Cortex-M23"),
- ARM_CPU_OPT ("cortex-m7", ARM_ARCH_V7EM, FPU_NONE, "Cortex-M7"),
- ARM_CPU_OPT ("cortex-m4", ARM_ARCH_V7EM, FPU_NONE, "Cortex-M4"),
- ARM_CPU_OPT ("cortex-m3", ARM_ARCH_V7M, FPU_NONE, "Cortex-M3"),
- ARM_CPU_OPT ("cortex-m1", ARM_ARCH_V6SM, FPU_NONE, "Cortex-M1"),
- ARM_CPU_OPT ("cortex-m0", ARM_ARCH_V6SM, FPU_NONE, "Cortex-M0"),
- ARM_CPU_OPT ("cortex-m0plus", ARM_ARCH_V6SM, FPU_NONE, "Cortex-M0+"),
- ARM_CPU_OPT ("exynos-m1", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Samsung " \
- "Exynos M1"),
- ARM_CPU_OPT ("falkor", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Qualcomm "
- "Falkor"),
- ARM_CPU_OPT ("qdf24xx", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "Qualcomm "
- "QDF24XX"),
+ ARM_CPU_OPT ("arm9e-r0", NULL, ARM_ARCH_V5TExP,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm9e", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm926ej", "ARM926EJ-S", ARM_ARCH_V5TEJ,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm926ejs", "ARM926EJ-S", ARM_ARCH_V5TEJ,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm926ej-s", NULL, ARM_ARCH_V5TEJ,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm946e-r0", NULL, ARM_ARCH_V5TExP,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm946e", "ARM946E-S", ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm946e-s", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm966e-r0", NULL, ARM_ARCH_V5TExP,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm966e", "ARM966E-S", ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm966e-s", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm968e-s", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm10t", NULL, ARM_ARCH_V5T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V1),
+ ARM_CPU_OPT ("arm10tdmi", NULL, ARM_ARCH_V5T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V1),
+ ARM_CPU_OPT ("arm10e", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm1020", "ARM1020E", ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm1020t", NULL, ARM_ARCH_V5T,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V1),
+ ARM_CPU_OPT ("arm1020e", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm1022e", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm1026ejs", "ARM1026EJ-S", ARM_ARCH_V5TEJ,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm1026ej-s", NULL, ARM_ARCH_V5TEJ,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("fa606te", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("fa616te", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("fa626te", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("fmp626", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("fa726te", NULL, ARM_ARCH_V5TE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm1136js", "ARM1136J-S", ARM_ARCH_V6,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("arm1136j-s", NULL, ARM_ARCH_V6,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("arm1136jfs", "ARM1136JF-S", ARM_ARCH_V6,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm1136jf-s", NULL, ARM_ARCH_V6,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("mpcore", "MPCore", ARM_ARCH_V6K,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("mpcorenovfp", "MPCore", ARM_ARCH_V6K,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("arm1156t2-s", NULL, ARM_ARCH_V6T2,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("arm1156t2f-s", NULL, ARM_ARCH_V6T2,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("arm1176jz-s", NULL, ARM_ARCH_V6KZ,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("arm1176jzf-s", NULL, ARM_ARCH_V6KZ,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("cortex-a5", "Cortex-A5", ARM_ARCH_V7A,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_MP | ARM_EXT_SEC),
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-a7", "Cortex-A7", ARM_ARCH_V7VE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_NEON_VFP_V4),
+ ARM_CPU_OPT ("cortex-a8", "Cortex-A8", ARM_ARCH_V7A,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_SEC),
+ ARM_FEATURE_COPROC (FPU_VFP_V3 | FPU_NEON_EXT_V1)),
+ ARM_CPU_OPT ("cortex-a9", "Cortex-A9", ARM_ARCH_V7A,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_MP | ARM_EXT_SEC),
+ ARM_FEATURE_COPROC (FPU_VFP_V3 | FPU_NEON_EXT_V1)),
+ ARM_CPU_OPT ("cortex-a12", "Cortex-A12", ARM_ARCH_V7VE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_NEON_VFP_V4),
+ ARM_CPU_OPT ("cortex-a15", "Cortex-A15", ARM_ARCH_V7VE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_NEON_VFP_V4),
+ ARM_CPU_OPT ("cortex-a17", "Cortex-A17", ARM_ARCH_V7VE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_NEON_VFP_V4),
+ ARM_CPU_OPT ("cortex-a32", "Cortex-A32", ARM_ARCH_V8A,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
+ ARM_CPU_OPT ("cortex-a35", "Cortex-A35", ARM_ARCH_V8A,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
+ ARM_CPU_OPT ("cortex-a53", "Cortex-A53", ARM_ARCH_V8A,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
+ ARM_CPU_OPT ("cortex-a57", "Cortex-A57", ARM_ARCH_V8A,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
+ ARM_CPU_OPT ("cortex-a72", "Cortex-A72", ARM_ARCH_V8A,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
+ ARM_CPU_OPT ("cortex-a73", "Cortex-A73", ARM_ARCH_V8A,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
+ ARM_CPU_OPT ("cortex-r4", "Cortex-R4", ARM_ARCH_V7R,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-r4f", "Cortex-R4F", ARM_ARCH_V7R,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V3D16),
+ ARM_CPU_OPT ("cortex-r5", "Cortex-R5", ARM_ARCH_V7R,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV),
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-r7", "Cortex-R7", ARM_ARCH_V7R,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV),
+ FPU_ARCH_VFP_V3D16),
+ ARM_CPU_OPT ("cortex-r8", "Cortex-R8", ARM_ARCH_V7R,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV),
+ FPU_ARCH_VFP_V3D16),
+ ARM_CPU_OPT ("cortex-r52", "Cortex-R52", ARM_ARCH_V8R,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_NEON_VFP_ARMV8),
+ ARM_CPU_OPT ("cortex-m33", "Cortex-M33", ARM_ARCH_V8M_MAIN,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_V5ExP | ARM_EXT_V6_DSP),
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-m23", "Cortex-M23", ARM_ARCH_V8M_BASE,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-m7", "Cortex-M7", ARM_ARCH_V7EM,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-m4", "Cortex-M4", ARM_ARCH_V7EM,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-m3", "Cortex-M3", ARM_ARCH_V7M,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-m1", "Cortex-M1", ARM_ARCH_V6SM,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-m0", "Cortex-M0", ARM_ARCH_V6SM,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("cortex-m0plus", "Cortex-M0+", ARM_ARCH_V6SM,
+ ARM_ARCH_NONE,
+ FPU_NONE),
+ ARM_CPU_OPT ("exynos-m1", "Samsung Exynos M1", ARM_ARCH_V8A,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
/* ??? XSCALE is really an architecture. */
- ARM_CPU_OPT ("xscale", ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2, NULL),
+ ARM_CPU_OPT ("xscale", NULL, ARM_ARCH_XSCALE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+
/* ??? iwmmxt is not a processor. */
- ARM_CPU_OPT ("iwmmxt", ARM_ARCH_IWMMXT, FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("iwmmxt2", ARM_ARCH_IWMMXT2,FPU_ARCH_VFP_V2, NULL),
- ARM_CPU_OPT ("i80200", ARM_ARCH_XSCALE, FPU_ARCH_VFP_V2, NULL),
+ ARM_CPU_OPT ("iwmmxt", NULL, ARM_ARCH_IWMMXT,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("iwmmxt2", NULL, ARM_ARCH_IWMMXT2,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+ ARM_CPU_OPT ("i80200", NULL, ARM_ARCH_XSCALE,
+ ARM_ARCH_NONE,
+ FPU_ARCH_VFP_V2),
+
/* Maverick */
- ARM_CPU_OPT ("ep9312", ARM_FEATURE_LOW (ARM_AEXT_V4T, ARM_CEXT_MAVERICK),
- FPU_ARCH_MAVERICK, "ARM920T"),
+ ARM_CPU_OPT ("ep9312", "ARM920T",
+ ARM_FEATURE_LOW (ARM_AEXT_V4T, ARM_CEXT_MAVERICK),
+ ARM_ARCH_NONE, FPU_ARCH_MAVERICK),
+
/* Marvell processors. */
- ARM_CPU_OPT ("marvell-pj4", ARM_FEATURE_CORE (ARM_AEXT_V7A | ARM_EXT_MP
- | ARM_EXT_SEC,
- ARM_EXT2_V6T2_V8M),
- FPU_ARCH_VFP_V3D16, NULL),
- ARM_CPU_OPT ("marvell-whitney", ARM_FEATURE_CORE (ARM_AEXT_V7A | ARM_EXT_MP
- | ARM_EXT_SEC,
- ARM_EXT2_V6T2_V8M),
- FPU_ARCH_NEON_VFP_V4, NULL),
- /* APM X-Gene family. */
- ARM_CPU_OPT ("xgene1", ARM_ARCH_V8A, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "APM X-Gene 1"),
- ARM_CPU_OPT ("xgene2", ARM_ARCH_V8A_CRC, FPU_ARCH_CRYPTO_NEON_VFP_ARMV8,
- "APM X-Gene 2"),
+ ARM_CPU_OPT ("marvell-pj4", NULL, ARM_ARCH_V7A,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_MP | ARM_EXT_SEC),
+ FPU_ARCH_VFP_V3D16),
+ ARM_CPU_OPT ("marvell-whitney", NULL, ARM_ARCH_V7A,
+ ARM_FEATURE_CORE_LOW (ARM_EXT_MP | ARM_EXT_SEC),
+ FPU_ARCH_NEON_VFP_V4),
- { NULL, 0, ARM_ARCH_NONE, ARM_ARCH_NONE, NULL }
+ /* APM X-Gene family. */
+ ARM_CPU_OPT ("xgene1", "APM X-Gene 1", ARM_ARCH_V8A,
+ ARM_ARCH_NONE,
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
+ ARM_CPU_OPT ("xgene2", "APM X-Gene 2", ARM_ARCH_V8A,
+ ARM_FEATURE_COPROC (CRC_EXT_ARMV8),
+ FPU_ARCH_CRYPTO_NEON_VFP_ARMV8),
+
+ { NULL, 0, ARM_ARCH_NONE, ARM_ARCH_NONE, ARM_ARCH_NONE, NULL }
};
#undef ARM_CPU_OPT
@@ -25690,6 +25918,7 @@ static const struct arm_arch_option_table arm_archs[] =
ARM_ARCH_OPT ("armv8.1-a", ARM_ARCH_V8_1A, FPU_ARCH_VFP),
ARM_ARCH_OPT ("armv8.2-a", ARM_ARCH_V8_2A, FPU_ARCH_VFP),
ARM_ARCH_OPT ("armv8.3-a", ARM_ARCH_V8_3A, FPU_ARCH_VFP),
+ ARM_ARCH_OPT ("armv8-r", ARM_ARCH_V8R, FPU_ARCH_VFP),
ARM_ARCH_OPT ("xscale", ARM_ARCH_XSCALE, FPU_ARCH_VFP),
ARM_ARCH_OPT ("iwmmxt", ARM_ARCH_IWMMXT, FPU_ARCH_VFP),
ARM_ARCH_OPT ("iwmmxt2", ARM_ARCH_IWMMXT2,FPU_ARCH_VFP),
@@ -25733,6 +25962,13 @@ static const struct arm_option_extension_value_table arm_extensions[] =
ARM_FEATURE_CORE_LOW (ARM_EXT_ADIV | ARM_EXT_DIV),
ARM_FEATURE_CORE_LOW (ARM_EXT_V7A),
ARM_FEATURE_CORE_LOW (ARM_EXT_V7R)),
+ /* Duplicate entry for the purpose of allowing ARMv7 to match in presence of
+ Thumb divide instruction. Due to this having the same name as the
+ previous entry, this will be ignored when doing command-line parsing and
+ only considered by build attribute selection code. */
+ ARM_EXT_OPT ("idiv", ARM_FEATURE_CORE_LOW (ARM_EXT_DIV),
+ ARM_FEATURE_CORE_LOW (ARM_EXT_DIV),
+ ARM_FEATURE_CORE_LOW (ARM_EXT_V7)),
ARM_EXT_OPT ("iwmmxt",ARM_FEATURE_COPROC (ARM_CEXT_IWMMXT),
ARM_FEATURE_COPROC (ARM_CEXT_IWMMXT), ARM_ARCH_NONE),
ARM_EXT_OPT ("iwmmxt2", ARM_FEATURE_COPROC (ARM_CEXT_IWMMXT2),
@@ -25748,13 +25984,13 @@ static const struct arm_option_extension_value_table arm_extensions[] =
ARM_FEATURE_CORE_LOW (ARM_EXT_V6M)),
ARM_EXT_OPT ("pan", ARM_FEATURE_CORE_HIGH (ARM_EXT2_PAN),
ARM_FEATURE (ARM_EXT_V8, ARM_EXT2_PAN, 0),
- ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
+ ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8A)),
ARM_EXT_OPT ("ras", ARM_FEATURE_CORE_HIGH (ARM_EXT2_RAS),
ARM_FEATURE (ARM_EXT_V8, ARM_EXT2_RAS, 0),
- ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
+ ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8A)),
ARM_EXT_OPT ("rdma", FPU_ARCH_NEON_VFP_ARMV8_1,
ARM_FEATURE_COPROC (FPU_NEON_ARMV8 | FPU_NEON_EXT_RDMA),
- ARM_FEATURE_CORE_LOW (ARM_EXT_V8)),
+ ARM_FEATURE_CORE_HIGH (ARM_EXT2_V8A)),
ARM_EXT_OPT2 ("sec", ARM_FEATURE_CORE_LOW (ARM_EXT_SEC),
ARM_FEATURE_CORE_LOW (ARM_EXT_SEC),
ARM_FEATURE_CORE_LOW (ARM_EXT_V6K),
@@ -25864,10 +26100,9 @@ struct arm_long_option_table
};
static bfd_boolean
-arm_parse_extension (const char *str, const arm_feature_set **opt_p)
+arm_parse_extension (const char *str, const arm_feature_set *opt_set,
+ arm_feature_set **ext_set_p)
{
- arm_feature_set *ext_set = XNEW (arm_feature_set);
-
/* We insist on extensions being specified in alphabetical order, and with
extensions being added before being removed. We achieve this by having
the global ARM_EXTENSIONS table in alphabetical order, and using the
@@ -25878,9 +26113,11 @@ arm_parse_extension (const char *str, const arm_feature_set **opt_p)
const arm_feature_set arm_any = ARM_ANY;
int adding_value = -1;
- /* Copy the feature set, so that we can modify it. */
- *ext_set = **opt_p;
- *opt_p = ext_set;
+ if (!*ext_set_p)
+ {
+ *ext_set_p = XNEW (arm_feature_set);
+ **ext_set_p = arm_arch_none;
+ }
while (str != NULL && *str != 0)
{
@@ -25948,7 +26185,7 @@ arm_parse_extension (const char *str, const arm_feature_set **opt_p)
/* Empty entry. */
if (ARM_FEATURE_EQUAL (opt->allowed_archs[i], arm_any))
continue;
- if (ARM_FSET_CPU_SUBSET (opt->allowed_archs[i], *ext_set))
+ if (ARM_FSET_CPU_SUBSET (opt->allowed_archs[i], *opt_set))
break;
}
if (i == nb_allowed_archs)
@@ -25959,10 +26196,15 @@ arm_parse_extension (const char *str, const arm_feature_set **opt_p)
/* Add or remove the extension. */
if (adding_value)
- ARM_MERGE_FEATURE_SETS (*ext_set, *ext_set, opt->merge_value);
+ ARM_MERGE_FEATURE_SETS (**ext_set_p, **ext_set_p,
+ opt->merge_value);
else
- ARM_CLEAR_FEATURE (*ext_set, *ext_set, opt->clear_value);
+ ARM_CLEAR_FEATURE (**ext_set_p, **ext_set_p, opt->clear_value);
+ /* Allowing Thumb division instructions for ARMv7 in autodetection
+ rely on this break so that duplicate extensions (extensions
+ with the same name as a previous extension in the list) are not
+ considered for command-line parsing. */
break;
}
@@ -26018,6 +26260,9 @@ arm_parse_cpu (const char *str)
if (opt->name_len == len && strncmp (opt->name, str, len) == 0)
{
mcpu_cpu_opt = &opt->value;
+ if (!dyn_mcpu_ext_opt)
+ dyn_mcpu_ext_opt = XNEW (arm_feature_set);
+ *dyn_mcpu_ext_opt = opt->ext;
mcpu_fpu_opt = &opt->default_fpu;
if (opt->canonical_name)
{
@@ -26037,7 +26282,7 @@ arm_parse_cpu (const char *str)
}
if (ext != NULL)
- return arm_parse_extension (ext, &mcpu_cpu_opt);
+ return arm_parse_extension (ext, mcpu_cpu_opt, &dyn_mcpu_ext_opt);
return TRUE;
}
@@ -26072,7 +26317,7 @@ arm_parse_arch (const char *str)
strcpy (selected_cpu_name, opt->name);
if (ext != NULL)
- return arm_parse_extension (ext, &march_cpu_opt);
+ return arm_parse_extension (ext, march_cpu_opt, &dyn_march_ext_opt);
return TRUE;
}
@@ -26312,30 +26557,62 @@ typedef struct
arm_feature_set flags;
} cpu_arch_ver_table;
-/* Mapping from CPU features to EABI CPU arch values. As a general rule, table
- must be sorted least features first but some reordering is needed, eg. for
- Thumb-2 instructions to be detected as coming from ARMv6T2. */
+/* Mapping from CPU features to EABI CPU arch values. Table must be sorted
+ chronologically for architectures, with an exception for ARMv6-M and
+ ARMv6S-M due to legacy reasons. No new architecture should have a
+ special case. This allows for build attribute selection results to be
+ stable when new architectures are added. */
static const cpu_arch_ver_table cpu_arch_ver[] =
{
+ {0, ARM_ARCH_V1},
+ {0, ARM_ARCH_V2},
+ {0, ARM_ARCH_V2S},
+ {0, ARM_ARCH_V3},
+ {0, ARM_ARCH_V3M},
+ {1, ARM_ARCH_V4xM},
{1, ARM_ARCH_V4},
+ {2, ARM_ARCH_V4TxM},
{2, ARM_ARCH_V4T},
+ {3, ARM_ARCH_V5xM},
{3, ARM_ARCH_V5},
+ {3, ARM_ARCH_V5TxM},
{3, ARM_ARCH_V5T},
+ {4, ARM_ARCH_V5TExP},
{4, ARM_ARCH_V5TE},
{5, ARM_ARCH_V5TEJ},
{6, ARM_ARCH_V6},
- {9, ARM_ARCH_V6K},
{7, ARM_ARCH_V6Z},
+ {7, ARM_ARCH_V6KZ},
+ {9, ARM_ARCH_V6K},
+ {8, ARM_ARCH_V6T2},
+ {8, ARM_ARCH_V6KT2},
+ {8, ARM_ARCH_V6ZT2},
+ {8, ARM_ARCH_V6KZT2},
+
+ /* When assembling a file with only ARMv6-M or ARMv6S-M instruction, GNU as
+ always selected build attributes to match those of ARMv6-M
+ (resp. ARMv6S-M). However, due to these architectures being a strict
+ subset of ARMv7-M in terms of instructions available, ARMv7-M attributes
+ would be selected when fully respecting chronology of architectures.
+ It is thus necessary to make a special case of ARMv6-M and ARMv6S-M and
+ move them before ARMv7 architectures. */
{11, ARM_ARCH_V6M},
{12, ARM_ARCH_V6SM},
- {8, ARM_ARCH_V6T2},
- {10, ARM_ARCH_V7VE},
+
+ {10, ARM_ARCH_V7},
+ {10, ARM_ARCH_V7A},
{10, ARM_ARCH_V7R},
{10, ARM_ARCH_V7M},
+ {10, ARM_ARCH_V7VE},
+ {13, ARM_ARCH_V7EM},
{14, ARM_ARCH_V8A},
+ {14, ARM_ARCH_V8_1A},
+ {14, ARM_ARCH_V8_2A},
+ {14, ARM_ARCH_V8_3A},
{16, ARM_ARCH_V8M_BASE},
{17, ARM_ARCH_V8M_MAIN},
- {0, ARM_ARCH_NONE}
+ {15, ARM_ARCH_V8R},
+ {-1, ARM_ARCH_NONE}
};
/* Set an attribute if it has not already been set by the user. */
@@ -26357,92 +26634,210 @@ aeabi_set_attribute_string (int tag, const char *value)
bfd_elf_add_proc_attr_string (stdoutput, tag, value);
}
-/* Set the public EABI object attributes. */
-void
-aeabi_set_public_attributes (void)
+/* Return whether features in the *NEEDED feature set are available via
+ extensions for the architecture whose feature set is *ARCH_FSET. */
+static bfd_boolean
+have_ext_for_needed_feat_p (const arm_feature_set *arch_fset,
+ const arm_feature_set *needed)
{
- int arch;
- char profile;
- int virt_sec = 0;
- int fp16_optional = 0;
- arm_feature_set arm_arch = ARM_ARCH_NONE;
- arm_feature_set flags;
- arm_feature_set tmp;
- arm_feature_set arm_arch_v8m_base = ARM_ARCH_V8M_BASE;
- const cpu_arch_ver_table *p;
+ int i, nb_allowed_archs;
+ arm_feature_set ext_fset;
+ const struct arm_option_extension_value_table *opt;
- /* Choose the architecture based on the capabilities of the requested cpu
- (if any) and/or the instructions actually used. */
- ARM_MERGE_FEATURE_SETS (flags, arm_arch_used, thumb_arch_used);
- ARM_MERGE_FEATURE_SETS (flags, flags, *mfpu_opt);
- ARM_MERGE_FEATURE_SETS (flags, flags, selected_cpu);
+ ext_fset = arm_arch_none;
+ for (opt = arm_extensions; opt->name != NULL; opt++)
+ {
+ /* Extension does not provide any feature we need. */
+ if (!ARM_CPU_HAS_FEATURE (*needed, opt->merge_value))
+ continue;
+
+ nb_allowed_archs =
+ sizeof (opt->allowed_archs) / sizeof (opt->allowed_archs[0]);
+ for (i = 0; i < nb_allowed_archs; i++)
+ {
+ /* Empty entry. */
+ if (ARM_FEATURE_EQUAL (opt->allowed_archs[i], arm_arch_any))
+ break;
- if (ARM_CPU_HAS_FEATURE (arm_arch_used, arm_arch_any))
- ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v1);
+ /* Extension is available, add it. */
+ if (ARM_FSET_CPU_SUBSET (opt->allowed_archs[i], *arch_fset))
+ ARM_MERGE_FEATURE_SETS (ext_fset, ext_fset, opt->merge_value);
+ }
+ }
- if (ARM_CPU_HAS_FEATURE (thumb_arch_used, arm_arch_any))
- ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v4t);
+ /* Can we enable all features in *needed? */
+ return ARM_FSET_CPU_SUBSET (*needed, ext_fset);
+}
- selected_cpu = flags;
+/* Select value for Tag_CPU_arch and Tag_CPU_arch_profile build attributes for
+ a given architecture feature set *ARCH_EXT_FSET including extension feature
+ set *EXT_FSET. Selection logic used depend on EXACT_MATCH:
+ - if true, check for an exact match of the architecture modulo extensions;
+ - otherwise, select build attribute value of the first superset
+ architecture released so that results remains stable when new architectures
+ are added.
+ For -march/-mcpu=all the build attribute value of the most featureful
+ architecture is returned. Tag_CPU_arch_profile result is returned in
+ PROFILE. */
+static int
+get_aeabi_cpu_arch_from_fset (const arm_feature_set *arch_ext_fset,
+ const arm_feature_set *ext_fset,
+ char *profile, int exact_match)
+{
+ arm_feature_set arch_fset;
+ const cpu_arch_ver_table *p_ver, *p_ver_ret = NULL;
- /* Allow the user to override the reported architecture. */
- if (object_arch)
+ /* Select most featureful architecture with all its extensions if building
+ for -march=all as the feature sets used to set build attributes. */
+ if (ARM_FEATURE_EQUAL (*arch_ext_fset, arm_arch_any))
{
- ARM_CLEAR_FEATURE (flags, flags, arm_arch_any);
- ARM_MERGE_FEATURE_SETS (flags, flags, *object_arch);
+ /* Force revisiting of decision for each new architecture. */
+ gas_assert (MAX_TAG_CPU_ARCH <= TAG_CPU_ARCH_V8M_MAIN);
+ *profile = 'A';
+ return TAG_CPU_ARCH_V8;
}
- /* We need to make sure that the attributes do not identify us as v6S-M
- when the only v6S-M feature in use is the Operating System Extensions. */
- if (ARM_CPU_HAS_FEATURE (flags, arm_ext_os))
- if (!ARM_CPU_HAS_FEATURE (flags, arm_arch_v6m_only))
- ARM_CLEAR_FEATURE (flags, flags, arm_ext_os);
+ ARM_CLEAR_FEATURE (arch_fset, *arch_ext_fset, *ext_fset);
- tmp = flags;
- arch = 0;
- for (p = cpu_arch_ver; p->val; p++)
+ for (p_ver = cpu_arch_ver; p_ver->val != -1; p_ver++)
{
- if (ARM_CPU_HAS_FEATURE (tmp, p->flags))
+ arm_feature_set known_arch_fset;
+
+ ARM_CLEAR_FEATURE (known_arch_fset, p_ver->flags, fpu_any);
+ if (exact_match)
{
- arch = p->val;
- arm_arch = p->flags;
- ARM_CLEAR_FEATURE (tmp, tmp, p->flags);
+ /* Base architecture match user-specified architecture and
+ extensions, eg. ARMv6S-M matching -march=armv6-m+os. */
+ if (ARM_FEATURE_EQUAL (*arch_ext_fset, known_arch_fset))
+ {
+ p_ver_ret = p_ver;
+ goto found;
+ }
+ /* Base architecture match user-specified architecture only
+ (eg. ARMv6-M in the same case as above). Record it in case we
+ find a match with above condition. */
+ else if (p_ver_ret == NULL
+ && ARM_FEATURE_EQUAL (arch_fset, known_arch_fset))
+ p_ver_ret = p_ver;
}
- }
+ else
+ {
- /* The table lookup above finds the last architecture to contribute
- a new feature. Unfortunately, Tag13 is a subset of the union of
- v6T2 and v7-M, so it is never seen as contributing a new feature.
- We can not search for the last entry which is entirely used,
- because if no CPU is specified we build up only those flags
- actually used. Perhaps we should separate out the specified
- and implicit cases. Avoid taking this path for -march=all by
- checking for contradictory v7-A / v7-M features. */
- if (arch == TAG_CPU_ARCH_V7
- && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
- && ARM_CPU_HAS_FEATURE (flags, arm_ext_v7m)
- && ARM_CPU_HAS_FEATURE (flags, arm_ext_v6_dsp))
- {
- arch = TAG_CPU_ARCH_V7E_M;
- arm_arch = (arm_feature_set) ARM_ARCH_V7EM;
+ /* Architecture has all features wanted. */
+ if (ARM_FSET_CPU_SUBSET (arch_fset, known_arch_fset))
+ {
+ arm_feature_set added_fset;
+
+ /* Compute features added by this architecture over the one
+ recorded in p_ver_ret. */
+ if (p_ver_ret != NULL)
+ ARM_CLEAR_FEATURE (added_fset, known_arch_fset,
+ p_ver_ret->flags);
+ /* First architecture that match incl. with extensions, or the
+ only difference in features over the recorded match is
+ features that were optional and are now mandatory. */
+ if (p_ver_ret == NULL
+ || ARM_FSET_CPU_SUBSET (added_fset, arch_fset))
+ {
+ p_ver_ret = p_ver;
+ goto found;
+ }
+ }
+ else if (p_ver_ret == NULL)
+ {
+ arm_feature_set needed_ext_fset;
+
+ ARM_CLEAR_FEATURE (needed_ext_fset, arch_fset, known_arch_fset);
+
+ /* Architecture has all features needed when using some
+ extensions. Record it and continue searching in case there
+ exist an architecture providing all needed features without
+ the need for extensions (eg. ARMv6S-M Vs ARMv6-M with
+ OS extension). */
+ if (have_ext_for_needed_feat_p (&known_arch_fset,
+ &needed_ext_fset))
+ p_ver_ret = p_ver;
+ }
+ }
}
- ARM_CLEAR_FEATURE (tmp, flags, arm_arch_v8m_base);
- if (arch == TAG_CPU_ARCH_V8M_BASE && ARM_CPU_HAS_FEATURE (tmp, arm_arch_any))
+ if (p_ver_ret == NULL)
+ return -1;
+
+found:
+ /* Tag_CPU_arch_profile. */
+ if (ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_v7a)
+ || ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_v8)
+ || (ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_atomics)
+ && !ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_v8m_m_only)))
+ *profile = 'A';
+ else if (ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_v7r))
+ *profile = 'R';
+ else if (ARM_CPU_HAS_FEATURE (p_ver_ret->flags, arm_ext_m))
+ *profile = 'M';
+ else
+ *profile = '\0';
+ return p_ver_ret->val;
+}
+
+/* Set the public EABI object attributes. */
+static void
+aeabi_set_public_attributes (void)
+{
+ char profile;
+ int arch = -1;
+ int virt_sec = 0;
+ int fp16_optional = 0;
+ int skip_exact_match = 0;
+ arm_feature_set flags, flags_arch, flags_ext;
+
+ /* Autodetection mode, choose the architecture based the instructions
+ actually used. */
+ if (no_cpu_selected ())
{
- arch = TAG_CPU_ARCH_V8M_MAIN;
- arm_arch = (arm_feature_set) ARM_ARCH_V8M_MAIN;
+ ARM_MERGE_FEATURE_SETS (flags, arm_arch_used, thumb_arch_used);
+
+ if (ARM_CPU_HAS_FEATURE (arm_arch_used, arm_arch_any))
+ ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v1);
+
+ if (ARM_CPU_HAS_FEATURE (thumb_arch_used, arm_arch_any))
+ ARM_MERGE_FEATURE_SETS (flags, flags, arm_ext_v4t);
+
+ /* Code run during relaxation relies on selected_cpu being set. */
+ selected_cpu = flags;
}
+ /* Otherwise, choose the architecture based on the capabilities of the
+ requested cpu. */
+ else
+ flags = selected_cpu;
+ ARM_MERGE_FEATURE_SETS (flags, flags, *mfpu_opt);
- /* In cpu_arch_ver ARMv8-A is before ARMv8-M for atomics to be detected as
- coming from ARMv8-A. However, since ARMv8-A has more instructions than
- ARMv8-M, -march=all must be detected as ARMv8-A. */
- if (arch == TAG_CPU_ARCH_V8M_MAIN
- && ARM_FEATURE_CORE_EQUAL (selected_cpu, arm_arch_any))
+ /* Allow the user to override the reported architecture. */
+ if (object_arch)
{
- arch = TAG_CPU_ARCH_V8;
- arm_arch = (arm_feature_set) ARM_ARCH_V8A;
+ ARM_CLEAR_FEATURE (flags_arch, *object_arch, fpu_any);
+ flags_ext = arm_arch_none;
}
+ else
+ {
+ ARM_CLEAR_FEATURE (flags_arch, flags, fpu_any);
+ flags_ext = dyn_mcpu_ext_opt ? *dyn_mcpu_ext_opt : arm_arch_none;
+ skip_exact_match = ARM_FEATURE_EQUAL (selected_cpu, arm_arch_any);
+ }
+
+ /* When this function is run again after relaxation has happened there is no
+ way to determine whether an architecture or CPU was specified by the user:
+ - selected_cpu is set above for relaxation to work;
+ - march_cpu_opt is not set if only -mcpu or .cpu is used;
+ - mcpu_cpu_opt is set to arm_arch_any for autodetection.
+ Therefore, if not in -march=all case we first try an exact match and fall
+ back to autodetection. */
+ if (!skip_exact_match)
+ arch = get_aeabi_cpu_arch_from_fset (&flags_arch, &flags_ext, &profile, 1);
+ if (arch == -1)
+ arch = get_aeabi_cpu_arch_from_fset (&flags_arch, &flags_ext, &profile, 0);
+ if (arch == -1)
+ as_bad (_("no architecture contains all the instructions used\n"));
/* Tag_CPU_name. */
if (selected_cpu_name[0])
@@ -26465,40 +26860,22 @@ aeabi_set_public_attributes (void)
aeabi_set_attribute_int (Tag_CPU_arch, arch);
/* Tag_CPU_arch_profile. */
- if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7a)
- || ARM_CPU_HAS_FEATURE (flags, arm_ext_v8)
- || (ARM_CPU_HAS_FEATURE (flags, arm_ext_atomics)
- && !ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m_m_only)))
- profile = 'A';
- else if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v7r))
- profile = 'R';
- else if (ARM_CPU_HAS_FEATURE (flags, arm_ext_m))
- profile = 'M';
- else
- profile = '\0';
-
if (profile != '\0')
aeabi_set_attribute_int (Tag_CPU_arch_profile, profile);
/* Tag_DSP_extension. */
- if (ARM_CPU_HAS_FEATURE (flags, arm_ext_dsp))
- {
- arm_feature_set ext;
-
- /* DSP instructions not in architecture. */
- ARM_CLEAR_FEATURE (ext, flags, arm_arch);
- if (ARM_CPU_HAS_FEATURE (ext, arm_ext_dsp))
- aeabi_set_attribute_int (Tag_DSP_extension, 1);
- }
+ if (dyn_mcpu_ext_opt && ARM_CPU_HAS_FEATURE (*dyn_mcpu_ext_opt, arm_ext_dsp))
+ aeabi_set_attribute_int (Tag_DSP_extension, 1);
+ ARM_CLEAR_FEATURE (flags_arch, flags, fpu_any);
/* Tag_ARM_ISA_use. */
if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v1)
- || arch == 0)
+ || ARM_FEATURE_ZERO (flags_arch))
aeabi_set_attribute_int (Tag_ARM_ISA_use, 1);
/* Tag_THUMB_ISA_use. */
if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v4t)
- || arch == 0)
+ || ARM_FEATURE_ZERO (flags_arch))
{
int thumb_isa_use;
@@ -26580,9 +26957,7 @@ aeabi_set_public_attributes (void)
by the base architecture.
For new architectures we will have to check these tests. */
- gas_assert (arch <= TAG_CPU_ARCH_V8
- || (arch >= TAG_CPU_ARCH_V8M_BASE
- && arch <= TAG_CPU_ARCH_V8M_MAIN));
+ gas_assert (arch <= TAG_CPU_ARCH_V8M_MAIN);
if (ARM_CPU_HAS_FEATURE (flags, arm_ext_v8)
|| ARM_CPU_HAS_FEATURE (flags, arm_ext_v8m))
aeabi_set_attribute_int (Tag_DIV_use, 0);
@@ -26605,6 +26980,18 @@ aeabi_set_public_attributes (void)
aeabi_set_attribute_int (Tag_Virtualization_use, virt_sec);
}
+/* Post relaxation hook. Recompute ARM attributes now that relaxation is
+ finished and free extension feature bits which will not be used anymore. */
+void
+arm_md_post_relax (void)
+{
+ aeabi_set_public_attributes ();
+ XDELETE (dyn_mcpu_ext_opt);
+ dyn_mcpu_ext_opt = NULL;
+ XDELETE (dyn_march_ext_opt);
+ dyn_march_ext_opt = NULL;
+}
+
/* Add the default contents for the .ARM.attributes section. */
void
arm_md_end (void)
@@ -26637,7 +27024,10 @@ s_arm_cpu (int ignored ATTRIBUTE_UNUSED)
if (streq (opt->name, name))
{
mcpu_cpu_opt = &opt->value;
- selected_cpu = opt->value;
+ if (!dyn_mcpu_ext_opt)
+ dyn_mcpu_ext_opt = XNEW (arm_feature_set);
+ *dyn_mcpu_ext_opt = opt->ext;
+ ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
if (opt->canonical_name)
strcpy (selected_cpu_name, opt->canonical_name);
else
@@ -26649,6 +27039,8 @@ s_arm_cpu (int ignored ATTRIBUTE_UNUSED)
selected_cpu_name[i] = 0;
}
ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
+ if (dyn_mcpu_ext_opt)
+ ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
*input_line_pointer = saved_char;
demand_empty_rest_of_line ();
return;
@@ -26679,9 +27071,11 @@ s_arm_arch (int ignored ATTRIBUTE_UNUSED)
if (streq (opt->name, name))
{
mcpu_cpu_opt = &opt->value;
- selected_cpu = opt->value;
+ XDELETE (dyn_mcpu_ext_opt);
+ dyn_mcpu_ext_opt = NULL;
+ selected_cpu = *mcpu_cpu_opt;
strcpy (selected_cpu_name, opt->name);
- ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
+ ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, *mfpu_opt);
*input_line_pointer = saved_char;
demand_empty_rest_of_line ();
return;
@@ -26768,16 +27162,26 @@ s_arm_arch_extension (int ignored ATTRIBUTE_UNUSED)
break;
}
+ if (!dyn_mcpu_ext_opt)
+ {
+ dyn_mcpu_ext_opt = XNEW (arm_feature_set);
+ *dyn_mcpu_ext_opt = arm_arch_none;
+ }
if (adding_value)
- ARM_MERGE_FEATURE_SETS (selected_cpu, selected_cpu,
+ ARM_MERGE_FEATURE_SETS (*dyn_mcpu_ext_opt, *dyn_mcpu_ext_opt,
opt->merge_value);
else
- ARM_CLEAR_FEATURE (selected_cpu, selected_cpu, opt->clear_value);
+ ARM_CLEAR_FEATURE (*dyn_mcpu_ext_opt, *dyn_mcpu_ext_opt,
+ opt->clear_value);
- mcpu_cpu_opt = &selected_cpu;
- ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
+ ARM_MERGE_FEATURE_SETS (selected_cpu, *mcpu_cpu_opt, *dyn_mcpu_ext_opt);
+ ARM_MERGE_FEATURE_SETS (cpu_variant, selected_cpu, *mfpu_opt);
*input_line_pointer = saved_char;
demand_empty_rest_of_line ();
+ /* Allowing Thumb division instructions for ARMv7 in autodetection rely
+ on this return so that duplicate extensions (extensions with the
+ same name as a previous extension in the list) are not considered
+ for command-line parsing. */
return;
}
@@ -26808,6 +27212,8 @@ s_arm_fpu (int ignored ATTRIBUTE_UNUSED)
{
mfpu_opt = &opt->value;
ARM_MERGE_FEATURE_SETS (cpu_variant, *mcpu_cpu_opt, *mfpu_opt);
+ if (dyn_mcpu_ext_opt)
+ ARM_MERGE_FEATURE_SETS (cpu_variant, cpu_variant, *dyn_mcpu_ext_opt);
*input_line_pointer = saved_char;
demand_empty_rest_of_line ();
return;
diff --git a/gas/config/tc-arm.h b/gas/config/tc-arm.h
index 53c4986..1187d19 100644
--- a/gas/config/tc-arm.h
+++ b/gas/config/tc-arm.h
@@ -118,8 +118,8 @@ extern bfd_boolean tc_start_label_without_colon (void);
extern void arm_md_end (void);
bfd_boolean arm_is_eabi (void);
-#define md_post_relax_hook aeabi_set_public_attributes ()
-extern void aeabi_set_public_attributes (void);
+#define md_post_relax_hook arm_md_post_relax ()
+extern void arm_md_post_relax (void);
#endif
/* NOTE: The fake label creation in stabs.c:s_stab_generic() has
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 6c1091e..456be9e 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -3713,13 +3713,8 @@ md_assemble (char *line)
as_bad (_("expecting valid branch instruction after `bnd'"));
/* Check NOTRACK prefix. */
- if (i.notrack_prefix
- && (!i.tm.opcode_modifier.notrackprefixok
- || i.reg_operands != 1
- || i.disp_operands != 0
- || i.mem_operands != 0
- || i.imm_operands != 0))
- as_bad (_("expecting register indirect branch instruction after `notrack'"));
+ if (i.notrack_prefix && !i.tm.opcode_modifier.notrackprefixok)
+ as_bad (_("expecting indirect branch instruction after `notrack'"));
if (i.tm.cpu_flags.bitfield.cpumpx)
{
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 0a9817a..afda6c5 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -1445,8 +1445,8 @@ rvc_lui:
my_getExpression (imm_expr, s);
check_absolute_expr (ip, imm_expr);
if ((unsigned long) imm_expr->X_add_number > 31)
- as_warn (_("Improper shift amount (%lu)"),
- (unsigned long) imm_expr->X_add_number);
+ as_bad (_("Improper shift amount (%lu)"),
+ (unsigned long) imm_expr->X_add_number);
INSERT_OPERAND (SHAMTW, *ip, imm_expr->X_add_number);
imm_expr->X_op = O_absent;
s = expr_end;
@@ -1456,8 +1456,8 @@ rvc_lui:
my_getExpression (imm_expr, s);
check_absolute_expr (ip, imm_expr);
if ((unsigned long) imm_expr->X_add_number >= xlen)
- as_warn (_("Improper shift amount (%lu)"),
- (unsigned long) imm_expr->X_add_number);
+ as_bad (_("Improper shift amount (%lu)"),
+ (unsigned long) imm_expr->X_add_number);
INSERT_OPERAND (SHAMT, *ip, imm_expr->X_add_number);
imm_expr->X_op = O_absent;
s = expr_end;
@@ -1467,8 +1467,8 @@ rvc_lui:
my_getExpression (imm_expr, s);
check_absolute_expr (ip, imm_expr);
if ((unsigned long) imm_expr->X_add_number > 31)
- as_warn (_("Improper CSRxI immediate (%lu)"),
- (unsigned long) imm_expr->X_add_number);
+ as_bad (_("Improper CSRxI immediate (%lu)"),
+ (unsigned long) imm_expr->X_add_number);
INSERT_OPERAND (RS1, *ip, imm_expr->X_add_number);
imm_expr->X_op = O_absent;
s = expr_end;
@@ -1482,8 +1482,8 @@ rvc_lui:
my_getExpression (imm_expr, s);
check_absolute_expr (ip, imm_expr);
if ((unsigned long) imm_expr->X_add_number > 0xfff)
- as_warn (_("Improper CSR address (%lu)"),
- (unsigned long) imm_expr->X_add_number);
+ as_bad (_("Improper CSR address (%lu)"),
+ (unsigned long) imm_expr->X_add_number);
INSERT_OPERAND (CSR, *ip, imm_expr->X_add_number);
imm_expr->X_op = O_absent;
s = expr_end;
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index e1efaae..836b550 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -72,13 +72,13 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
/* Flags to indicate whether the hardware supports the density and
absolute literals options. */
-bfd_boolean density_supported = XCHAL_HAVE_DENSITY;
-bfd_boolean absolute_literals_supported = XSHAL_USE_ABSOLUTE_LITERALS;
+bfd_boolean density_supported;
+bfd_boolean absolute_literals_supported;
static vliw_insn cur_vinsn;
unsigned xtensa_num_pipe_stages;
-unsigned xtensa_fetch_width = XCHAL_INST_FETCH_WIDTH;
+unsigned xtensa_fetch_width;
static enum debug_info_type xt_saved_debug_type = DEBUG_NONE;
@@ -419,21 +419,13 @@ bfd_boolean directive_state[] =
{
FALSE, /* none */
FALSE, /* literal */
-#if !XCHAL_HAVE_DENSITY
FALSE, /* density */
-#else
- TRUE, /* density */
-#endif
TRUE, /* transform */
FALSE, /* freeregs */
FALSE, /* longcalls */
FALSE, /* literal_prefix */
FALSE, /* schedule */
-#if XSHAL_USE_ABSOLUTE_LITERALS
- TRUE /* absolute_literals */
-#else
FALSE /* absolute_literals */
-#endif
};
/* A circular list of all potential and actual literal pool locations
@@ -5216,6 +5208,24 @@ md_number_to_chars (char *buf, valueT val, int n)
number_to_chars_littleendian (buf, val, n);
}
+static void
+xg_init_global_config (void)
+{
+ target_big_endian = XCHAL_HAVE_BE;
+
+ density_supported = XCHAL_HAVE_DENSITY;
+ absolute_literals_supported = XSHAL_USE_ABSOLUTE_LITERALS;
+ xtensa_fetch_width = XCHAL_INST_FETCH_WIDTH;
+
+ directive_state[directive_density] = XCHAL_HAVE_DENSITY;
+ directive_state[directive_absolute_literals] = XSHAL_USE_ABSOLUTE_LITERALS;
+}
+
+void
+xtensa_init (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+{
+ xg_init_global_config ();
+}
/* 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
diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h
index 257ca05..912c890 100644
--- a/gas/config/tc-xtensa.h
+++ b/gas/config/tc-xtensa.h
@@ -30,7 +30,7 @@ struct fix;
#include "xtensa-isa.h"
#include "xtensa-config.h"
-#define TARGET_BYTES_BIG_ENDIAN XCHAL_HAVE_BE
+#define TARGET_BYTES_BIG_ENDIAN 0
/* Maximum number of opcode slots in a VLIW instruction. */
@@ -335,6 +335,13 @@ extern bfd_boolean xtensa_check_inside_bundle (void);
extern void xtensa_handle_align (fragS *);
extern char *xtensa_section_rename (const char *);
+/* We need to set the target endianness in xtensa_init and not in md_begin.
+ This is because xtensa_target_format is called before md_begin, and we
+ want to have all non-statically initialized fields initialized. */
+
+#define HOST_SPECIAL_INIT xtensa_init
+extern void xtensa_init (int, char **);
+
#define TARGET_FORMAT xtensa_target_format ()
#define TARGET_ARCH bfd_arch_xtensa
#define TC_SEGMENT_INFO_TYPE xtensa_segment_info
diff --git a/gas/doc/c-aarch64.texi b/gas/doc/c-aarch64.texi
index 2a01c3f..2477555 100644
--- a/gas/doc/c-aarch64.texi
+++ b/gas/doc/c-aarch64.texi
@@ -57,9 +57,11 @@ message if an attempt is made to assemble an instruction which will not execute
on the target processor. The following processor names are recognized:
@code{cortex-a35},
@code{cortex-a53},
+@code{cortex-a55},
@code{cortex-a57},
@code{cortex-a72},
@code{cortex-a73},
+@code{cortex-a75},
@code{exynos-m1},
@code{falkor},
@code{qdf24xx},
diff --git a/gas/doc/c-arm.texi b/gas/doc/c-arm.texi
index 0a1392a..31a012e 100644
--- a/gas/doc/c-arm.texi
+++ b/gas/doc/c-arm.texi
@@ -131,6 +131,7 @@ recognized:
@code{cortex-r5},
@code{cortex-r7},
@code{cortex-r8},
+@code{cortex-r52},
@code{cortex-m33},
@code{cortex-m23},
@code{cortex-m7},
@@ -142,8 +143,6 @@ recognized:
@code{exynos-m1},
@code{marvell-pj4},
@code{marvell-whitney},
-@code{falkor},
-@code{qdf24xx},
@code{xgene1},
@code{xgene2},
@code{ep9312} (ARM920 with Cirrus Maverick coprocessor),
@@ -234,6 +233,7 @@ names are recognized:
@code{armv8.1-a},
@code{armv8.2-a},
@code{armv8.3-a},
+@code{armv8-r},
@code{iwmmxt}
@code{iwmmxt2}
and
diff --git a/gas/testsuite/gas/aarch64/diagnostic.l b/gas/testsuite/gas/aarch64/diagnostic.l
index 6a2563e..b749d2e 100644
--- a/gas/testsuite/gas/aarch64/diagnostic.l
+++ b/gas/testsuite/gas/aarch64/diagnostic.l
@@ -98,7 +98,6 @@
[^:]*:100: Error: operand 3 must be one of the standard conditions, excluding AL and NV. -- `cinc w0,w1,nv'
[^:]*:101: Error: operand 2 must be one of the standard conditions, excluding AL and NV. -- `cset w0,al'
[^:]*:102: Error: operand 2 must be one of the standard conditions, excluding AL and NV. -- `cset w0,nv'
-[^:]*:105: Error: operand 1 must be an integer register -- `ret lr'
[^:]*:106: Error: operand 1 must be an integer register -- `ret kk'
[^:]*:107: Error: immediate operand required at operand 1 -- `clrex x0'
[^:]*:108: Error: immediate operand required at operand 1 -- `clrex w0'
diff --git a/gas/testsuite/gas/aarch64/diagnostic.s b/gas/testsuite/gas/aarch64/diagnostic.s
index d2b9244..09126e6 100644
--- a/gas/testsuite/gas/aarch64/diagnostic.s
+++ b/gas/testsuite/gas/aarch64/diagnostic.s
@@ -102,7 +102,7 @@
cset w0, nv
# test diagnostic info on optional operand
- ret lr
+
ret kk
clrex x0
clrex w0
diff --git a/gas/testsuite/gas/arc/asm-errors-3.d b/gas/testsuite/gas/arc/asm-errors-3.d
new file mode 100644
index 0000000..aa34c86
--- /dev/null
+++ b/gas/testsuite/gas/arc/asm-errors-3.d
@@ -0,0 +1,2 @@
+#as:
+#error-output: asm-errors-3.err
diff --git a/gas/testsuite/gas/arc/asm-errors-3.err b/gas/testsuite/gas/arc/asm-errors-3.err
new file mode 100644
index 0000000..735508e
--- /dev/null
+++ b/gas/testsuite/gas/arc/asm-errors-3.err
@@ -0,0 +1,7 @@
+[^:]*: Assembler messages:
+[^:]*:4: Error: Insn bl has an instruction st with limm in its delay slot.
+[^:]*:6: Error: Insn bl has an instruction st with limm in its delay slot.
+[^:]*:8: Error: Insn bl has a jump/branch instruction breq in its delay slot.
+[^:]*:10: Error: Insn bl has a jump/branch instruction bl in its delay slot.
+[^:]*:12: Error: Insn bl has a jump/branch instruction bbit0 in its delay slot.
+[^:]*:14: Error: Insn bl has a jump/branch instruction ei_s in its delay slot.
diff --git a/gas/testsuite/gas/arc/asm-errors-3.s b/gas/testsuite/gas/arc/asm-errors-3.s
new file mode 100644
index 0000000..e198a2e
--- /dev/null
+++ b/gas/testsuite/gas/arc/asm-errors-3.s
@@ -0,0 +1,14 @@
+ .cpu ARCHS
+.L1:
+ bl.d @foo
+ st 1,[@a]
+ bl.d @foo
+ st @a,[r1]
+ bl.d @foo
+ breq r0,r1,@.L1
+ bl.d @foo
+ bl @foo
+ bl.d @foo
+ bbit0 r0,r1,@.L1
+ bl.d @foo
+ ei_s 1
diff --git a/gas/testsuite/gas/arm/armv8-a+fp.d b/gas/testsuite/gas/arm/armv8-a+fp.d
index f77e742..1b6c743 100644
--- a/gas/testsuite/gas/arm/armv8-a+fp.d
+++ b/gas/testsuite/gas/arm/armv8-a+fp.d
@@ -1,4 +1,6 @@
#name: Valid v8-a+fp
+#source: armv8-ar+fp.s
+#as: -march=armv8-a
#objdump: -dr --prefix-addresses --show-raw-insn
#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
diff --git a/gas/testsuite/gas/arm/armv8-a+simd.d b/gas/testsuite/gas/arm/armv8-a+simd.d
index 9d05566..8aa15fb 100644
--- a/gas/testsuite/gas/arm/armv8-a+simd.d
+++ b/gas/testsuite/gas/arm/armv8-a+simd.d
@@ -1,4 +1,6 @@
#name: Valid v8-a+simdv3
+#source: armv8-ar+simd.s
+#as: -march=armv8-a
#objdump: -dr --prefix-addresses --show-raw-insn
#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
diff --git a/gas/testsuite/gas/arm/armv8-a-bad.d b/gas/testsuite/gas/arm/armv8-a-bad.d
index 94e130c..14d6b48 100644
--- a/gas/testsuite/gas/arm/armv8-a-bad.d
+++ b/gas/testsuite/gas/arm/armv8-a-bad.d
@@ -1,2 +1,4 @@
#name: Invalid v8-a
-#error-output: armv8-a-bad.l
+#source: armv8-ar-bad.s
+#as: -march=armv8-a
+#error-output: armv8-ar-bad.l
diff --git a/gas/testsuite/gas/arm/armv8-a-bad.l b/gas/testsuite/gas/arm/armv8-a-bad.l
deleted file mode 100644
index 838bbdc..0000000
--- a/gas/testsuite/gas/arm/armv8-a-bad.l
+++ /dev/null
@@ -1,96 +0,0 @@
-.*: Assembler messages:
-.*:7: Error: swp{b} use is obsoleted for ARMv8 and later
-.*:10: This coprocessor register access is deprecated in ARMv8
-.*:11: This coprocessor register access is deprecated in ARMv8
-.*:12: This coprocessor register access is deprecated in ARMv8
-.*:13: This coprocessor register access is deprecated in ARMv8
-.*:14: This coprocessor register access is deprecated in ARMv8
-.*:17: setend use is deprecated for ARMv8
-.*:20: setend use is deprecated for ARMv8
-.*:24: Error: immediate value out of range -- `hlt 0x10000'
-.*:25: Error: instruction cannot be conditional -- `hltne 0x1'
-.*:29: Error: immediate value out of range -- `hlt 64'
-.*:31: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Miscellaneous 16-bit instructions
-.*:31: Error: instruction is always unconditional -- `hltne 0'
-.*:35: Error: r15 not allowed here -- `stlb pc,\[r0\]'
-.*:36: Error: r15 not allowed here -- `stlb r0,\[pc\]'
-.*:37: Error: r15 not allowed here -- `stlh pc,\[r0\]'
-.*:38: Error: r15 not allowed here -- `stlh r0,\[pc\]'
-.*:39: Error: r15 not allowed here -- `stl pc,\[r0\]'
-.*:40: Error: r15 not allowed here -- `stl r0,\[pc\]'
-.*:41: Error: r15 not allowed here -- `stlexb r1,pc,\[r0\]'
-.*:42: Error: r15 not allowed here -- `stlexb r1,r0,\[pc\]'
-.*:43: Error: r15 not allowed here -- `stlexb pc,r0,\[r1\]'
-.*:44: Error: registers may not be the same -- `stlexb r0,r0,\[r1\]'
-.*:45: Error: registers may not be the same -- `stlexb r0,r1,\[r0\]'
-.*:46: Error: r15 not allowed here -- `stlexh r1,pc,\[r0\]'
-.*:47: Error: r15 not allowed here -- `stlexh r1,r0,\[pc\]'
-.*:48: Error: r15 not allowed here -- `stlexh pc,r0,\[r1\]'
-.*:49: Error: registers may not be the same -- `stlexh r0,r0,\[r1\]'
-.*:50: Error: registers may not be the same -- `stlexh r0,r1,\[r0\]'
-.*:51: Error: r15 not allowed here -- `stlex r1,pc,\[r0\]'
-.*:52: Error: r15 not allowed here -- `stlex r1,r0,\[pc\]'
-.*:53: Error: r15 not allowed here -- `stlex pc,r0,\[r1\]'
-.*:54: Error: registers may not be the same -- `stlex r0,r0,\[r1\]'
-.*:55: Error: registers may not be the same -- `stlex r0,r1,\[r0\]'
-.*:56: Error: r14 not allowed here -- `stlexd r1,lr,\[r0\]'
-.*:57: Error: r15 not allowed here -- `stlexd r1,r0,\[pc\]'
-.*:58: Error: r15 not allowed here -- `stlexd pc,r0,\[r1\]'
-.*:59: Error: registers may not be the same -- `stlexd r0,r0,\[r1\]'
-.*:60: Error: registers may not be the same -- `stlexd r0,r2,\[r0\]'
-.*:61: Error: even register required -- `stlexd r0,r1,\[r2\]'
-.*:65: Error: r15 not allowed here -- `stlb pc,\[r0\]'
-.*:66: Error: r15 not allowed here -- `stlb r0,\[pc\]'
-.*:67: Error: r15 not allowed here -- `stlh pc,\[r0\]'
-.*:68: Error: r15 not allowed here -- `stlh r0,\[pc\]'
-.*:69: Error: r15 not allowed here -- `stl pc,\[r0\]'
-.*:70: Error: r15 not allowed here -- `stl r0,\[pc\]'
-.*:71: Error: r15 not allowed here -- `stlexb r1,pc,\[r0\]'
-.*:72: Error: r15 not allowed here -- `stlexb r1,r0,\[pc\]'
-.*:73: Error: r15 not allowed here -- `stlexb pc,r0,\[r1\]'
-.*:74: Error: registers may not be the same -- `stlexb r0,r0,\[r1\]'
-.*:75: Error: registers may not be the same -- `stlexb r0,r1,\[r0\]'
-.*:76: Error: r15 not allowed here -- `stlexh r1,pc,\[r0\]'
-.*:77: Error: r15 not allowed here -- `stlexh r1,r0,\[pc\]'
-.*:78: Error: r15 not allowed here -- `stlexh pc,r0,\[r1\]'
-.*:79: Error: registers may not be the same -- `stlexh r0,r0,\[r1\]'
-.*:80: Error: registers may not be the same -- `stlexh r0,r1,\[r0\]'
-.*:81: Error: r15 not allowed here -- `stlex r1,pc,\[r0\]'
-.*:82: Error: r15 not allowed here -- `stlex r1,r0,\[pc\]'
-.*:83: Error: r15 not allowed here -- `stlex pc,r0,\[r1\]'
-.*:84: Error: registers may not be the same -- `stlex r0,r0,\[r1\]'
-.*:85: Error: registers may not be the same -- `stlex r0,r1,\[r0\]'
-.*:87: Error: r15 not allowed here -- `stlexd r1,r0,\[pc\]'
-.*:88: Error: r15 not allowed here -- `stlexd pc,r0,\[r1\]'
-.*:89: Error: registers may not be the same -- `stlexd r0,r0,\[r1\]'
-.*:90: Error: registers may not be the same -- `stlexd r0,r2,\[r0\]'
-.*:95: Error: r15 not allowed here -- `ldab pc,\[r0\]'
-.*:96: Error: r15 not allowed here -- `ldab r0,\[pc\]'
-.*:97: Error: r15 not allowed here -- `ldah pc,\[r0\]'
-.*:98: Error: r15 not allowed here -- `ldah r0,\[pc\]'
-.*:99: Error: r15 not allowed here -- `lda pc,\[r0\]'
-.*:100: Error: r15 not allowed here -- `lda r0,\[pc\]'
-.*:101: Error: r15 not allowed here -- `ldaexb pc,\[r0\]'
-.*:102: Error: r15 not allowed here -- `ldaexb r0,\[pc\]'
-.*:103: Error: r15 not allowed here -- `ldaexh pc,\[r0\]'
-.*:104: Error: r15 not allowed here -- `ldaexh r0,\[pc\]'
-.*:105: Error: r15 not allowed here -- `ldaex pc,\[r0\]'
-.*:106: Error: r15 not allowed here -- `ldaex r0,\[pc\]'
-.*:107: Error: r14 not allowed here -- `ldaexd lr,\[r0\]'
-.*:108: Error: r15 not allowed here -- `ldaexd r0,\[pc\]'
-.*:109: Error: even register required -- `ldaexd r1,\[r2\]'
-.*:113: Error: r15 not allowed here -- `ldab pc,\[r0\]'
-.*:114: Error: r15 not allowed here -- `ldab r0,\[pc\]'
-.*:115: Error: r15 not allowed here -- `ldah pc,\[r0\]'
-.*:116: Error: r15 not allowed here -- `ldah r0,\[pc\]'
-.*:117: Error: r15 not allowed here -- `lda pc,\[r0\]'
-.*:118: Error: r15 not allowed here -- `lda r0,\[pc\]'
-.*:119: Error: r15 not allowed here -- `ldaexb pc,\[r0\]'
-.*:120: Error: r15 not allowed here -- `ldaexb r0,\[pc\]'
-.*:121: Error: r15 not allowed here -- `ldaexh pc,\[r0\]'
-.*:122: Error: r15 not allowed here -- `ldaexh r0,\[pc\]'
-.*:123: Error: r15 not allowed here -- `ldaex pc,\[r0\]'
-.*:124: Error: r15 not allowed here -- `ldaex r0,\[pc\]'
-.*:125: Error: r15 not allowed here -- `ldaexd r0,pc,\[r0\]'
-.*:126: Error: r15 not allowed here -- `ldaexd pc,r0,\[r0\]'
-.*:127: Error: r15 not allowed here -- `ldaexd r1,r0,\[pc\]'
diff --git a/gas/testsuite/gas/arm/armv8-a-barrier-arm.d b/gas/testsuite/gas/arm/armv8-a-barrier-arm.d
index 1a245fa..8ac6821 100644
--- a/gas/testsuite/gas/arm/armv8-a-barrier-arm.d
+++ b/gas/testsuite/gas/arm/armv8-a-barrier-arm.d
@@ -1,6 +1,6 @@
#name: Valid v8-A barrier (ARM)
#as: -march=armv8-a
-#source: armv8-a-barrier.s
+#source: armv8-ar-barrier.s
#objdump: -dr --prefix-addresses --show-raw-insn
.*: +file format .*arm.*
diff --git a/gas/testsuite/gas/arm/armv8-a-barrier-thumb.d b/gas/testsuite/gas/arm/armv8-a-barrier-thumb.d
index 17c2e93..318635a 100644
--- a/gas/testsuite/gas/arm/armv8-a-barrier-thumb.d
+++ b/gas/testsuite/gas/arm/armv8-a-barrier-thumb.d
@@ -1,6 +1,6 @@
#name: Valid v8-A barrier (Thumb)
#as: -march=armv8-a -mthumb
-#source: armv8-a-barrier.s
+#source: armv8-ar-barrier.s
#objdump: -dr --prefix-addresses --show-raw-insn
#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
diff --git a/gas/testsuite/gas/arm/armv8-a-it-bad.d b/gas/testsuite/gas/arm/armv8-a-it-bad.d
index 4789484..208ae1b 100644
--- a/gas/testsuite/gas/arm/armv8-a-it-bad.d
+++ b/gas/testsuite/gas/arm/armv8-a-it-bad.d
@@ -1,3 +1,4 @@
#name: Deprecated IT blocks (ARM v8)
-#error-output: armv8-a-it-bad.l
-#as: -mimplicit-it=always
+#source: armv8-ar-it-bad.s
+#error-output: armv8-ar-it-bad.l
+#as: -march=armv8-a -mimplicit-it=always
diff --git a/gas/testsuite/gas/arm/armv8-a-it-bad.l b/gas/testsuite/gas/arm/armv8-a-it-bad.l
deleted file mode 100644
index d04d5ee..0000000
--- a/gas/testsuite/gas/arm/armv8-a-it-bad.l
+++ /dev/null
@@ -1,18 +0,0 @@
-.*: Assembler messages:
-.*:7: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8
-.*:15: IT blocks containing more than one conditional instruction are deprecated in ARMv8
-.*:20: IT blocks containing more than one conditional instruction are deprecated in ARMv8
-.*:30: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8
-.*:36: IT blocks containing more than one conditional instruction are deprecated in ARMv8
-.*:40: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
-.*:43: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Miscellaneous 16-bit instructions
-.*:49: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Literal loads
-.*:52: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Hi-register ADD, MOV, CMP, BX, BLX using pc
-.*:55: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
-.*:55: Error: r15 not allowed here -- `addeq r0,pc,pc'
-.*:58: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
-.*:58: Error: r15 not allowed here -- `addeq pc,r0,r0'
-.*:61: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm
-.*:65: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm
-.*:68: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm
-.*:72: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm
diff --git a/gas/testsuite/gas/arm/armv8-a.d b/gas/testsuite/gas/arm/armv8-a.d
index 2119bcb..e00e31f 100644
--- a/gas/testsuite/gas/arm/armv8-a.d
+++ b/gas/testsuite/gas/arm/armv8-a.d
@@ -1,4 +1,6 @@
#name: Valid v8-a
+#source: armv8-ar.s
+#as: -march=armv8-a
#objdump: -dr --prefix-addresses --show-raw-insn
.*: +file format .*arm.*
diff --git a/gas/testsuite/gas/arm/armv8-a+fp.s b/gas/testsuite/gas/arm/armv8-ar+fp.s
index f7a5473..a3b21c7 100644
--- a/gas/testsuite/gas/arm/armv8-a+fp.s
+++ b/gas/testsuite/gas/arm/armv8-ar+fp.s
@@ -1,6 +1,5 @@
.syntax unified
.text
- .arch armv8-a
.arch_extension fp
.arm
diff --git a/gas/testsuite/gas/arm/armv8-a+simd.s b/gas/testsuite/gas/arm/armv8-ar+simd.s
index 4d7bce7..8d92ce7 100644
--- a/gas/testsuite/gas/arm/armv8-a+simd.s
+++ b/gas/testsuite/gas/arm/armv8-ar+simd.s
@@ -1,5 +1,4 @@
.syntax unified
- .arch armv8-a
.arch_extension simd
.arm
diff --git a/gas/testsuite/gas/arm/armv8-ar-bad.l b/gas/testsuite/gas/arm/armv8-ar-bad.l
new file mode 100644
index 0000000..ae9a3d1
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-ar-bad.l
@@ -0,0 +1,96 @@
+.*: Assembler messages:
+.*:6: Error: swp{b} use is obsoleted for ARMv8 and later
+.*:9: This coprocessor register access is deprecated in ARMv8
+.*:10: This coprocessor register access is deprecated in ARMv8
+.*:11: This coprocessor register access is deprecated in ARMv8
+.*:12: This coprocessor register access is deprecated in ARMv8
+.*:13: This coprocessor register access is deprecated in ARMv8
+.*:16: setend use is deprecated for ARMv8
+.*:19: setend use is deprecated for ARMv8
+.*:23: Error: immediate value out of range -- `hlt 0x10000'
+.*:24: Error: instruction cannot be conditional -- `hltne 0x1'
+.*:28: Error: immediate value out of range -- `hlt 64'
+.*:30: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Miscellaneous 16-bit instructions
+.*:30: Error: instruction is always unconditional -- `hltne 0'
+.*:34: Error: r15 not allowed here -- `stlb pc,\[r0\]'
+.*:35: Error: r15 not allowed here -- `stlb r0,\[pc\]'
+.*:36: Error: r15 not allowed here -- `stlh pc,\[r0\]'
+.*:37: Error: r15 not allowed here -- `stlh r0,\[pc\]'
+.*:38: Error: r15 not allowed here -- `stl pc,\[r0\]'
+.*:39: Error: r15 not allowed here -- `stl r0,\[pc\]'
+.*:40: Error: r15 not allowed here -- `stlexb r1,pc,\[r0\]'
+.*:41: Error: r15 not allowed here -- `stlexb r1,r0,\[pc\]'
+.*:42: Error: r15 not allowed here -- `stlexb pc,r0,\[r1\]'
+.*:43: Error: registers may not be the same -- `stlexb r0,r0,\[r1\]'
+.*:44: Error: registers may not be the same -- `stlexb r0,r1,\[r0\]'
+.*:45: Error: r15 not allowed here -- `stlexh r1,pc,\[r0\]'
+.*:46: Error: r15 not allowed here -- `stlexh r1,r0,\[pc\]'
+.*:47: Error: r15 not allowed here -- `stlexh pc,r0,\[r1\]'
+.*:48: Error: registers may not be the same -- `stlexh r0,r0,\[r1\]'
+.*:49: Error: registers may not be the same -- `stlexh r0,r1,\[r0\]'
+.*:50: Error: r15 not allowed here -- `stlex r1,pc,\[r0\]'
+.*:51: Error: r15 not allowed here -- `stlex r1,r0,\[pc\]'
+.*:52: Error: r15 not allowed here -- `stlex pc,r0,\[r1\]'
+.*:53: Error: registers may not be the same -- `stlex r0,r0,\[r1\]'
+.*:54: Error: registers may not be the same -- `stlex r0,r1,\[r0\]'
+.*:55: Error: r14 not allowed here -- `stlexd r1,lr,\[r0\]'
+.*:56: Error: r15 not allowed here -- `stlexd r1,r0,\[pc\]'
+.*:57: Error: r15 not allowed here -- `stlexd pc,r0,\[r1\]'
+.*:58: Error: registers may not be the same -- `stlexd r0,r0,\[r1\]'
+.*:59: Error: registers may not be the same -- `stlexd r0,r2,\[r0\]'
+.*:60: Error: even register required -- `stlexd r0,r1,\[r2\]'
+.*:64: Error: r15 not allowed here -- `stlb pc,\[r0\]'
+.*:65: Error: r15 not allowed here -- `stlb r0,\[pc\]'
+.*:66: Error: r15 not allowed here -- `stlh pc,\[r0\]'
+.*:67: Error: r15 not allowed here -- `stlh r0,\[pc\]'
+.*:68: Error: r15 not allowed here -- `stl pc,\[r0\]'
+.*:69: Error: r15 not allowed here -- `stl r0,\[pc\]'
+.*:70: Error: r15 not allowed here -- `stlexb r1,pc,\[r0\]'
+.*:71: Error: r15 not allowed here -- `stlexb r1,r0,\[pc\]'
+.*:72: Error: r15 not allowed here -- `stlexb pc,r0,\[r1\]'
+.*:73: Error: registers may not be the same -- `stlexb r0,r0,\[r1\]'
+.*:74: Error: registers may not be the same -- `stlexb r0,r1,\[r0\]'
+.*:75: Error: r15 not allowed here -- `stlexh r1,pc,\[r0\]'
+.*:76: Error: r15 not allowed here -- `stlexh r1,r0,\[pc\]'
+.*:77: Error: r15 not allowed here -- `stlexh pc,r0,\[r1\]'
+.*:78: Error: registers may not be the same -- `stlexh r0,r0,\[r1\]'
+.*:79: Error: registers may not be the same -- `stlexh r0,r1,\[r0\]'
+.*:80: Error: r15 not allowed here -- `stlex r1,pc,\[r0\]'
+.*:81: Error: r15 not allowed here -- `stlex r1,r0,\[pc\]'
+.*:82: Error: r15 not allowed here -- `stlex pc,r0,\[r1\]'
+.*:83: Error: registers may not be the same -- `stlex r0,r0,\[r1\]'
+.*:84: Error: registers may not be the same -- `stlex r0,r1,\[r0\]'
+.*:86: Error: r15 not allowed here -- `stlexd r1,r0,\[pc\]'
+.*:87: Error: r15 not allowed here -- `stlexd pc,r0,\[r1\]'
+.*:88: Error: registers may not be the same -- `stlexd r0,r0,\[r1\]'
+.*:89: Error: registers may not be the same -- `stlexd r0,r2,\[r0\]'
+.*:94: Error: r15 not allowed here -- `ldab pc,\[r0\]'
+.*:95: Error: r15 not allowed here -- `ldab r0,\[pc\]'
+.*:96: Error: r15 not allowed here -- `ldah pc,\[r0\]'
+.*:97: Error: r15 not allowed here -- `ldah r0,\[pc\]'
+.*:98: Error: r15 not allowed here -- `lda pc,\[r0\]'
+.*:99: Error: r15 not allowed here -- `lda r0,\[pc\]'
+.*:100: Error: r15 not allowed here -- `ldaexb pc,\[r0\]'
+.*:101: Error: r15 not allowed here -- `ldaexb r0,\[pc\]'
+.*:102: Error: r15 not allowed here -- `ldaexh pc,\[r0\]'
+.*:103: Error: r15 not allowed here -- `ldaexh r0,\[pc\]'
+.*:104: Error: r15 not allowed here -- `ldaex pc,\[r0\]'
+.*:105: Error: r15 not allowed here -- `ldaex r0,\[pc\]'
+.*:106: Error: r14 not allowed here -- `ldaexd lr,\[r0\]'
+.*:107: Error: r15 not allowed here -- `ldaexd r0,\[pc\]'
+.*:108: Error: even register required -- `ldaexd r1,\[r2\]'
+.*:112: Error: r15 not allowed here -- `ldab pc,\[r0\]'
+.*:113: Error: r15 not allowed here -- `ldab r0,\[pc\]'
+.*:114: Error: r15 not allowed here -- `ldah pc,\[r0\]'
+.*:115: Error: r15 not allowed here -- `ldah r0,\[pc\]'
+.*:116: Error: r15 not allowed here -- `lda pc,\[r0\]'
+.*:117: Error: r15 not allowed here -- `lda r0,\[pc\]'
+.*:118: Error: r15 not allowed here -- `ldaexb pc,\[r0\]'
+.*:119: Error: r15 not allowed here -- `ldaexb r0,\[pc\]'
+.*:120: Error: r15 not allowed here -- `ldaexh pc,\[r0\]'
+.*:121: Error: r15 not allowed here -- `ldaexh r0,\[pc\]'
+.*:122: Error: r15 not allowed here -- `ldaex pc,\[r0\]'
+.*:123: Error: r15 not allowed here -- `ldaex r0,\[pc\]'
+.*:124: Error: r15 not allowed here -- `ldaexd r0,pc,\[r0\]'
+.*:125: Error: r15 not allowed here -- `ldaexd pc,r0,\[r0\]'
+.*:126: Error: r15 not allowed here -- `ldaexd r1,r0,\[pc\]'
diff --git a/gas/testsuite/gas/arm/armv8-a-bad.s b/gas/testsuite/gas/arm/armv8-ar-bad.s
index 90919e7..7952861 100644
--- a/gas/testsuite/gas/arm/armv8-a-bad.s
+++ b/gas/testsuite/gas/arm/armv8-ar-bad.s
@@ -1,6 +1,5 @@
.syntax unified
.text
- .arch armv8-a
// SWP
.arm
diff --git a/gas/testsuite/gas/arm/armv8-a-barrier.s b/gas/testsuite/gas/arm/armv8-ar-barrier.s
index f7b71c0..f7b71c0 100644
--- a/gas/testsuite/gas/arm/armv8-a-barrier.s
+++ b/gas/testsuite/gas/arm/armv8-ar-barrier.s
diff --git a/gas/testsuite/gas/arm/armv8-ar-it-bad.l b/gas/testsuite/gas/arm/armv8-ar-it-bad.l
new file mode 100644
index 0000000..a69938d
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-ar-it-bad.l
@@ -0,0 +1,18 @@
+.*: Assembler messages:
+.*:6: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8
+.*:14: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+.*:19: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+.*:29: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8
+.*:35: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+.*:39: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+.*:42: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Miscellaneous 16-bit instructions
+.*:48: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Literal loads
+.*:51: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Hi-register ADD, MOV, CMP, BX, BLX using pc
+.*:54: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+.*:54: Error: r15 not allowed here -- `addeq r0,pc,pc'
+.*:57: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+.*:57: Error: r15 not allowed here -- `addeq pc,r0,r0'
+.*:60: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm
+.*:64: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm
+.*:67: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm
+.*:71: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: ADD/SUB sp, sp #imm
diff --git a/gas/testsuite/gas/arm/armv8-a-it-bad.s b/gas/testsuite/gas/arm/armv8-ar-it-bad.s
index d1bc07a..9864bf8 100644
--- a/gas/testsuite/gas/arm/armv8-a-it-bad.s
+++ b/gas/testsuite/gas/arm/armv8-ar-it-bad.s
@@ -1,5 +1,4 @@
.syntax unified
-.arch armv8-a
.thumb
@ Wide instruction in IT block is deprecated.
diff --git a/gas/testsuite/gas/arm/armv8-a.s b/gas/testsuite/gas/arm/armv8-ar.s
index 3217a8a..3217a8a 100644
--- a/gas/testsuite/gas/arm/armv8-a.s
+++ b/gas/testsuite/gas/arm/armv8-ar.s
diff --git a/gas/testsuite/gas/arm/armv8-r+fp.d b/gas/testsuite/gas/arm/armv8-r+fp.d
new file mode 100644
index 0000000..34cfd34
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-r+fp.d
@@ -0,0 +1,117 @@
+#name: Valid v8-r+fp
+#source: armv8-ar+fp.s
+#as: -march=armv8-r
+#objdump: -dr --prefix-addresses --show-raw-insn
+#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> fe000a00 vseleq.f32 s0, s0, s0
+0[0-9a-f]+ <[^>]+> fe500aa0 vselvs.f32 s1, s1, s1
+0[0-9a-f]+ <[^>]+> fe2ffa0f vselge.f32 s30, s30, s30
+0[0-9a-f]+ <[^>]+> fe7ffaaf vselgt.f32 s31, s31, s31
+0[0-9a-f]+ <[^>]+> fe000b00 vseleq.f64 d0, d0, d0
+0[0-9a-f]+ <[^>]+> fe500ba0 vselvs.f64 d16, d16, d16
+0[0-9a-f]+ <[^>]+> fe2ffb0f vselge.f64 d15, d15, d15
+0[0-9a-f]+ <[^>]+> fe7ffbaf vselgt.f64 d31, d31, d31
+0[0-9a-f]+ <[^>]+> fe800a00 vmaxnm.f32 s0, s0, s0
+0[0-9a-f]+ <[^>]+> fec00aa0 vmaxnm.f32 s1, s1, s1
+0[0-9a-f]+ <[^>]+> fe8ffa0f vmaxnm.f32 s30, s30, s30
+0[0-9a-f]+ <[^>]+> fecffaaf vmaxnm.f32 s31, s31, s31
+0[0-9a-f]+ <[^>]+> fe800b00 vmaxnm.f64 d0, d0, d0
+0[0-9a-f]+ <[^>]+> fec00ba0 vmaxnm.f64 d16, d16, d16
+0[0-9a-f]+ <[^>]+> fe8ffb0f vmaxnm.f64 d15, d15, d15
+0[0-9a-f]+ <[^>]+> fecffbaf vmaxnm.f64 d31, d31, d31
+0[0-9a-f]+ <[^>]+> fe800a40 vminnm.f32 s0, s0, s0
+0[0-9a-f]+ <[^>]+> fec00ae0 vminnm.f32 s1, s1, s1
+0[0-9a-f]+ <[^>]+> fe8ffa4f vminnm.f32 s30, s30, s30
+0[0-9a-f]+ <[^>]+> fecffaef vminnm.f32 s31, s31, s31
+0[0-9a-f]+ <[^>]+> fe800b40 vminnm.f64 d0, d0, d0
+0[0-9a-f]+ <[^>]+> fec00be0 vminnm.f64 d16, d16, d16
+0[0-9a-f]+ <[^>]+> fe8ffb4f vminnm.f64 d15, d15, d15
+0[0-9a-f]+ <[^>]+> fecffbef vminnm.f64 d31, d31, d31
+0[0-9a-f]+ <[^>]+> febc0ac0 vcvta.s32.f32 s0, s0
+0[0-9a-f]+ <[^>]+> fefd0ae0 vcvtn.s32.f32 s1, s1
+0[0-9a-f]+ <[^>]+> febefa4f vcvtp.u32.f32 s30, s30
+0[0-9a-f]+ <[^>]+> fefffa6f vcvtm.u32.f32 s31, s31
+0[0-9a-f]+ <[^>]+> febc0bc0 vcvta.s32.f64 s0, d0
+0[0-9a-f]+ <[^>]+> fefd0be0 vcvtn.s32.f64 s1, d16
+0[0-9a-f]+ <[^>]+> febefb4f vcvtp.u32.f64 s30, d15
+0[0-9a-f]+ <[^>]+> fefffb6f vcvtm.u32.f64 s31, d31
+0[0-9a-f]+ <[^>]+> eeb60ac0 vrintz.f32 s0, s0
+0[0-9a-f]+ <[^>]+> eef70a60 vrintx.f32 s1, s1
+0[0-9a-f]+ <[^>]+> 0eb6fa4f vrintreq.f32 s30, s30
+0[0-9a-f]+ <[^>]+> feb80a40 vrinta.f32 s0, s0
+0[0-9a-f]+ <[^>]+> fef90a60 vrintn.f32 s1, s1
+0[0-9a-f]+ <[^>]+> febafa4f vrintp.f32 s30, s30
+0[0-9a-f]+ <[^>]+> fefbfa6f vrintm.f32 s31, s31
+0[0-9a-f]+ <[^>]+> eeb60bc0 vrintz.f64 d0, d0
+0[0-9a-f]+ <[^>]+> eeb71b41 vrintx.f64 d1, d1
+0[0-9a-f]+ <[^>]+> 0ef6eb6e vrintreq.f64 d30, d30
+0[0-9a-f]+ <[^>]+> feb80b40 vrinta.f64 d0, d0
+0[0-9a-f]+ <[^>]+> feb91b41 vrintn.f64 d1, d1
+0[0-9a-f]+ <[^>]+> fefaeb6e vrintp.f64 d30, d30
+0[0-9a-f]+ <[^>]+> fefbfb6f vrintm.f64 d31, d31
+0[0-9a-f]+ <[^>]+> eeb30bc0 vcvtt.f16.f64 s0, d0
+0[0-9a-f]+ <[^>]+> eef30b60 vcvtb.f16.f64 s1, d16
+0[0-9a-f]+ <[^>]+> eeb3fbcf vcvtt.f16.f64 s30, d15
+0[0-9a-f]+ <[^>]+> eef3fb6f vcvtb.f16.f64 s31, d31
+0[0-9a-f]+ <[^>]+> eeb20bc0 vcvtt.f64.f16 d0, s0
+0[0-9a-f]+ <[^>]+> eef20b60 vcvtb.f64.f16 d16, s1
+0[0-9a-f]+ <[^>]+> eeb2fbcf vcvtt.f64.f16 d15, s30
+0[0-9a-f]+ <[^>]+> eef2fb6f vcvtb.f64.f16 d31, s31
+0[0-9a-f]+ <[^>]+> fe00 0a00 vseleq.f32 s0, s0, s0
+0[0-9a-f]+ <[^>]+> fe50 0aa0 vselvs.f32 s1, s1, s1
+0[0-9a-f]+ <[^>]+> fe2f fa0f vselge.f32 s30, s30, s30
+0[0-9a-f]+ <[^>]+> fe7f faaf vselgt.f32 s31, s31, s31
+0[0-9a-f]+ <[^>]+> fe00 0b00 vseleq.f64 d0, d0, d0
+0[0-9a-f]+ <[^>]+> fe50 0ba0 vselvs.f64 d16, d16, d16
+0[0-9a-f]+ <[^>]+> fe2f fb0f vselge.f64 d15, d15, d15
+0[0-9a-f]+ <[^>]+> fe7f fbaf vselgt.f64 d31, d31, d31
+0[0-9a-f]+ <[^>]+> fe80 0a00 vmaxnm.f32 s0, s0, s0
+0[0-9a-f]+ <[^>]+> fec0 0aa0 vmaxnm.f32 s1, s1, s1
+0[0-9a-f]+ <[^>]+> fe8f fa0f vmaxnm.f32 s30, s30, s30
+0[0-9a-f]+ <[^>]+> fecf faaf vmaxnm.f32 s31, s31, s31
+0[0-9a-f]+ <[^>]+> fe80 0b00 vmaxnm.f64 d0, d0, d0
+0[0-9a-f]+ <[^>]+> fec0 0ba0 vmaxnm.f64 d16, d16, d16
+0[0-9a-f]+ <[^>]+> fe8f fb0f vmaxnm.f64 d15, d15, d15
+0[0-9a-f]+ <[^>]+> fecf fbaf vmaxnm.f64 d31, d31, d31
+0[0-9a-f]+ <[^>]+> fe80 0a40 vminnm.f32 s0, s0, s0
+0[0-9a-f]+ <[^>]+> fec0 0ae0 vminnm.f32 s1, s1, s1
+0[0-9a-f]+ <[^>]+> fe8f fa4f vminnm.f32 s30, s30, s30
+0[0-9a-f]+ <[^>]+> fecf faef vminnm.f32 s31, s31, s31
+0[0-9a-f]+ <[^>]+> fe80 0b40 vminnm.f64 d0, d0, d0
+0[0-9a-f]+ <[^>]+> fec0 0be0 vminnm.f64 d16, d16, d16
+0[0-9a-f]+ <[^>]+> fe8f fb4f vminnm.f64 d15, d15, d15
+0[0-9a-f]+ <[^>]+> fecf fbef vminnm.f64 d31, d31, d31
+0[0-9a-f]+ <[^>]+> febc 0ac0 vcvta.s32.f32 s0, s0
+0[0-9a-f]+ <[^>]+> fefd 0ae0 vcvtn.s32.f32 s1, s1
+0[0-9a-f]+ <[^>]+> febe fa4f vcvtp.u32.f32 s30, s30
+0[0-9a-f]+ <[^>]+> feff fa6f vcvtm.u32.f32 s31, s31
+0[0-9a-f]+ <[^>]+> febc 0bc0 vcvta.s32.f64 s0, d0
+0[0-9a-f]+ <[^>]+> fefd 0be0 vcvtn.s32.f64 s1, d16
+0[0-9a-f]+ <[^>]+> febe fb4f vcvtp.u32.f64 s30, d15
+0[0-9a-f]+ <[^>]+> feff fb6f vcvtm.u32.f64 s31, d31
+0[0-9a-f]+ <[^>]+> eeb6 0ac0 vrintz.f32 s0, s0
+0[0-9a-f]+ <[^>]+> eef7 0a60 vrintx.f32 s1, s1
+0[0-9a-f]+ <[^>]+> eeb6 fa4f vrintr.f32 s30, s30
+0[0-9a-f]+ <[^>]+> feb8 0a40 vrinta.f32 s0, s0
+0[0-9a-f]+ <[^>]+> fef9 0a60 vrintn.f32 s1, s1
+0[0-9a-f]+ <[^>]+> feba fa4f vrintp.f32 s30, s30
+0[0-9a-f]+ <[^>]+> fefb fa6f vrintm.f32 s31, s31
+0[0-9a-f]+ <[^>]+> eeb6 0bc0 vrintz.f64 d0, d0
+0[0-9a-f]+ <[^>]+> eeb7 1b41 vrintx.f64 d1, d1
+0[0-9a-f]+ <[^>]+> eef6 eb6e vrintr.f64 d30, d30
+0[0-9a-f]+ <[^>]+> feb8 0b40 vrinta.f64 d0, d0
+0[0-9a-f]+ <[^>]+> feb9 1b41 vrintn.f64 d1, d1
+0[0-9a-f]+ <[^>]+> fefa eb6e vrintp.f64 d30, d30
+0[0-9a-f]+ <[^>]+> fefb fb6f vrintm.f64 d31, d31
+0[0-9a-f]+ <[^>]+> eeb3 0bc0 vcvtt.f16.f64 s0, d0
+0[0-9a-f]+ <[^>]+> eef3 0b60 vcvtb.f16.f64 s1, d16
+0[0-9a-f]+ <[^>]+> eeb3 fbcf vcvtt.f16.f64 s30, d15
+0[0-9a-f]+ <[^>]+> eef3 fb6f vcvtb.f16.f64 s31, d31
+0[0-9a-f]+ <[^>]+> eeb2 0bc0 vcvtt.f64.f16 d0, s0
+0[0-9a-f]+ <[^>]+> eef2 0b60 vcvtb.f64.f16 d16, s1
+0[0-9a-f]+ <[^>]+> eeb2 fbcf vcvtt.f64.f16 d15, s30
+0[0-9a-f]+ <[^>]+> eef2 fb6f vcvtb.f64.f16 d31, s31
diff --git a/gas/testsuite/gas/arm/armv8-r+simd.d b/gas/testsuite/gas/arm/armv8-r+simd.d
new file mode 100644
index 0000000..4237218
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-r+simd.d
@@ -0,0 +1,81 @@
+#name: Valid v8-r+simdv3
+#source: armv8-ar+simd.s
+#as: -march=armv8-r
+#objdump: -dr --prefix-addresses --show-raw-insn
+#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> f3000f10 vmaxnm.f32 d0, d0, d0
+0[0-9a-f]+ <[^>]+> f3400fb0 vmaxnm.f32 d16, d16, d16
+0[0-9a-f]+ <[^>]+> f30fff1f vmaxnm.f32 d15, d15, d15
+0[0-9a-f]+ <[^>]+> f34fffbf vmaxnm.f32 d31, d31, d31
+0[0-9a-f]+ <[^>]+> f3000f50 vmaxnm.f32 q0, q0, q0
+0[0-9a-f]+ <[^>]+> f3400ff0 vmaxnm.f32 q8, q8, q8
+0[0-9a-f]+ <[^>]+> f30eef5e vmaxnm.f32 q7, q7, q7
+0[0-9a-f]+ <[^>]+> f34eeffe vmaxnm.f32 q15, q15, q15
+0[0-9a-f]+ <[^>]+> f3200f10 vminnm.f32 d0, d0, d0
+0[0-9a-f]+ <[^>]+> f3600fb0 vminnm.f32 d16, d16, d16
+0[0-9a-f]+ <[^>]+> f32fff1f vminnm.f32 d15, d15, d15
+0[0-9a-f]+ <[^>]+> f36fffbf vminnm.f32 d31, d31, d31
+0[0-9a-f]+ <[^>]+> f3200f50 vminnm.f32 q0, q0, q0
+0[0-9a-f]+ <[^>]+> f3600ff0 vminnm.f32 q8, q8, q8
+0[0-9a-f]+ <[^>]+> f32eef5e vminnm.f32 q7, q7, q7
+0[0-9a-f]+ <[^>]+> f36eeffe vminnm.f32 q15, q15, q15
+0[0-9a-f]+ <[^>]+> f3bb0000 vcvta.s32.f32 d0, d0
+0[0-9a-f]+ <[^>]+> f3fb0120 vcvtn.s32.f32 d16, d16
+0[0-9a-f]+ <[^>]+> f3bbf28f vcvtp.u32.f32 d15, d15
+0[0-9a-f]+ <[^>]+> f3fbf3af vcvtm.u32.f32 d31, d31
+0[0-9a-f]+ <[^>]+> f3bb0040 vcvta.s32.f32 q0, q0
+0[0-9a-f]+ <[^>]+> f3fb0160 vcvtn.s32.f32 q8, q8
+0[0-9a-f]+ <[^>]+> f3bbe2ce vcvtp.u32.f32 q7, q7
+0[0-9a-f]+ <[^>]+> f3fbe3ee vcvtm.u32.f32 q15, q15
+0[0-9a-f]+ <[^>]+> f3ba0500 vrinta.f32 d0, d0
+0[0-9a-f]+ <[^>]+> f3fa0420 vrintn.f32 d16, d16
+0[0-9a-f]+ <[^>]+> f3baf68f vrintm.f32 d15, d15
+0[0-9a-f]+ <[^>]+> f3faf7af vrintp.f32 d31, d31
+0[0-9a-f]+ <[^>]+> f3ba04af vrintx.f32 d0, d31
+0[0-9a-f]+ <[^>]+> f3fa058f vrintz.f32 d16, d15
+0[0-9a-f]+ <[^>]+> f3ba0540 vrinta.f32 q0, q0
+0[0-9a-f]+ <[^>]+> f3fa0460 vrintn.f32 q8, q8
+0[0-9a-f]+ <[^>]+> f3bae6ce vrintm.f32 q7, q7
+0[0-9a-f]+ <[^>]+> f3fae7ee vrintp.f32 q15, q15
+0[0-9a-f]+ <[^>]+> f3ba04ee vrintx.f32 q0, q15
+0[0-9a-f]+ <[^>]+> f3fa05ce vrintz.f32 q8, q7
+0[0-9a-f]+ <[^>]+> ff00 0f10 vmaxnm.f32 d0, d0, d0
+0[0-9a-f]+ <[^>]+> ff40 0fb0 vmaxnm.f32 d16, d16, d16
+0[0-9a-f]+ <[^>]+> ff0f ff1f vmaxnm.f32 d15, d15, d15
+0[0-9a-f]+ <[^>]+> ff4f ffbf vmaxnm.f32 d31, d31, d31
+0[0-9a-f]+ <[^>]+> ff00 0f50 vmaxnm.f32 q0, q0, q0
+0[0-9a-f]+ <[^>]+> ff40 0ff0 vmaxnm.f32 q8, q8, q8
+0[0-9a-f]+ <[^>]+> ff0e ef5e vmaxnm.f32 q7, q7, q7
+0[0-9a-f]+ <[^>]+> ff4e effe vmaxnm.f32 q15, q15, q15
+0[0-9a-f]+ <[^>]+> ff20 0f10 vminnm.f32 d0, d0, d0
+0[0-9a-f]+ <[^>]+> ff60 0fb0 vminnm.f32 d16, d16, d16
+0[0-9a-f]+ <[^>]+> ff2f ff1f vminnm.f32 d15, d15, d15
+0[0-9a-f]+ <[^>]+> ff6f ffbf vminnm.f32 d31, d31, d31
+0[0-9a-f]+ <[^>]+> ff20 0f50 vminnm.f32 q0, q0, q0
+0[0-9a-f]+ <[^>]+> ff60 0ff0 vminnm.f32 q8, q8, q8
+0[0-9a-f]+ <[^>]+> ff2e ef5e vminnm.f32 q7, q7, q7
+0[0-9a-f]+ <[^>]+> ff6e effe vminnm.f32 q15, q15, q15
+0[0-9a-f]+ <[^>]+> ffbb 0000 vcvta.s32.f32 d0, d0
+0[0-9a-f]+ <[^>]+> fffb 0120 vcvtn.s32.f32 d16, d16
+0[0-9a-f]+ <[^>]+> ffbb f28f vcvtp.u32.f32 d15, d15
+0[0-9a-f]+ <[^>]+> fffb f3af vcvtm.u32.f32 d31, d31
+0[0-9a-f]+ <[^>]+> ffbb 0040 vcvta.s32.f32 q0, q0
+0[0-9a-f]+ <[^>]+> fffb 0160 vcvtn.s32.f32 q8, q8
+0[0-9a-f]+ <[^>]+> ffbb e2ce vcvtp.u32.f32 q7, q7
+0[0-9a-f]+ <[^>]+> fffb e3ee vcvtm.u32.f32 q15, q15
+0[0-9a-f]+ <[^>]+> ffba 0500 vrinta.f32 d0, d0
+0[0-9a-f]+ <[^>]+> fffa 0420 vrintn.f32 d16, d16
+0[0-9a-f]+ <[^>]+> ffba f68f vrintm.f32 d15, d15
+0[0-9a-f]+ <[^>]+> fffa f7af vrintp.f32 d31, d31
+0[0-9a-f]+ <[^>]+> ffba 04af vrintx.f32 d0, d31
+0[0-9a-f]+ <[^>]+> fffa 058f vrintz.f32 d16, d15
+0[0-9a-f]+ <[^>]+> ffba 0540 vrinta.f32 q0, q0
+0[0-9a-f]+ <[^>]+> fffa 0460 vrintn.f32 q8, q8
+0[0-9a-f]+ <[^>]+> ffba e6ce vrintm.f32 q7, q7
+0[0-9a-f]+ <[^>]+> fffa e7ee vrintp.f32 q15, q15
+0[0-9a-f]+ <[^>]+> ffba 04ee vrintx.f32 q0, q15
+0[0-9a-f]+ <[^>]+> fffa 05ce vrintz.f32 q8, q7
diff --git a/gas/testsuite/gas/arm/armv8-r-bad.d b/gas/testsuite/gas/arm/armv8-r-bad.d
new file mode 100644
index 0000000..332c791
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-r-bad.d
@@ -0,0 +1,4 @@
+#name: Invalid v8-r
+#source: armv8-ar-bad.s
+#as: -march=armv8-r
+#error-output: armv8-ar-bad.l
diff --git a/gas/testsuite/gas/arm/armv8-r-barrier-arm.d b/gas/testsuite/gas/arm/armv8-r-barrier-arm.d
new file mode 100644
index 0000000..0d361eb
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-r-barrier-arm.d
@@ -0,0 +1,24 @@
+#name: Valid v8-R barrier (ARM)
+#as: -march=armv8-r
+#source: armv8-ar-barrier.s
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> f57ff04d dsb ld
+0[0-9a-f]+ <[^>]+> f57ff049 dsb ishld
+0[0-9a-f]+ <[^>]+> f57ff045 dsb nshld
+0[0-9a-f]+ <[^>]+> f57ff041 dsb oshld
+0[0-9a-f]+ <[^>]+> f57ff05d dmb ld
+0[0-9a-f]+ <[^>]+> f57ff059 dmb ishld
+0[0-9a-f]+ <[^>]+> f57ff055 dmb nshld
+0[0-9a-f]+ <[^>]+> f57ff051 dmb oshld
+0[0-9a-f]+ <[^>]+> f57ff04d dsb ld
+0[0-9a-f]+ <[^>]+> f57ff049 dsb ishld
+0[0-9a-f]+ <[^>]+> f57ff045 dsb nshld
+0[0-9a-f]+ <[^>]+> f57ff041 dsb oshld
+0[0-9a-f]+ <[^>]+> f57ff05d dmb ld
+0[0-9a-f]+ <[^>]+> f57ff059 dmb ishld
+0[0-9a-f]+ <[^>]+> f57ff055 dmb nshld
+0[0-9a-f]+ <[^>]+> f57ff051 dmb oshld
diff --git a/gas/testsuite/gas/arm/armv8-r-barrier-thumb.d b/gas/testsuite/gas/arm/armv8-r-barrier-thumb.d
new file mode 100644
index 0000000..5478ff6
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-r-barrier-thumb.d
@@ -0,0 +1,25 @@
+#name: Valid v8-R barrier (Thumb)
+#as: -march=armv8-r -mthumb
+#source: armv8-ar-barrier.s
+#objdump: -dr --prefix-addresses --show-raw-insn
+#skip: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> f3bf 8f4d dsb ld
+0[0-9a-f]+ <[^>]+> f3bf 8f49 dsb ishld
+0[0-9a-f]+ <[^>]+> f3bf 8f45 dsb nshld
+0[0-9a-f]+ <[^>]+> f3bf 8f41 dsb oshld
+0[0-9a-f]+ <[^>]+> f3bf 8f5d dmb ld
+0[0-9a-f]+ <[^>]+> f3bf 8f59 dmb ishld
+0[0-9a-f]+ <[^>]+> f3bf 8f55 dmb nshld
+0[0-9a-f]+ <[^>]+> f3bf 8f51 dmb oshld
+0[0-9a-f]+ <[^>]+> f3bf 8f4d dsb ld
+0[0-9a-f]+ <[^>]+> f3bf 8f49 dsb ishld
+0[0-9a-f]+ <[^>]+> f3bf 8f45 dsb nshld
+0[0-9a-f]+ <[^>]+> f3bf 8f41 dsb oshld
+0[0-9a-f]+ <[^>]+> f3bf 8f5d dmb ld
+0[0-9a-f]+ <[^>]+> f3bf 8f59 dmb ishld
+0[0-9a-f]+ <[^>]+> f3bf 8f55 dmb nshld
+0[0-9a-f]+ <[^>]+> f3bf 8f51 dmb oshld
diff --git a/gas/testsuite/gas/arm/armv8-r-it-bad.d b/gas/testsuite/gas/arm/armv8-r-it-bad.d
new file mode 100644
index 0000000..ae24051
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-r-it-bad.d
@@ -0,0 +1,4 @@
+#name: Deprecated IT blocks (ARM v8)
+#source: armv8-ar-it-bad.s
+#error-output: armv8-ar-it-bad.l
+#as: -march=armv8-r -mimplicit-it=always
diff --git a/gas/testsuite/gas/arm/armv8-r.d b/gas/testsuite/gas/arm/armv8-r.d
new file mode 100644
index 0000000..7a7a426
--- /dev/null
+++ b/gas/testsuite/gas/arm/armv8-r.d
@@ -0,0 +1,104 @@
+#name: Valid v8-r
+#source: armv8-ar.s
+#as: -march=armv8-r
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arm.*
+
+Disassembly of section .text:
+0[0-9a-f]+ <[^>]+> e320f005 sevl
+0[0-9a-f]+ <[^>]+> e1000070 hlt 0x0000
+0[0-9a-f]+ <[^>]+> e100007f hlt 0x000f
+0[0-9a-f]+ <[^>]+> e10fff70 hlt 0xfff0
+0[0-9a-f]+ <[^>]+> e1c0fc90 stlb r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e1c1fc91 stlb r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e1cefc9e stlb lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e1e0fc90 stlh r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e1e1fc91 stlh r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e1eefc9e stlh lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e180fc90 stl r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e181fc91 stl r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e18efc9e stl lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e1ce0e91 stlexb r0, r1, \[lr\]
+0[0-9a-f]+ <[^>]+> e1c01e9e stlexb r1, lr, \[r0\]
+0[0-9a-f]+ <[^>]+> e1c1ee90 stlexb lr, r0, \[r1\]
+0[0-9a-f]+ <[^>]+> e1ee0e91 stlexh r0, r1, \[lr\]
+0[0-9a-f]+ <[^>]+> e1e01e9e stlexh r1, lr, \[r0\]
+0[0-9a-f]+ <[^>]+> e1e1ee90 stlexh lr, r0, \[r1\]
+0[0-9a-f]+ <[^>]+> e18e0e91 stlex r0, r1, \[lr\]
+0[0-9a-f]+ <[^>]+> e1801e9e stlex r1, lr, \[r0\]
+0[0-9a-f]+ <[^>]+> e181ee90 stlex lr, r0, \[r1\]
+0[0-9a-f]+ <[^>]+> e1ae0e92 stlexd r0, r2, r3, \[lr\]
+0[0-9a-f]+ <[^>]+> e1a01e9c stlexd r1, ip, sp, \[r0\]
+0[0-9a-f]+ <[^>]+> e1a1ee90 stlexd lr, r0, r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e1d00c9f ldab r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e1d11c9f ldab r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e1deec9f ldab lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e1f00c9f ldah r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e1f11c9f ldah r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e1feec9f ldah lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e1900c9f lda r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e1911c9f lda r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e19eec9f lda lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e1d00e9f ldaexb r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e1d11e9f ldaexb r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e1deee9f ldaexb lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e1f00e9f ldaexh r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e1f11e9f ldaexh r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e1feee9f ldaexh lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e1900e9f ldaex r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e1911e9f ldaex r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e19eee9f ldaex lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e1b00e9f ldaexd r0, r1, \[r0\]
+0[0-9a-f]+ <[^>]+> e1b12e9f ldaexd r2, r3, \[r1\]
+0[0-9a-f]+ <[^>]+> e1bece9f ldaexd ip, sp, \[lr\]
+0[0-9a-f]+ <[^>]+> bf50 sevl
+0[0-9a-f]+ <[^>]+> bf50 sevl
+0[0-9a-f]+ <[^>]+> f3af 8005 sevl.w
+0[0-9a-f]+ <[^>]+> f78f 8001 dcps1
+0[0-9a-f]+ <[^>]+> f78f 8002 dcps2
+0[0-9a-f]+ <[^>]+> f78f 8003 dcps3
+0[0-9a-f]+ <[^>]+> ba80 hlt 0x0000
+0[0-9a-f]+ <[^>]+> babf hlt 0x003f
+0[0-9a-f]+ <[^>]+> e8c0 0f8f stlb r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8c1 1f8f stlb r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8ce ef8f stlb lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8c0 0f9f stlh r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8c1 1f9f stlh r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8ce ef9f stlh lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8c0 0faf stl r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8c1 1faf stl r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8ce efaf stl lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8ce 1fc0 stlexb r0, r1, \[lr\]
+0[0-9a-f]+ <[^>]+> e8c0 efc1 stlexb r1, lr, \[r0\]
+0[0-9a-f]+ <[^>]+> e8c1 0fce stlexb lr, r0, \[r1\]
+0[0-9a-f]+ <[^>]+> e8ce 1fd0 stlexh r0, r1, \[lr\]
+0[0-9a-f]+ <[^>]+> e8c0 efd1 stlexh r1, lr, \[r0\]
+0[0-9a-f]+ <[^>]+> e8c1 0fde stlexh lr, r0, \[r1\]
+0[0-9a-f]+ <[^>]+> e8ce 1fe0 stlex r0, r1, \[lr\]
+0[0-9a-f]+ <[^>]+> e8c0 efe1 stlex r1, lr, \[r0\]
+0[0-9a-f]+ <[^>]+> e8c1 0fee stlex lr, r0, \[r1\]
+0[0-9a-f]+ <[^>]+> e8ce 11f0 stlexd r0, r1, r1, \[lr\]
+0[0-9a-f]+ <[^>]+> e8c0 eef1 stlexd r1, lr, lr, \[r0\]
+0[0-9a-f]+ <[^>]+> e8c1 00fe stlexd lr, r0, r0, \[r1\]
+0[0-9a-f]+ <[^>]+> e8d0 0f8f ldab r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8d1 1f8f ldab r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8de ef8f ldab lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8d0 0f9f ldah r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8d1 1f9f ldah r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8de ef9f ldah lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8d0 0faf lda r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8d1 1faf lda r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8de efaf lda lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8d0 0fcf ldaexb r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8d1 1fcf ldaexb r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8de efcf ldaexb lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8d0 0fdf ldaexh r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8d1 1fdf ldaexh r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8de efdf ldaexh lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8d0 0fef ldaex r0, \[r0\]
+0[0-9a-f]+ <[^>]+> e8d1 1fef ldaex r1, \[r1\]
+0[0-9a-f]+ <[^>]+> e8de efef ldaex lr, \[lr\]
+0[0-9a-f]+ <[^>]+> e8d0 01ff ldaexd r0, r1, \[r0\]
+0[0-9a-f]+ <[^>]+> e8d1 1eff ldaexd r1, lr, \[r1\]
+0[0-9a-f]+ <[^>]+> e8de e0ff ldaexd lr, r0, \[lr\]
diff --git a/gas/testsuite/gas/arm/attr-march-armv1.d b/gas/testsuite/gas/arm/attr-march-armv1.d
index ac65977..d9730b5 100644
--- a/gas/testsuite/gas/arm/attr-march-armv1.d
+++ b/gas/testsuite/gas/arm/attr-march-armv1.d
@@ -8,5 +8,4 @@
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "1"
- Tag_CPU_arch: v4
Tag_ARM_ISA_use: Yes
diff --git a/gas/testsuite/gas/arm/attr-march-armv2.d b/gas/testsuite/gas/arm/attr-march-armv2.d
index 0b574ef..39e3371 100644
--- a/gas/testsuite/gas/arm/attr-march-armv2.d
+++ b/gas/testsuite/gas/arm/attr-march-armv2.d
@@ -8,5 +8,4 @@
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "2"
- Tag_CPU_arch: v4
Tag_ARM_ISA_use: Yes
diff --git a/gas/testsuite/gas/arm/attr-march-armv2a.d b/gas/testsuite/gas/arm/attr-march-armv2a.d
index 387e4a3..2c4dd62 100644
--- a/gas/testsuite/gas/arm/attr-march-armv2a.d
+++ b/gas/testsuite/gas/arm/attr-march-armv2a.d
@@ -8,5 +8,4 @@
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "2A"
- Tag_CPU_arch: v4
Tag_ARM_ISA_use: Yes
diff --git a/gas/testsuite/gas/arm/attr-march-armv2s.d b/gas/testsuite/gas/arm/attr-march-armv2s.d
index 3bd06e6..dfd17d2 100644
--- a/gas/testsuite/gas/arm/attr-march-armv2s.d
+++ b/gas/testsuite/gas/arm/attr-march-armv2s.d
@@ -8,5 +8,4 @@
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "2S"
- Tag_CPU_arch: v4
Tag_ARM_ISA_use: Yes
diff --git a/gas/testsuite/gas/arm/attr-march-armv3.d b/gas/testsuite/gas/arm/attr-march-armv3.d
index 13d5d18..988f896 100644
--- a/gas/testsuite/gas/arm/attr-march-armv3.d
+++ b/gas/testsuite/gas/arm/attr-march-armv3.d
@@ -8,5 +8,4 @@
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "3"
- Tag_CPU_arch: v4
Tag_ARM_ISA_use: Yes
diff --git a/gas/testsuite/gas/arm/attr-march-armv3m.d b/gas/testsuite/gas/arm/attr-march-armv3m.d
index 4e24399..c946b37 100644
--- a/gas/testsuite/gas/arm/attr-march-armv3m.d
+++ b/gas/testsuite/gas/arm/attr-march-armv3m.d
@@ -8,5 +8,4 @@
Attribute Section: aeabi
File Attributes
Tag_CPU_name: "3M"
- Tag_CPU_arch: v4
Tag_ARM_ISA_use: Yes
diff --git a/gas/testsuite/gas/arm/attr-march-armv8-r+crypto.d b/gas/testsuite/gas/arm/attr-march-armv8-r+crypto.d
new file mode 100644
index 0000000..e2d83a0
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8-r+crypto.d
@@ -0,0 +1,18 @@
+# name: attributes for -march=armv8-r+crypto
+# source: blank.s
+# as: -march=armv8-r+crypto
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_name: "8-R"
+ Tag_CPU_arch: v8-R
+ Tag_CPU_arch_profile: Application
+ Tag_ARM_ISA_use: Yes
+ Tag_THUMB_ISA_use: Thumb-2
+ Tag_FP_arch: FP for ARMv8
+ Tag_Advanced_SIMD_arch: NEON for ARMv8
+ Tag_MPextension_use: Allowed
+ Tag_Virtualization_use: TrustZone and Virtualization Extensions
diff --git a/gas/testsuite/gas/arm/attr-march-armv8-r+fp.d b/gas/testsuite/gas/arm/attr-march-armv8-r+fp.d
new file mode 100644
index 0000000..e7a8446
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8-r+fp.d
@@ -0,0 +1,17 @@
+# name: attributes for -march=armv8-r+fp
+# source: blank.s
+# as: -march=armv8-r+fp
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_name: "8-R"
+ Tag_CPU_arch: v8-R
+ Tag_CPU_arch_profile: Application
+ Tag_ARM_ISA_use: Yes
+ Tag_THUMB_ISA_use: Thumb-2
+ Tag_FP_arch: FP for ARMv8
+ Tag_MPextension_use: Allowed
+ Tag_Virtualization_use: TrustZone and Virtualization Extensions
diff --git a/gas/testsuite/gas/arm/attr-march-armv8-r+simd.d b/gas/testsuite/gas/arm/attr-march-armv8-r+simd.d
new file mode 100644
index 0000000..e09091c
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8-r+simd.d
@@ -0,0 +1,18 @@
+# name: attributes for -march=armv8-r+simd
+# source: blank.s
+# as: -march=armv8-r+simd
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_name: "8-R"
+ Tag_CPU_arch: v8-R
+ Tag_CPU_arch_profile: Application
+ Tag_ARM_ISA_use: Yes
+ Tag_THUMB_ISA_use: Thumb-2
+ Tag_FP_arch: FP for ARMv8
+ Tag_Advanced_SIMD_arch: NEON for ARMv8
+ Tag_MPextension_use: Allowed
+ Tag_Virtualization_use: TrustZone and Virtualization Extensions
diff --git a/gas/testsuite/gas/arm/attr-march-armv8-r.d b/gas/testsuite/gas/arm/attr-march-armv8-r.d
new file mode 100644
index 0000000..820f32b
--- /dev/null
+++ b/gas/testsuite/gas/arm/attr-march-armv8-r.d
@@ -0,0 +1,16 @@
+# name: attributes for -march=armv8-r
+# source: blank.s
+# as: -march=armv8-r
+# readelf: -A
+# This test is only valid on EABI based ports.
+# target: *-*-*eabi* *-*-nacl*
+
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_name: "8-R"
+ Tag_CPU_arch: v8-R
+ Tag_CPU_arch_profile: Application
+ Tag_ARM_ISA_use: Yes
+ Tag_THUMB_ISA_use: Thumb-2
+ Tag_MPextension_use: Allowed
+ Tag_Virtualization_use: TrustZone and Virtualization Extensions
diff --git a/gas/testsuite/gas/arm/crc32-bad.d b/gas/testsuite/gas/arm/crc32-armv8-a-bad.d
index 1a4b830..18d4844 100644
--- a/gas/testsuite/gas/arm/crc32-bad.d
+++ b/gas/testsuite/gas/arm/crc32-armv8-a-bad.d
@@ -1,5 +1,6 @@
#objdump: -dr --prefix-addresses --show-raw-insn
-#name: Unpredictable ARMv8 CRC32 instructions.
+#name: Unpredictable ARMv8-A CRC32 instructions.
+#source: crc32-armv8-ar-bad.s
#as: -march=armv8-a+crc
#stderr: crc32-bad.l
#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
diff --git a/gas/testsuite/gas/arm/crc32.d b/gas/testsuite/gas/arm/crc32-armv8-a.d
index 9e6c1c2..b09942e 100644
--- a/gas/testsuite/gas/arm/crc32.d
+++ b/gas/testsuite/gas/arm/crc32-armv8-a.d
@@ -1,5 +1,6 @@
#objdump: -dr --prefix-addresses --show-raw-insn
-#name: ARMv8 CRC32 instructions
+#name: ARMv8-A CRC32 instructions
+#source: crc32-armv8-ar.s
#as: -march=armv8-a+crc
#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
diff --git a/gas/testsuite/gas/arm/crc32-bad.s b/gas/testsuite/gas/arm/crc32-armv8-ar-bad.s
index 4e497e3..4e497e3 100644
--- a/gas/testsuite/gas/arm/crc32-bad.s
+++ b/gas/testsuite/gas/arm/crc32-armv8-ar-bad.s
diff --git a/gas/testsuite/gas/arm/crc32.s b/gas/testsuite/gas/arm/crc32-armv8-ar.s
index 63c1d68..63c1d68 100644
--- a/gas/testsuite/gas/arm/crc32.s
+++ b/gas/testsuite/gas/arm/crc32-armv8-ar.s
diff --git a/gas/testsuite/gas/arm/crc32-armv8-r-bad.d b/gas/testsuite/gas/arm/crc32-armv8-r-bad.d
new file mode 100644
index 0000000..a1a4f61
--- /dev/null
+++ b/gas/testsuite/gas/arm/crc32-armv8-r-bad.d
@@ -0,0 +1,23 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: Unpredictable ARMv8-R CRC32 instructions.
+#source: crc32-armv8-ar-bad.s
+#as: -march=armv8-r+crc
+#stderr: crc32-bad.l
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+.*: +file format .*arm.*
+
+
+Disassembly of section .text:
+0+0 <[^>]*> e101f042 crc32b pc, r1, r2 ; <UNPREDICTABLE>
+0+4 <[^>]*> e12f0042 crc32h r0, pc, r2 ; <UNPREDICTABLE>
+0+8 <[^>]*> e141004f crc32w r0, r1, pc ; <UNPREDICTABLE>
+0+c <[^>]*> e10f0242 crc32cb r0, pc, r2 ; <UNPREDICTABLE>
+0+10 <[^>]*> e121f242 crc32ch pc, r1, r2 ; <UNPREDICTABLE>
+0+14 <[^>]*> e14f0242 crc32cw r0, pc, r2 ; <UNPREDICTABLE>
+0+18 <[^>]*> fac1 fd82 crc32b sp, r1, r2 ; <UNPREDICTABLE>
+0+1c <[^>]*> facf f092 crc32h r0, pc, r2 ; <UNPREDICTABLE>
+0+20 <[^>]*> fac1 f0ad crc32w r0, r1, sp ; <UNPREDICTABLE>
+0+24 <[^>]*> fadf f082 crc32cb r0, pc, r2 ; <UNPREDICTABLE>
+0+28 <[^>]*> fad1 fd92 crc32ch sp, r1, r2 ; <UNPREDICTABLE>
+0+2c <[^>]*> fadf f0a2 crc32cw r0, pc, r2 ; <UNPREDICTABLE>
diff --git a/gas/testsuite/gas/arm/crc32-armv8-r.d b/gas/testsuite/gas/arm/crc32-armv8-r.d
new file mode 100644
index 0000000..b179821
--- /dev/null
+++ b/gas/testsuite/gas/arm/crc32-armv8-r.d
@@ -0,0 +1,23 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: ARMv8-R CRC32 instructions
+#source: crc32-armv8-ar.s
+#as: -march=armv8-r+crc
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+.*: *file format .*arm.*
+
+
+Disassembly of section .text:
+0+0 <[^>]*> e1010042 crc32b r0, r1, r2
+0+4 <[^>]*> e1210042 crc32h r0, r1, r2
+0+8 <[^>]*> e1410042 crc32w r0, r1, r2
+0+c <[^>]*> e1010242 crc32cb r0, r1, r2
+0+10 <[^>]*> e1210242 crc32ch r0, r1, r2
+0+14 <[^>]*> e1410242 crc32cw r0, r1, r2
+0+18 <[^>]*> fac1 f082 crc32b r0, r1, r2
+0+1c <[^>]*> fac1 f092 crc32h r0, r1, r2
+0+20 <[^>]*> fac1 f0a2 crc32w r0, r1, r2
+0+24 <[^>]*> fad1 f082 crc32cb r0, r1, r2
+0+28 <[^>]*> fad1 f092 crc32ch r0, r1, r2
+0+2c <[^>]*> fad1 f0a2 crc32cw r0, r1, r2
+
diff --git a/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.d b/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.d
new file mode 100644
index 0000000..85c7dc3
--- /dev/null
+++ b/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.d
@@ -0,0 +1,4 @@
+# name: Forbidden idiv for ARMv7
+# source: blank.s
+# as: -march=armv7+idiv
+#error-output: forbid-armv7-idiv-ext.l
diff --git a/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l b/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l
new file mode 100644
index 0000000..76208d2
--- /dev/null
+++ b/gas/testsuite/gas/arm/forbid-armv7-idiv-ext.l
@@ -0,0 +1,3 @@
+Assembler messages:
+[^:]*: extension does not apply to the base architecture
+[^:]*: unrecognized option -march=armv7\+idiv
diff --git a/gas/testsuite/gas/arm/ld-sp-warn.l b/gas/testsuite/gas/arm/ld-sp-warn.l
index 48ac57f..6093f30 100644
--- a/gas/testsuite/gas/arm/ld-sp-warn.l
+++ b/gas/testsuite/gas/arm/ld-sp-warn.l
@@ -2,4 +2,3 @@
[^:]*:3: Warning: This instruction may be unpredictable if executed on M-profile cores with interrupts enabled.
[^:]*:4: Warning: This instruction may be unpredictable if executed on M-profile cores with interrupts enabled.
[^:]*:7: Error: Thumb does not support register indexing with writeback -- `ldr r1,\[r0,r1\]!'
-[^:]*:8: Error: r13 not allowed here -- `ldrsb sp,\[r2,#16\]!'
diff --git a/gas/testsuite/gas/arm/mask_1.d b/gas/testsuite/gas/arm/mask_1-armv8-a.d
index eddcd65..ece640a 100644
--- a/gas/testsuite/gas/arm/mask_1.d
+++ b/gas/testsuite/gas/arm/mask_1-armv8-a.d
@@ -1,5 +1,6 @@
#objdump: -dr --prefix-address --show-raw-insn
-#name: vsel, vmaxnm, vminnm, vrint decoding mask.
+#name: ARMv8-A vsel, vmaxnm, vminnm, vrint decoding mask.
+#source: mask_1-armv8-ar.s
#as: -march=armv8-a
# This test is only valid on ELF based ports.
#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
diff --git a/gas/testsuite/gas/arm/mask_1.s b/gas/testsuite/gas/arm/mask_1-armv8-ar.s
index 7a347d8..7a347d8 100644
--- a/gas/testsuite/gas/arm/mask_1.s
+++ b/gas/testsuite/gas/arm/mask_1-armv8-ar.s
diff --git a/gas/testsuite/gas/arm/mask_1-armv8-r.d b/gas/testsuite/gas/arm/mask_1-armv8-r.d
new file mode 100644
index 0000000..6da82ef
--- /dev/null
+++ b/gas/testsuite/gas/arm/mask_1-armv8-r.d
@@ -0,0 +1,29 @@
+#objdump: -dr --prefix-address --show-raw-insn
+#name: ARMv8-R vsel, vmaxnm, vminnm, vrint decoding mask.
+#source: mask_1-armv8-ar.s
+#as: -march=armv8-r
+# This test is only valid on ELF based ports.
+#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+
+# Test VFMA instruction disassembly
+
+.*: *file format .*arm.*
+
+
+Disassembly of section .text:
+0+000 <.*> fe011a10 mcr2 10, 0, r1, cr1, cr0, \{0\} ; <UNPREDICTABLE>
+0+004 <.*> fe011b10 mcr2 11, 0, r1, cr1, cr0, \{0\} ; <UNPREDICTABLE>
+0+008 <.*> fe811a10 mcr2 10, 4, r1, cr1, cr0, \{0\} ; <UNPREDICTABLE>
+0+00c <.*> fe811b10 mcr2 11, 4, r1, cr1, cr0, \{0\} ; <UNPREDICTABLE>
+0+010 <.*> fe811a50 mcr2 10, 4, r1, cr1, cr0, \{2\} ; <UNPREDICTABLE>
+0+014 <.*> fe811b50 mcr2 11, 4, r1, cr1, cr0, \{2\} ; <UNPREDICTABLE>
+0+018 <.*> fefb0ae0 ; <UNDEFINED> instruction: 0xfefb0ae0
+0+01c <.*> fefb0be0 ; <UNDEFINED> instruction: 0xfefb0be0
+0+020 <.*> fefb0ae0 ; <UNDEFINED> instruction: 0xfefb0ae0
+0+024 <.*> fefb0be0 ; <UNDEFINED> instruction: 0xfefb0be0
+0+028 <.*> fef80ae0 ; <UNDEFINED> instruction: 0xfef80ae0
+0+02c <.*> fef80be0 ; <UNDEFINED> instruction: 0xfef80be0
+0+030 <.*> fef90ae0 ; <UNDEFINED> instruction: 0xfef90ae0
+0+034 <.*> fef90be0 ; <UNDEFINED> instruction: 0xfef90be0
+0+038 <.*> fefa0ae0 ; <UNDEFINED> instruction: 0xfefa0ae0
+0+03c <.*> fefa0be0 ; <UNDEFINED> instruction: 0xfefa0be0
diff --git a/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d b/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d
new file mode 100644
index 0000000..c5996fb
--- /dev/null
+++ b/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.d
@@ -0,0 +1,4 @@
+# as: -march=armv8-a
+# name: Invalid SP and PC operands test - THUMB (v8a)
+# source: sp-pc-validations-bad-t.s
+# error-output: sp-pc-validations-bad-t-v8a.l
diff --git a/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l b/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l
new file mode 100644
index 0000000..0da4701
--- /dev/null
+++ b/gas/testsuite/gas/arm/sp-pc-validations-bad-t-v8a.l
@@ -0,0 +1,192 @@
+[^:]*: Assembler messages:
+[^:]*:27: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:27: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:27: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0\]'
+[^:]*:28: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:28: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:28: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0,#0\]'
+[^:]*:29: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:29: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:29: Error: branch must be last instruction in IT block -- `ldreq r15,\[sp\]'
+[^:]*:30: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:30: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:30: Error: branch must be last instruction in IT block -- `ldreq r15,\[sp,#0\]'
+[^:]*:31: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:31: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:31: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[r0\]'
+[^:]*:32: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:32: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:32: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[r0,#0\]'
+[^:]*:33: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:33: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:33: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0,#-4\]'
+[^:]*:34: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:34: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:34: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0\],#4'
+[^:]*:35: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:35: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:35: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0,#0\]!'
+[^:]*:38: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:38: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:38: Error: branch must be last instruction in IT block -- `ldreq r15,label'
+[^:]*:39: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:39: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:39: Error: branch must be last instruction in IT block -- `ldreq.w r15,label'
+[^:]*:40: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:40: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:40: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[pc,#-0\]'
+[^:]*:43: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:43: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:43: Error: branch must be last instruction in IT block -- `ldreq r15,\[r0,r1\]'
+[^:]*:44: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:44: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:44: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[r0,r1\]'
+[^:]*:45: IT blocks containing 16-bit Thumb instructions of the following class are deprecated in ARMv8: Short branches, Undefined, SVC, LDM/STM
+[^:]*:45: IT blocks containing more than one conditional instruction are deprecated in ARMv8
+[^:]*:45: Error: branch must be last instruction in IT block -- `ldreq.w r15,\[r0,r1,LSL#2\]'
+[^:]*:48: Error: r15 not allowed here -- `ldrb pc,\[r0,#4\]'
+[^:]*:51: Error: r15 not allowed here -- `ldrb.w pc,\[r0,#4\]'
+[^:]*:52: Error: r15 not allowed here -- `ldrb pc,\[r0,#-4\]'
+[^:]*:54: Error: r15 not allowed here -- `ldrb pc,\[r0\],#4'
+[^:]*:56: Error: r15 not allowed here -- `ldrb pc,\[r0,#4\]!'
+[^:]*:60: Error: r15 not allowed here -- `ldrb pc,label'
+[^:]*:61: Error: r15 not allowed here -- `ldrb pc,\[PC,#-0\]'
+[^:]*:66: Error: r15 not allowed here -- `ldrb pc,\[r0,r1\]'
+[^:]*:67: Error: cannot use register index with PC-relative addressing -- `ldrb r0,\[pc,r1\]'
+[^:]*:68: Error: r15 not allowed here -- `ldrb r0,\[r1,pc\]'
+[^:]*:69: Error: r15 not allowed here -- `ldrb.w pc,\[r0,r1,LSL#1\]'
+[^:]*:71: Error: r15 not allowed here -- `ldrb.w r2,\[r0,pc,LSL#2\]'
+[^:]*:75: Error: r15 not allowed here -- `ldrbt pc,\[r0,#4\]'
+[^:]*:79: Error: r15 not allowed here -- `ldrd pc,r0,\[r1\]'
+[^:]*:81: Error: r12 not allowed here -- `ldrd r12,\[r1\]'
+[^:]*:82: Error: r14 not allowed here -- `ldrd r14,\[r1\]'
+[^:]*:83: Error: r15 not allowed here -- `ldrd r0,pc,\[r1\]'
+[^:]*:85: Error: r15 not allowed here -- `ldrd pc,r0,\[r1\],#4'
+[^:]*:87: Error: r15 not allowed here -- `ldrd r0,pc,\[r1\],#4'
+[^:]*:89: Error: r12 not allowed here -- `ldrd r12,\[r1\],#4'
+[^:]*:90: Error: r14 not allowed here -- `ldrd r14,\[r1\],#4'
+[^:]*:91: Error: r15 not allowed here -- `ldrd pc,r0,\[r1,#4\]!'
+[^:]*:93: Error: r15 not allowed here -- `ldrd r0,pc,\[r1,#4\]!'
+[^:]*:95: Error: r12 not allowed here -- `ldrd r12,\[r1,#4\]!'
+[^:]*:96: Error: r14 not allowed here -- `ldrd r14,\[r1,#4\]!'
+[^:]*:99: Error: r15 not allowed here -- `ldrd pc,r0,label'
+[^:]*:101: Error: r15 not allowed here -- `ldrd r0,pc,label'
+[^:]*:103: Error: r15 not allowed here -- `ldrd pc,r0,\[pc,#-0\]'
+[^:]*:105: Error: r15 not allowed here -- `ldrd r0,pc,\[pc,#-0\]'
+[^:]*:111: Error: r15 not allowed here -- `ldrex pc,\[r0\]'
+[^:]*:113: Error: r15 not allowed here -- `ldrex r0,\[pc\]'
+[^:]*:114: Error: r15 not allowed here -- `ldrexb pc,\[r0\]'
+[^:]*:116: Error: r15 not allowed here -- `ldrexb r0,\[pc\]'
+[^:]*:117: Error: r15 not allowed here -- `ldrexd pc,r0,\[r1\]'
+[^:]*:119: Error: r15 not allowed here -- `ldrexd r0,pc,\[r1\]'
+[^:]*:121: Error: r15 not allowed here -- `ldrexd r0,r1,\[pc\]'
+[^:]*:122: Error: r15 not allowed here -- `ldrexh pc,\[r0\]'
+[^:]*:124: Error: r15 not allowed here -- `ldrexh r0,\[pc\]'
+[^:]*:127: Error: r15 not allowed here -- `ldrh pc,\[r0\]'
+[^:]*:128: Error: r15 not allowed here -- `ldrh pc,\[r0,#4\]'
+[^:]*:131: Error: r15 not allowed here -- `ldrh.w pc,\[r0\]'
+[^:]*:132: Error: r15 not allowed here -- `ldrh.w pc,\[r0,#4\]'
+[^:]*:135: Error: r15 not allowed here -- `ldrh pc,\[r0,#-3\]'
+[^:]*:137: Error: r15 not allowed here -- `ldrh pc,\[r0\],#4'
+[^:]*:139: Error: r15 not allowed here -- `ldrh pc,\[r0,#4\]!'
+[^:]*:143: Error: r15 not allowed here -- `ldrh pc,label'
+[^:]*:144: Error: r15 not allowed here -- `ldrh pc,\[pc,#-0\]'
+[^:]*:149: Error: r15 not allowed here -- `ldrh pc,\[r0,r1\]'
+[^:]*:150: Error: cannot use register index with PC-relative addressing -- `ldrh r0,\[pc,r1\]'
+[^:]*:151: Error: r15 not allowed here -- `ldrh r0,\[r1,pc\]'
+[^:]*:152: Error: r15 not allowed here -- `ldrh.w pc,\[r0,r1,LSL#1\]'
+[^:]*:154: Error: r15 not allowed here -- `ldrh.w r2,\[r0,pc,LSL#1\]'
+[^:]*:158: Error: r15 not allowed here -- `ldrht pc,\[r0,#4\]'
+[^:]*:162: Error: r15 not allowed here -- `ldrsb pc,\[r0,#4\]'
+[^:]*:165: Error: r15 not allowed here -- `ldrsb pc,\[r0,#-4\]'
+[^:]*:167: Error: r15 not allowed here -- `ldrsb pc,\[r0\],#4'
+[^:]*:169: Error: r15 not allowed here -- `ldrsb pc,\[r0,#4\]!'
+[^:]*:173: Error: r15 not allowed here -- `ldrsb pc,label'
+[^:]*:174: Error: r15 not allowed here -- `ldrsb pc,\[pc,#-0\]'
+[^:]*:179: Error: r15 not allowed here -- `ldrsb pc,\[r0,r1\]'
+[^:]*:180: Error: cannot use register index with PC-relative addressing -- `ldrsb r0,\[pc,r1\]'
+[^:]*:181: Error: r15 not allowed here -- `ldrsb r0,\[r1,pc\]'
+[^:]*:182: Error: r15 not allowed here -- `ldrsb.w pc,\[r0,r1,LSL#2\]'
+[^:]*:185: Error: r15 not allowed here -- `ldrsb.w r2,\[r0,pc,LSL#2\]'
+[^:]*:190: Error: r15 not allowed here -- `ldrsbt pc,\[r0,#4\]'
+[^:]*:195: Error: r15 not allowed here -- `ldrsh pc,\[r0,#4\]'
+[^:]*:197: Error: r15 not allowed here -- `ldrsh pc,\[r0,#-4\]'
+[^:]*:198: Error: r15 not allowed here -- `ldrsh pc,\[r0\],#4'
+[^:]*:199: Error: r15 not allowed here -- `ldrsh pc,\[r0,#4\]!'
+[^:]*:205: Error: r15 not allowed here -- `ldrsh pc,label'
+[^:]*:210: Error: r15 not allowed here -- `ldrsh pc,\[r0,r1\]'
+[^:]*:211: Error: cannot use register index with PC-relative addressing -- `ldrsh r0,\[pc,r1\]'
+[^:]*:212: Error: r15 not allowed here -- `ldrsh r0,\[r1,pc\]'
+[^:]*:214: Error: r15 not allowed here -- `ldrsh.w pc,\[r0,r1,LSL#3\]'
+[^:]*:217: Error: r15 not allowed here -- `ldrsh.w r0,\[r1,pc,LSL#3\]'
+[^:]*:221: Error: r15 not allowed here -- `ldrsht pc,\[r0,#4\]'
+[^:]*:226: Error: r15 not allowed here -- `ldrt pc,\[r0,#4\]'
+[^:]*:232: Error: r15 not allowed here -- `str pc,\[r0,#4\]'
+[^:]*:233: Error: cannot use register index with PC-relative addressing -- `str.w r0,\[pc,#4\]'
+[^:]*:234: Error: cannot use register index with PC-relative addressing -- `str r0,\[pc,#-4\]'
+[^:]*:235: Error: cannot use post-indexing with PC-relative addressing -- `str r0,\[pc\],#4'
+[^:]*:236: Error: cannot use writeback with PC-relative addressing -- `str r0,\[pc,#4\]!'
+[^:]*:239: Error: cannot use register index with PC-relative addressing -- `str.w r0,\[pc,r1\]'
+[^:]*:240: Error: cannot use register index with PC-relative addressing -- `str.w r0,\[pc,r1,LSL#2\]'
+[^:]*:246: Error: cannot use register index with PC-relative addressing -- `strb.w r0,\[pc,#4\]'
+[^:]*:247: Error: r15 not allowed here -- `strb.w pc,\[r0,#4\]'
+[^:]*:249: Error: cannot use register index with PC-relative addressing -- `strb r0,\[pc,#-4\]'
+[^:]*:250: Error: cannot use post-indexing with PC-relative addressing -- `strb r0,\[pc\],#4'
+[^:]*:251: Error: cannot use writeback with PC-relative addressing -- `strb r0,\[pc,#4\]!'
+[^:]*:252: Error: r15 not allowed here -- `strb pc,\[r0,#-4\]'
+[^:]*:253: Error: r15 not allowed here -- `strb pc,\[r0\],#4'
+[^:]*:254: Error: r15 not allowed here -- `strb pc,\[r0,#4\]!'
+[^:]*:260: Error: cannot use register index with PC-relative addressing -- `strb.w r0,\[pc,r1\]'
+[^:]*:261: Error: cannot use register index with PC-relative addressing -- `strb.w r0,\[pc,r1,LSL#2\]'
+[^:]*:262: Error: r15 not allowed here -- `strb.w pc,\[r0,r1\]'
+[^:]*:263: Error: r15 not allowed here -- `strb.w pc,\[r0,r1,LSL#2\]'
+[^:]*:266: Error: r15 not allowed here -- `strb.w r0,\[r1,pc\]'
+[^:]*:267: Error: r15 not allowed here -- `strb.w r0,\[r1,pc,LSL#2\]'
+[^:]*:272: Error: cannot use register index with PC-relative addressing -- `strbt r0,\[pc,#4\]'
+[^:]*:273: Error: r15 not allowed here -- `strbt pc,\[r0,#4\]'
+[^:]*:277: Error: cannot use register index with PC-relative addressing -- `strd r0,r1,\[pc,#4\]'
+[^:]*:278: Error: cannot use post-indexing with PC-relative addressing -- `strd r0,r1,\[pc\],#4'
+[^:]*:279: Error: cannot use writeback with PC-relative addressing -- `strd r0,r1,\[pc,#4\]!'
+[^:]*:280: Error: r15 not allowed here -- `strd pc,r0,\[r1,#4\]'
+[^:]*:281: Error: r15 not allowed here -- `strd pc,r0,\[r1\],#4'
+[^:]*:282: Error: r15 not allowed here -- `strd pc,r0,\[r1,#4\]!'
+[^:]*:286: Error: r15 not allowed here -- `strd r0,pc,\[r1,#4\]'
+[^:]*:287: Error: r15 not allowed here -- `strd r0,pc,\[r1\],#4'
+[^:]*:288: Error: r15 not allowed here -- `strd r0,pc,\[r1,#4\]!'
+[^:]*:297: Error: r15 not allowed here -- `strex pc,r0,\[r1\]'
+[^:]*:298: Error: r15 not allowed here -- `strex pc,r0,\[r1,#4\]'
+[^:]*:301: Error: r15 not allowed here -- `strex r0,pc,\[r1\]'
+[^:]*:302: Error: r15 not allowed here -- `strex r0,pc,\[r1,#4\]'
+[^:]*:305: Error: r15 not allowed here -- `strex r0,r1,\[pc\]'
+[^:]*:306: Error: r15 not allowed here -- `strex r0,r1,\[pc,#4\]'
+[^:]*:309: Error: r15 not allowed here -- `strexb pc,r0,\[r1\]'
+[^:]*:311: Error: r15 not allowed here -- `strexb r0,pc,\[r1\]'
+[^:]*:313: Error: r15 not allowed here -- `strexb r0,r1,\[pc\]'
+[^:]*:316: Error: r15 not allowed here -- `strexd pc,r0,r1,\[r2\]'
+[^:]*:318: Error: r15 not allowed here -- `strexd r0,pc,r1,\[r2\]'
+[^:]*:320: Error: r15 not allowed here -- `strexd r0,r1,pc,\[r2\]'
+[^:]*:322: Error: r15 not allowed here -- `strexd r0,r1,r2,\[pc\]'
+[^:]*:325: Error: r15 not allowed here -- `strexh pc,r0,\[r1\]'
+[^:]*:327: Error: r15 not allowed here -- `strexh r0,pc,\[r1\]'
+[^:]*:329: Error: r15 not allowed here -- `strexh r0,r1,\[pc\]'
+[^:]*:332: Error: cannot use register index with PC-relative addressing -- `strh.w r0,\[pc\]'
+[^:]*:333: Error: cannot use register index with PC-relative addressing -- `strh.w r0,\[pc,#4\]'
+[^:]*:334: Error: cannot use register index with PC-relative addressing -- `strh r0,\[pc,#-4\]'
+[^:]*:335: Error: cannot use post-indexing with PC-relative addressing -- `strh r0,\[pc\],#4'
+[^:]*:336: Error: cannot use writeback with PC-relative addressing -- `strh r0,\[pc,#4\]!'
+[^:]*:339: Error: cannot use register index with PC-relative addressing -- `strh.w r0,\[pc,r1\]'
+[^:]*:340: Error: cannot use register index with PC-relative addressing -- `strh.w r0,\[pc,r1,LSL#2\]'
+[^:]*:341: Error: r15 not allowed here -- `strh.w pc,\[r0,#4\]'
+[^:]*:342: Error: r15 not allowed here -- `strh.w pc,\[r0\]'
+[^:]*:345: Error: r15 not allowed here -- `strh pc,\[r0,#-4\]'
+[^:]*:346: Error: r15 not allowed here -- `strh pc,\[r0\],#4'
+[^:]*:347: Error: r15 not allowed here -- `strh pc,\[r0,#4\]!'
+[^:]*:351: Error: r15 not allowed here -- `strh.w pc,\[r0,r1\]'
+[^:]*:353: Error: r15 not allowed here -- `strh.w r0,\[r1,pc\]'
+[^:]*:355: Error: r15 not allowed here -- `strh.w pc,\[r0,r1,LSL#2\]'
+[^:]*:357: Error: r15 not allowed here -- `strh.w r0,\[r1,pc,LSL#2\]'
+[^:]*:361: Error: cannot use register index with PC-relative addressing -- `strht r0,\[pc,#4\]'
+[^:]*:362: Error: r15 not allowed here -- `strht pc,\[r0,#4\]'
+[^:]*:363: Error: cannot use register index with PC-relative addressing -- `strht sp,\[pc,#4\]'
+[^:]*:366: Error: cannot use register index with PC-relative addressing -- `strt r0,\[pc,#4\]'
+[^:]*:367: Error: r15 not allowed here -- `strt pc,\[r0,#4\]'
diff --git a/gas/testsuite/gas/arm/sp-pc-validations-bad-t.d b/gas/testsuite/gas/arm/sp-pc-validations-bad-t.d
index 8579f43..7c84944 100644
--- a/gas/testsuite/gas/arm/sp-pc-validations-bad-t.d
+++ b/gas/testsuite/gas/arm/sp-pc-validations-bad-t.d
@@ -1,2 +1,3 @@
-# name: Invalid SP and PC operands test - THUMB
+# name: Invalid SP and PC operands test - THUMB (v7a)
+# as: -march=armv7-a
# error-output: sp-pc-validations-bad-t.l
diff --git a/gas/testsuite/gas/arm/sp-pc-validations-bad-t.s b/gas/testsuite/gas/arm/sp-pc-validations-bad-t.s
index 3da0861..8ea4766 100644
--- a/gas/testsuite/gas/arm/sp-pc-validations-bad-t.s
+++ b/gas/testsuite/gas/arm/sp-pc-validations-bad-t.s
@@ -1,5 +1,5 @@
.syntax unified
-.arch armv7-a
+@ Enable Thumb mode
.thumb
.macro it_test opcode operands:vararg
itt eq
diff --git a/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d b/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d
new file mode 100644
index 0000000..0707f0e
--- /dev/null
+++ b/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.d
@@ -0,0 +1,4 @@
+#as: -march=armv7-a
+#name: Invalid SP operands test - THUMB (v7a)
+#source: sp-usage-thumb2-relax.s
+#error-output: sp-usage-thumb2-relax-on-v7.l
diff --git a/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l b/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l
new file mode 100644
index 0000000..f19274a
--- /dev/null
+++ b/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v7.l
@@ -0,0 +1,17 @@
+[^:]*: Assembler messages:
+[^:]*:25: Error: r13 not allowed here -- `add.w sp,r7,#1'
+[^:]*:25: Error: r13 not allowed here -- `sub.w sp,r7,#1'
+[^:]*:25: Error: r13 not allowed here -- `addw sp,r7,#1'
+[^:]*:25: Error: r13 not allowed here -- `subw sp,r7,#1'
+[^:]*:26: Error: r13 not allowed here -- `bic r7,sp,r2'
+[^:]*:26: Error: r13 not allowed here -- `sbcs r7,sp,r2'
+[^:]*:26: Error: r13 not allowed here -- `and r7,sp,r2'
+[^:]*:26: Error: r13 not allowed here -- `eor r7,sp,r2'
+[^:]*:27: Error: r13 not allowed here -- `smlabb sp,sp,sp,sp'
+[^:]*:27: Error: r13 not allowed here -- `smlabb r0,sp,r3,r11'
+[^:]*:27: Error: r13 not allowed here -- `smlatb sp,sp,sp,sp'
+[^:]*:27: Error: r13 not allowed here -- `smlatb r0,sp,r3,r11'
+[^:]*:27: Error: r13 not allowed here -- `smlabt sp,sp,sp,sp'
+[^:]*:27: Error: r13 not allowed here -- `smlabt r0,sp,r3,r11'
+[^:]*:27: Error: r13 not allowed here -- `smlabt sp,sp,sp,sp'
+[^:]*:27: Error: r13 not allowed here -- `smlabt r0,sp,r3,r11'
diff --git a/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d b/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d
new file mode 100644
index 0000000..be2bb9e
--- /dev/null
+++ b/gas/testsuite/gas/arm/sp-usage-thumb2-relax-on-v8.d
@@ -0,0 +1,25 @@
+#as: -march=armv8-a
+#source: sp-usage-thumb2-relax.s
+#objdump: -d
+
+.*: file format .*
+
+Disassembly of section \.text:
+
+.* <.*>:
+.*: f107 0d01 add.w sp, r7, #1
+.*: f1a7 0d01 sub.w sp, r7, #1
+.*: f207 0d01 addw sp, r7, #1
+.*: f2a7 0d01 subw sp, r7, #1
+.*: ea2d 0702 bic.w r7, sp, r2
+.*: eb7d 0702 sbcs.w r7, sp, r2
+.*: ea0d 0702 and.w r7, sp, r2
+.*: ea8d 0702 eor.w r7, sp, r2
+.*: fb1d dd0d smlabb sp, sp, sp, sp
+.*: fb1d b003 smlabb r0, sp, r3, fp
+.*: fb1d dd2d smlatb sp, sp, sp, sp
+.*: fb1d b023 smlatb r0, sp, r3, fp
+.*: fb1d dd1d smlabt sp, sp, sp, sp
+.*: fb1d b013 smlabt r0, sp, r3, fp
+.*: fb1d dd1d smlabt sp, sp, sp, sp
+.*: fb1d b013 smlabt r0, sp, r3, fp
diff --git a/gas/testsuite/gas/arm/sp-usage-thumb2-relax.s b/gas/testsuite/gas/arm/sp-usage-thumb2-relax.s
new file mode 100644
index 0000000..99a3bf6
--- /dev/null
+++ b/gas/testsuite/gas/arm/sp-usage-thumb2-relax.s
@@ -0,0 +1,27 @@
+ .macro iter_addsub
+ .irp m, add.w, sub.w, addw, subw
+ \m sp, r7, #1
+ .endr
+ .endm
+
+ .macro iter_arith3
+ .irp m, bic, sbcs, and, eor
+ \m r7, sp, r2
+ .endr
+ .endm
+
+ .macro iter_mla
+ .irp m, smlabb, smlatb, smlabt, smlabt
+ \m sp, sp, sp, sp
+ \m r0, sp, r3, r11
+ .endr
+ .endm
+
+ .syntax unified
+ .text
+ .thumb
+ .global foo
+foo:
+ iter_addsub
+ iter_arith3
+ iter_mla
diff --git a/gas/testsuite/gas/arm/strex-bad-t.d b/gas/testsuite/gas/arm/strex-bad-t.d
index f5ec4c5..3640746 100644
--- a/gas/testsuite/gas/arm/strex-bad-t.d
+++ b/gas/testsuite/gas/arm/strex-bad-t.d
@@ -1,3 +1,4 @@
# name: Bad addressing modes STREXH/STREXB. - THUMB
+# as: -march=armv7-a
# error-output: strex-bad-t.l
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index ad38d66..6b2b31a 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -184,6 +184,7 @@ if { [is_elf_format] } then {
run_dump_test "symtab"
}
run_dump_test "symver"
+ run_dump_test "pr21661"
# No indirect functions on non-GNU targets.
# The Visium and MSP set the ELF header's OSABI field to ELFOSABI_STANDALONE.
diff --git a/gas/testsuite/gas/elf/pr21661.d b/gas/testsuite/gas/elf/pr21661.d
new file mode 100644
index 0000000..a16e410
--- /dev/null
+++ b/gas/testsuite/gas/elf/pr21661.d
@@ -0,0 +1,2 @@
+#name: unsupported .symver with common symbol
+#error-output: pr21661.l
diff --git a/gas/testsuite/gas/elf/pr21661.l b/gas/testsuite/gas/elf/pr21661.l
new file mode 100644
index 0000000..0565faa
--- /dev/null
+++ b/gas/testsuite/gas/elf/pr21661.l
@@ -0,0 +1,3 @@
+[^:]*: Assembler messages:
+[^:]*:2: Error: `foo@VERS.1' can't be versioned to common symbol 'foo'
+[^:]*: Error: `bar@VERS.1' can't be versioned to common symbol 'bar'
diff --git a/gas/testsuite/gas/elf/pr21661.s b/gas/testsuite/gas/elf/pr21661.s
new file mode 100644
index 0000000..5586bfd
--- /dev/null
+++ b/gas/testsuite/gas/elf/pr21661.s
@@ -0,0 +1,4 @@
+ .comm foo,8,8
+ .symver foo,foo@VERS.1
+ .symver bar,bar@VERS.1
+ .comm bar,8,8
diff --git a/gas/testsuite/gas/i386/cet-intel.d b/gas/testsuite/gas/i386/cet-intel.d
index a5f5533..79da878 100644
--- a/gas/testsuite/gas/i386/cet-intel.d
+++ b/gas/testsuite/gas/i386/cet-intel.d
@@ -8,23 +8,23 @@
Disassembly of section .text:
0+ <_start>:
- +[a-f0-9]+: f3 0f 01 e9 incsspd
+ +[a-f0-9]+: f3 0f ae e9 incsspd ecx
+[a-f0-9]+: f3 0f 1e c9 rdsspd ecx
- +[a-f0-9]+: f3 0f 01 ea savessp
+ +[a-f0-9]+: f3 0f 01 ea saveprevssp
+[a-f0-9]+: f3 0f 01 29 rstorssp QWORD PTR \[ecx\]
+[a-f0-9]+: 0f 38 f6 04 02 wrssd \[edx\+eax\*1\],eax
+[a-f0-9]+: 66 0f 38 f5 14 2f wrussd \[edi\+ebp\*1\],edx
- +[a-f0-9]+: f3 0f ae 28 setssbsy QWORD PTR \[eax\]
+ +[a-f0-9]+: f3 0f 01 e8 setssbsy
+[a-f0-9]+: f3 0f ae 34 04 clrssbsy QWORD PTR \[esp\+eax\*1\]
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
- +[a-f0-9]+: f3 0f 01 e9 incsspd
+ +[a-f0-9]+: f3 0f ae e9 incsspd ecx
+[a-f0-9]+: f3 0f 1e c9 rdsspd ecx
- +[a-f0-9]+: f3 0f 01 ea savessp
+ +[a-f0-9]+: f3 0f 01 ea saveprevssp
+[a-f0-9]+: f3 0f 01 2c 01 rstorssp QWORD PTR \[ecx\+eax\*1\]
+[a-f0-9]+: 0f 38 f6 02 wrssd \[edx\],eax
+[a-f0-9]+: 66 0f 38 f5 14 2f wrussd \[edi\+ebp\*1\],edx
- +[a-f0-9]+: f3 0f ae 28 setssbsy QWORD PTR \[eax\]
+ +[a-f0-9]+: f3 0f 01 e8 setssbsy
+[a-f0-9]+: f3 0f ae 34 04 clrssbsy QWORD PTR \[esp\+eax\*1\]
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
diff --git a/gas/testsuite/gas/i386/cet.d b/gas/testsuite/gas/i386/cet.d
index bb356e4..982d40e 100644
--- a/gas/testsuite/gas/i386/cet.d
+++ b/gas/testsuite/gas/i386/cet.d
@@ -6,23 +6,23 @@
Disassembly of section .text:
0+ <_start>:
- +[a-f0-9]+: f3 0f 01 e9 incsspd
+ +[a-f0-9]+: f3 0f ae e9 incsspd %ecx
+[a-f0-9]+: f3 0f 1e c9 rdsspd %ecx
- +[a-f0-9]+: f3 0f 01 ea savessp
+ +[a-f0-9]+: f3 0f 01 ea saveprevssp
+[a-f0-9]+: f3 0f 01 29 rstorssp \(%ecx\)
+[a-f0-9]+: 0f 38 f6 04 02 wrssd %eax,\(%edx,%eax,1\)
+[a-f0-9]+: 66 0f 38 f5 14 2f wrussd %edx,\(%edi,%ebp,1\)
- +[a-f0-9]+: f3 0f ae 28 setssbsy \(%eax\)
+ +[a-f0-9]+: f3 0f 01 e8 setssbsy
+[a-f0-9]+: f3 0f ae 34 04 clrssbsy \(%esp,%eax,1\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
- +[a-f0-9]+: f3 0f 01 e9 incsspd
+ +[a-f0-9]+: f3 0f ae e9 incsspd %ecx
+[a-f0-9]+: f3 0f 1e c9 rdsspd %ecx
- +[a-f0-9]+: f3 0f 01 ea savessp
+ +[a-f0-9]+: f3 0f 01 ea saveprevssp
+[a-f0-9]+: f3 0f 01 2c 01 rstorssp \(%ecx,%eax,1\)
+[a-f0-9]+: 0f 38 f6 02 wrssd %eax,\(%edx\)
+[a-f0-9]+: 66 0f 38 f5 14 2f wrussd %edx,\(%edi,%ebp,1\)
- +[a-f0-9]+: f3 0f ae 28 setssbsy \(%eax\)
+ +[a-f0-9]+: f3 0f 01 e8 setssbsy
+[a-f0-9]+: f3 0f ae 34 04 clrssbsy \(%esp,%eax,1\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
diff --git a/gas/testsuite/gas/i386/cet.s b/gas/testsuite/gas/i386/cet.s
index deb659d..f0178a8 100644
--- a/gas/testsuite/gas/i386/cet.s
+++ b/gas/testsuite/gas/i386/cet.s
@@ -1,25 +1,25 @@
# Check CET instructions
.text
_start:
- incsspd
+ incsspd %ecx
rdsspd %ecx
- savessp
+ saveprevssp
rstorssp (%ecx)
wrssd %eax, (%edx, %eax)
wrussd %edx, (%edi, %ebp)
- setssbsy (%eax)
+ setssbsy
clrssbsy (%esp, %eax)
endbr64
endbr32
.intel_syntax noprefix
- incsspd
+ incsspd ecx
rdsspd ecx
- savessp
+ saveprevssp
rstorssp QWORD PTR [ecx + eax]
wrssd [edx],eax
wrussd [edi + ebp],edx
- setssbsy QWORD PTR [eax]
+ setssbsy
clrssbsy QWORD PTR [esp + eax]
endbr64
endbr32
diff --git a/gas/testsuite/gas/i386/mpx.d b/gas/testsuite/gas/i386/mpx.d
index 0e84b9b..c7c08ad 100644
--- a/gas/testsuite/gas/i386/mpx.d
+++ b/gas/testsuite/gas/i386/mpx.d
@@ -130,4 +130,8 @@ Disassembly of section .text:
[a-f0-9]+ <foo>:
[ ]*[a-f0-9]+: f2 c3 bnd ret
+
+[a-f0-9]+ <bad>:
+[ ]*[a-f0-9]+: 0f 1a 30 bndldx \(%eax\),\(bad\)
+[ ]*[a-f0-9]+: 66 0f 1a c4 bndmov \(bad\),%bnd0
#pass
diff --git a/gas/testsuite/gas/i386/mpx.s b/gas/testsuite/gas/i386/mpx.s
index 3d1b5d0..1ae51fc 100644
--- a/gas/testsuite/gas/i386/mpx.s
+++ b/gas/testsuite/gas/i386/mpx.s
@@ -157,3 +157,15 @@ start:
bnd ret
foo: bnd ret
+
+bad:
+ # bndldx (%eax),(bad)
+ .byte 0x0f
+ .byte 0x1a
+ .byte 0x30
+
+ # bndmov (bad),%bnd0
+ .byte 0x66
+ .byte 0x0f
+ .byte 0x1a
+ .byte 0xc4
diff --git a/gas/testsuite/gas/i386/notrack-intel.d b/gas/testsuite/gas/i386/notrack-intel.d
index b99e194..2ab6a8a 100644
--- a/gas/testsuite/gas/i386/notrack-intel.d
+++ b/gas/testsuite/gas/i386/notrack-intel.d
@@ -12,18 +12,34 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 3e ff d0 notrack call ax
[ ]*[a-f0-9]+: 3e ff e0 notrack jmp eax
[ ]*[a-f0-9]+: 66 3e ff e0 notrack jmp ax
+[ ]*[a-f0-9]+: 3e ff 10 notrack call DWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 66 3e ff 10 notrack call WORD PTR \[eax\]
+[ ]*[a-f0-9]+: 3e ff 20 notrack jmp DWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 66 3e ff 20 notrack jmp WORD PTR \[eax\]
[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call eax
[ ]*[a-f0-9]+: 66 f2 3e ff d0 bnd notrack call ax
[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp eax
[ ]*[a-f0-9]+: 66 f2 3e ff e0 bnd notrack jmp ax
+[ ]*[a-f0-9]+: f2 3e ff 10 bnd notrack call DWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 66 f2 3e ff 10 bnd notrack call WORD PTR \[eax\]
+[ ]*[a-f0-9]+: f2 3e ff 20 bnd notrack jmp DWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 66 f2 3e ff 20 bnd notrack jmp WORD PTR \[eax\]
[ ]*[a-f0-9]+: 3e ff d0 notrack call eax
[ ]*[a-f0-9]+: 66 3e ff d0 notrack call ax
[ ]*[a-f0-9]+: 3e ff e0 notrack jmp eax
[ ]*[a-f0-9]+: 66 3e ff e0 notrack jmp ax
+[ ]*[a-f0-9]+: 3e ff 10 notrack call DWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 66 3e ff 10 notrack call WORD PTR \[eax\]
+[ ]*[a-f0-9]+: 3e ff 20 notrack jmp DWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 66 3e ff 20 notrack jmp WORD PTR \[eax\]
[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call eax
[ ]*[a-f0-9]+: 66 f2 3e ff d0 bnd notrack call ax
[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp eax
[ ]*[a-f0-9]+: 66 f2 3e ff e0 bnd notrack jmp ax
+[ ]*[a-f0-9]+: f2 3e ff 10 bnd notrack call DWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 66 f2 3e ff 10 bnd notrack call WORD PTR \[eax\]
+[ ]*[a-f0-9]+: f2 3e ff 20 bnd notrack jmp DWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 66 f2 3e ff 20 bnd notrack jmp WORD PTR \[eax\]
[ ]*[a-f0-9]+: 3e f2 ff d0 ds bnd call eax
[ ]*[a-f0-9]+: 3e 66 ff d0 ds call ax
#pass
diff --git a/gas/testsuite/gas/i386/notrack.d b/gas/testsuite/gas/i386/notrack.d
index eda09eb..11d0ce9 100644
--- a/gas/testsuite/gas/i386/notrack.d
+++ b/gas/testsuite/gas/i386/notrack.d
@@ -11,18 +11,34 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 3e ff d0 notrack callw \*%ax
[ ]*[a-f0-9]+: 3e ff e0 notrack jmp \*%eax
[ ]*[a-f0-9]+: 66 3e ff e0 notrack jmpw \*%ax
+[ ]*[a-f0-9]+: 3e ff 10 notrack call \*\(%eax\)
+[ ]*[a-f0-9]+: 66 3e ff 10 notrack callw \*\(%eax\)
+[ ]*[a-f0-9]+: 3e ff 20 notrack jmp \*\(%eax\)
+[ ]*[a-f0-9]+: 66 3e ff 20 notrack jmpw \*\(%eax\)
[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call \*%eax
[ ]*[a-f0-9]+: 66 f2 3e ff d0 bnd notrack callw \*%ax
[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp \*%eax
[ ]*[a-f0-9]+: 66 f2 3e ff e0 bnd notrack jmpw \*%ax
+[ ]*[a-f0-9]+: f2 3e ff 10 bnd notrack call \*\(%eax\)
+[ ]*[a-f0-9]+: 66 f2 3e ff 10 bnd notrack callw \*\(%eax\)
+[ ]*[a-f0-9]+: f2 3e ff 20 bnd notrack jmp \*\(%eax\)
+[ ]*[a-f0-9]+: 66 f2 3e ff 20 bnd notrack jmpw \*\(%eax\)
[ ]*[a-f0-9]+: 3e ff d0 notrack call \*%eax
[ ]*[a-f0-9]+: 66 3e ff d0 notrack callw \*%ax
[ ]*[a-f0-9]+: 3e ff e0 notrack jmp \*%eax
[ ]*[a-f0-9]+: 66 3e ff e0 notrack jmpw \*%ax
+[ ]*[a-f0-9]+: 3e ff 10 notrack call \*\(%eax\)
+[ ]*[a-f0-9]+: 66 3e ff 10 notrack callw \*\(%eax\)
+[ ]*[a-f0-9]+: 3e ff 20 notrack jmp \*\(%eax\)
+[ ]*[a-f0-9]+: 66 3e ff 20 notrack jmpw \*\(%eax\)
[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call \*%eax
[ ]*[a-f0-9]+: 66 f2 3e ff d0 bnd notrack callw \*%ax
[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp \*%eax
[ ]*[a-f0-9]+: 66 f2 3e ff e0 bnd notrack jmpw \*%ax
+[ ]*[a-f0-9]+: f2 3e ff 10 bnd notrack call \*\(%eax\)
+[ ]*[a-f0-9]+: 66 f2 3e ff 10 bnd notrack callw \*\(%eax\)
+[ ]*[a-f0-9]+: f2 3e ff 20 bnd notrack jmp \*\(%eax\)
+[ ]*[a-f0-9]+: 66 f2 3e ff 20 bnd notrack jmpw \*\(%eax\)
[ ]*[a-f0-9]+: 3e f2 ff d0 ds bnd call \*%eax
[ ]*[a-f0-9]+: 3e 66 ff d0 ds callw \*%ax
#pass
diff --git a/gas/testsuite/gas/i386/notrack.s b/gas/testsuite/gas/i386/notrack.s
index 3b8b210..8383645 100644
--- a/gas/testsuite/gas/i386/notrack.s
+++ b/gas/testsuite/gas/i386/notrack.s
@@ -8,27 +8,49 @@ _start:
notrack jmp *%eax
notrack jmp *%ax
+ notrack call *(%eax)
+ notrack callw *(%eax)
+ notrack jmp *(%eax)
+ notrack jmpw *(%eax)
+
bnd notrack call *%eax
bnd notrack call *%ax
bnd notrack jmp *%eax
bnd notrack jmp *%ax
+ bnd notrack call *(%eax)
+ bnd notrack callw *(%eax)
+ bnd notrack jmp *(%eax)
+ bnd notrack jmpw *(%eax)
+
.intel_syntax noprefix
notrack call eax
notrack call ax
notrack jmp eax
notrack jmp ax
+ notrack call DWORD PTR [eax]
+ notrack call WORD PTR [eax]
+ notrack jmp DWORD PTR [eax]
+ notrack jmp WORD PTR [eax]
+
bnd notrack call eax
bnd notrack call ax
bnd notrack jmp eax
bnd notrack jmp ax
+ bnd notrack call DWORD PTR [eax]
+ bnd notrack call WORD PTR [eax]
+ bnd notrack jmp DWORD PTR [eax]
+ bnd notrack jmp WORD PTR [eax]
+
+ # ds bnd call *%eax
.byte 0x3e
.byte 0xf2
.byte 0xff
.byte 0xd0
+ # ds callw *%ax
.byte 0x3e
.byte 0x66
.byte 0xff
diff --git a/gas/testsuite/gas/i386/notrackbad.l b/gas/testsuite/gas/i386/notrackbad.l
index 0f8cf7d..48ee69f 100644
--- a/gas/testsuite/gas/i386/notrackbad.l
+++ b/gas/testsuite/gas/i386/notrackbad.l
@@ -1,20 +1,16 @@
.*: Assembler messages:
-.*:6: Error: expecting register indirect branch instruction after `notrack'
+.*:6: Error: expecting indirect branch instruction after `notrack'
.*:6: Warning: skipping prefixes on this instruction
-.*:7: Error: expecting register indirect branch instruction after `notrack'
+.*:7: Error: expecting indirect branch instruction after `notrack'
.*:7: Warning: skipping prefixes on this instruction
-.*:9: Error: expecting register indirect branch instruction after `notrack'
-.*:10: Error: expecting register indirect branch instruction after `notrack'
-.*:11: Error: same type of prefix used twice
+.*:9: Error: same type of prefix used twice
+.*:10: Error: expecting no other prefixes after `notrack'
+.*:11: Error: expecting no other prefixes after `notrack'
.*:12: Error: expecting no other prefixes after `notrack'
-.*:13: Error: expecting no other prefixes after `notrack'
-.*:14: Error: expecting no other prefixes after `notrack'
-.*:17: Error: expecting register indirect branch instruction after `notrack'
-.*:18: Error: expecting register indirect branch instruction after `notrack'
-.*:19: Error: same type of prefix used twice
-.*:20: Error: expecting no other prefixes after `notrack'
-.*:21: Error: expecting no other prefixes after `notrack'
-.*:22: Error: expecting no other prefixes after `notrack'
+.*:15: Error: same type of prefix used twice
+.*:16: Error: expecting no other prefixes after `notrack'
+.*:17: Error: expecting no other prefixes after `notrack'
+.*:18: Error: expecting no other prefixes after `notrack'
GAS LISTING .*
@@ -24,30 +20,22 @@ GAS LISTING .*
[ ]*4[ ]+\.text
[ ]*5[ ]+_start:
[ ]*6[ ]+\?\?\?\? [0-9A-F]* notrack call foo
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
+\*\*\*\* Error: expecting indirect branch instruction after `notrack'
\*\*\*\* Warning: skipping prefixes on this instruction
[ ]*6[ ]+[0-9A-F]*
[ ]*7[ ]+\?\?\?\? [0-9A-F]* notrack jmp foo
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
+\*\*\*\* Error: expecting indirect branch instruction after `notrack'
\*\*\*\* Warning: skipping prefixes on this instruction
[ ]*7[ ]+[0-9A-F]*
[ ]*8[ ]+
-[ ]*9[ ]+\?\?\?\? 3EFF10 notrack call \*\(%eax\)
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
-[ ]*10[ ]+\?\?\?\? 3EFF20 notrack jmp \*\(%eax\)
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
-[ ]*11[ ]+fs notrack call \*%eax
-[ ]*12[ ]+notrack fs call \*%eax
-[ ]*13[ ]+notrack bnd call \*%eax
-[ ]*14[ ]+notrack data16 call \*%eax
-[ ]*15[ ]+
-[ ]*16[ ]+\.intel_syntax noprefix
-[ ]*17[ ]+\?\?\?\? 3EFF10 notrack call \[eax\]
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
-[ ]*18[ ]+\?\?\?\? 3EFF20 notrack jmp \[eax\]
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
-[ ]*19[ ]+fs notrack call eax
-[ ]*20[ ]+notrack fs call eax
-[ ]*21[ ]+notrack bnd call eax
-[ ]*22.*[ ]+notrack data16 call eax
+[ ]*9[ ]+fs notrack call \*%eax
+[ ]*10[ ]+notrack fs call \*%eax
+[ ]*11[ ]+notrack bnd call \*%eax
+[ ]*12[ ]+notrack data16 call \*%eax
+[ ]*13[ ]+
+[ ]*14[ ]+\.intel_syntax noprefix
+[ ]*15[ ]+fs notrack call eax
+[ ]*16[ ]+notrack fs call eax
+[ ]*17[ ]+notrack bnd call eax
+[ ]*18[ ]+[\? 0-9A-F]*[ ]+notrack data16 call eax
#pass
diff --git a/gas/testsuite/gas/i386/notrackbad.s b/gas/testsuite/gas/i386/notrackbad.s
index c7eae50..3f57ef0 100644
--- a/gas/testsuite/gas/i386/notrackbad.s
+++ b/gas/testsuite/gas/i386/notrackbad.s
@@ -6,16 +6,12 @@ _start:
notrack call foo
notrack jmp foo
- notrack call *(%eax)
- notrack jmp *(%eax)
fs notrack call *%eax
notrack fs call *%eax
notrack bnd call *%eax
notrack data16 call *%eax
.intel_syntax noprefix
- notrack call [eax]
- notrack jmp [eax]
fs notrack call eax
notrack fs call eax
notrack bnd call eax
diff --git a/gas/testsuite/gas/i386/x86-64-cet-intel.d b/gas/testsuite/gas/i386/x86-64-cet-intel.d
index 07e666f..5e5f4a5 100644
--- a/gas/testsuite/gas/i386/x86-64-cet-intel.d
+++ b/gas/testsuite/gas/i386/x86-64-cet-intel.d
@@ -7,31 +7,31 @@
Disassembly of section .text:
0+ <_start>:
- +[a-f0-9]+: f3 0f 01 e9 incsspd
- +[a-f0-9]+: f3 48 0f 01 e9 incsspq
+ +[a-f0-9]+: f3 41 0f ae ec incsspd r12d
+ +[a-f0-9]+: f3 48 0f ae e8 incsspq rax
+[a-f0-9]+: f3 41 0f 1e cc rdsspd r12d
+[a-f0-9]+: f3 48 0f 1e c8 rdsspq rax
- +[a-f0-9]+: f3 0f 01 ea savessp
+ +[a-f0-9]+: f3 0f 01 ea saveprevssp
+[a-f0-9]+: f3 41 0f 01 2c 24 rstorssp QWORD PTR \[r12\]
+[a-f0-9]+: 41 0f 38 f6 04 24 wrssd \[r12\],eax
+[a-f0-9]+: 4a 0f 38 f6 14 39 wrssq \[rcx\+r15\*1\],rdx
+[a-f0-9]+: 66 41 0f 38 f5 04 24 wrussd \[r12\],eax
+[a-f0-9]+: 66 48 0f 38 f5 0c 03 wrussq \[rbx\+rax\*1\],rcx
- +[a-f0-9]+: f3 0f ae 28 setssbsy QWORD PTR \[rax\]
+ +[a-f0-9]+: f3 0f 01 e8 setssbsy
+[a-f0-9]+: f3 42 0f ae 34 26 clrssbsy QWORD PTR \[rsi\+r12\*1\]
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
- +[a-f0-9]+: f3 0f 01 e9 incsspd
- +[a-f0-9]+: f3 48 0f 01 e9 incsspq
+ +[a-f0-9]+: f3 41 0f ae ec incsspd r12d
+ +[a-f0-9]+: f3 48 0f ae e8 incsspq rax
+[a-f0-9]+: f3 41 0f 1e cc rdsspd r12d
+[a-f0-9]+: f3 48 0f 1e c8 rdsspq rax
- +[a-f0-9]+: f3 0f 01 ea savessp
+ +[a-f0-9]+: f3 0f 01 ea saveprevssp
+[a-f0-9]+: f3 41 0f 01 2c 24 rstorssp QWORD PTR \[r12\]
+[a-f0-9]+: 41 0f 38 f6 04 24 wrssd \[r12\],eax
+[a-f0-9]+: 4a 0f 38 f6 14 39 wrssq \[rcx\+r15\*1\],rdx
+[a-f0-9]+: 66 41 0f 38 f5 04 24 wrussd \[r12\],eax
+[a-f0-9]+: 66 48 0f 38 f5 0c 03 wrussq \[rbx\+rax\*1\],rcx
- +[a-f0-9]+: f3 0f ae 28 setssbsy QWORD PTR \[rax\]
+ +[a-f0-9]+: f3 0f 01 e8 setssbsy
+[a-f0-9]+: f3 42 0f ae 34 26 clrssbsy QWORD PTR \[rsi\+r12\*1\]
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
diff --git a/gas/testsuite/gas/i386/x86-64-cet.d b/gas/testsuite/gas/i386/x86-64-cet.d
index 7e5b717..af29827 100644
--- a/gas/testsuite/gas/i386/x86-64-cet.d
+++ b/gas/testsuite/gas/i386/x86-64-cet.d
@@ -6,31 +6,31 @@
Disassembly of section .text:
0+ <_start>:
- +[a-f0-9]+: f3 0f 01 e9 incsspd
- +[a-f0-9]+: f3 48 0f 01 e9 incsspq
+ +[a-f0-9]+: f3 41 0f ae ec incsspd %r12d
+ +[a-f0-9]+: f3 48 0f ae e8 incsspq %rax
+[a-f0-9]+: f3 41 0f 1e cc rdsspd %r12d
+[a-f0-9]+: f3 48 0f 1e c8 rdsspq %rax
- +[a-f0-9]+: f3 0f 01 ea savessp
+ +[a-f0-9]+: f3 0f 01 ea saveprevssp
+[a-f0-9]+: f3 41 0f 01 2c 24 rstorssp \(%r12\)
+[a-f0-9]+: 41 0f 38 f6 04 24 wrssd %eax,\(%r12\)
+[a-f0-9]+: 4a 0f 38 f6 14 39 wrssq %rdx,\(%rcx,%r15,1\)
+[a-f0-9]+: 66 41 0f 38 f5 04 24 wrussd %eax,\(%r12\)
+[a-f0-9]+: 66 48 0f 38 f5 0c 03 wrussq %rcx,\(%rbx,%rax,1\)
- +[a-f0-9]+: f3 0f ae 28 setssbsy \(%rax\)
+ +[a-f0-9]+: f3 0f 01 e8 setssbsy
+[a-f0-9]+: f3 42 0f ae 34 26 clrssbsy \(%rsi,%r12,1\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
- +[a-f0-9]+: f3 0f 01 e9 incsspd
- +[a-f0-9]+: f3 48 0f 01 e9 incsspq
+ +[a-f0-9]+: f3 41 0f ae ec incsspd %r12d
+ +[a-f0-9]+: f3 48 0f ae e8 incsspq %rax
+[a-f0-9]+: f3 41 0f 1e cc rdsspd %r12d
+[a-f0-9]+: f3 48 0f 1e c8 rdsspq %rax
- +[a-f0-9]+: f3 0f 01 ea savessp
+ +[a-f0-9]+: f3 0f 01 ea saveprevssp
+[a-f0-9]+: f3 41 0f 01 2c 24 rstorssp \(%r12\)
+[a-f0-9]+: 41 0f 38 f6 04 24 wrssd %eax,\(%r12\)
+[a-f0-9]+: 4a 0f 38 f6 14 39 wrssq %rdx,\(%rcx,%r15,1\)
+[a-f0-9]+: 66 41 0f 38 f5 04 24 wrussd %eax,\(%r12\)
+[a-f0-9]+: 66 48 0f 38 f5 0c 03 wrussq %rcx,\(%rbx,%rax,1\)
- +[a-f0-9]+: f3 0f ae 28 setssbsy \(%rax\)
+ +[a-f0-9]+: f3 0f 01 e8 setssbsy
+[a-f0-9]+: f3 42 0f ae 34 26 clrssbsy \(%rsi,%r12,1\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: f3 0f 1e fb endbr32
diff --git a/gas/testsuite/gas/i386/x86-64-cet.s b/gas/testsuite/gas/i386/x86-64-cet.s
index 15a28d7..33cd4bf 100644
--- a/gas/testsuite/gas/i386/x86-64-cet.s
+++ b/gas/testsuite/gas/i386/x86-64-cet.s
@@ -1,33 +1,33 @@
# Check 64bit CET instructions
.text
_start:
- incsspd
- incsspq
+ incsspd %r12d
+ incsspq %rax
rdsspd %r12d
rdsspq %rax
- savessp
+ saveprevssp
rstorssp (%r12)
wrssd %eax, (%r12)
wrssq %rdx, (%rcx, %r15)
wrussd %eax, (%r12)
wrussq %rcx, (%rbx, %rax)
- setssbsy (%rax)
+ setssbsy
clrssbsy (%rsi, %r12)
endbr64
endbr32
.intel_syntax noprefix
- incsspd
- incsspq
+ incsspd r12d
+ incsspq rax
rdsspd r12d
rdsspq rax
- savessp
+ saveprevssp
rstorssp QWORD PTR [r12]
wrssd [r12],eax
wrssq [rcx+r15],rdx
wrussd [r12],eax
wrussq [rbx+rax],rcx
- setssbsy QWORD PTR [rax]
+ setssbsy
clrssbsy QWORD PTR [rsi+r12]
endbr64
endbr32
diff --git a/gas/testsuite/gas/i386/x86-64-mpx.d b/gas/testsuite/gas/i386/x86-64-mpx.d
index b798649..e2a7828 100644
--- a/gas/testsuite/gas/i386/x86-64-mpx.d
+++ b/gas/testsuite/gas/i386/x86-64-mpx.d
@@ -182,4 +182,8 @@ Disassembly of section .text:
[a-f0-9]+ <foo>:
[ ]*[a-f0-9]+: f2 c3 bnd retq
+
+[a-f0-9]+ <bad>:
+[ ]*[a-f0-9]+: 0f 1a 30 bndldx \(%rax\),\(bad\)
+[ ]*[a-f0-9]+: 66 0f 1a c4 bndmov \(bad\),%bnd0
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-mpx.s b/gas/testsuite/gas/i386/x86-64-mpx.s
index 0db4bdc..1263408 100644
--- a/gas/testsuite/gas/i386/x86-64-mpx.s
+++ b/gas/testsuite/gas/i386/x86-64-mpx.s
@@ -209,3 +209,15 @@ start:
bnd ret
foo: bnd ret
+
+bad:
+ # bndldx (%eax),(bad)
+ .byte 0x0f
+ .byte 0x1a
+ .byte 0x30
+
+ # bndmov (bad),%bnd0
+ .byte 0x66
+ .byte 0x0f
+ .byte 0x1a
+ .byte 0xc4
diff --git a/gas/testsuite/gas/i386/x86-64-notrack-intel.d b/gas/testsuite/gas/i386/x86-64-notrack-intel.d
index 6e0cfdb..0170a82 100644
--- a/gas/testsuite/gas/i386/x86-64-notrack-intel.d
+++ b/gas/testsuite/gas/i386/x86-64-notrack-intel.d
@@ -12,18 +12,50 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 3e 41 ff d0 notrack call r8
[ ]*[a-f0-9]+: 3e ff e0 notrack jmp rax
[ ]*[a-f0-9]+: 3e 41 ff e0 notrack jmp r8
+[ ]*[a-f0-9]+: 3e ff 10 notrack call QWORD PTR \[rax\]
+[ ]*[a-f0-9]+: 3e 41 ff 10 notrack call QWORD PTR \[r8\]
+[ ]*[a-f0-9]+: 3e ff 20 notrack jmp QWORD PTR \[rax\]
+[ ]*[a-f0-9]+: 3e 41 ff 20 notrack jmp QWORD PTR \[r8\]
+[ ]*[a-f0-9]+: 67 3e ff 10 notrack call QWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 67 3e 41 ff 10 notrack call QWORD PTR \[r8d\]
+[ ]*[a-f0-9]+: 67 3e ff 20 notrack jmp QWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 67 3e 41 ff 20 notrack jmp QWORD PTR \[r8d\]
[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call rax
[ ]*[a-f0-9]+: f2 3e 41 ff d0 bnd notrack call r8
[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp rax
[ ]*[a-f0-9]+: f2 3e 41 ff e0 bnd notrack jmp r8
+[ ]*[a-f0-9]+: f2 3e ff 10 bnd notrack call QWORD PTR \[rax\]
+[ ]*[a-f0-9]+: f2 3e 41 ff 10 bnd notrack call QWORD PTR \[r8\]
+[ ]*[a-f0-9]+: f2 3e ff 20 bnd notrack jmp QWORD PTR \[rax\]
+[ ]*[a-f0-9]+: f2 3e 41 ff 20 bnd notrack jmp QWORD PTR \[r8\]
+[ ]*[a-f0-9]+: 67 f2 3e ff 10 bnd notrack call QWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 67 f2 3e 41 ff 10 bnd notrack call QWORD PTR \[r8d\]
+[ ]*[a-f0-9]+: 67 f2 3e ff 20 bnd notrack jmp QWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 67 f2 3e 41 ff 20 bnd notrack jmp QWORD PTR \[r8d\]
[ ]*[a-f0-9]+: 3e ff d0 notrack call rax
[ ]*[a-f0-9]+: 3e 41 ff d0 notrack call r8
[ ]*[a-f0-9]+: 3e ff e0 notrack jmp rax
[ ]*[a-f0-9]+: 3e 41 ff e0 notrack jmp r8
+[ ]*[a-f0-9]+: 3e ff 10 notrack call QWORD PTR \[rax\]
+[ ]*[a-f0-9]+: 3e 41 ff 10 notrack call QWORD PTR \[r8\]
+[ ]*[a-f0-9]+: 3e ff 20 notrack jmp QWORD PTR \[rax\]
+[ ]*[a-f0-9]+: 3e 41 ff 20 notrack jmp QWORD PTR \[r8\]
+[ ]*[a-f0-9]+: 67 3e ff 10 notrack call QWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 67 3e 41 ff 10 notrack call QWORD PTR \[r8d\]
+[ ]*[a-f0-9]+: 67 3e ff 20 notrack jmp QWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 67 3e 41 ff 20 notrack jmp QWORD PTR \[r8d\]
[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack call rax
[ ]*[a-f0-9]+: f2 3e 41 ff d0 bnd notrack call r8
[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmp rax
[ ]*[a-f0-9]+: f2 3e 41 ff e0 bnd notrack jmp r8
+[ ]*[a-f0-9]+: f2 3e ff 10 bnd notrack call QWORD PTR \[rax\]
+[ ]*[a-f0-9]+: f2 3e 41 ff 10 bnd notrack call QWORD PTR \[r8\]
+[ ]*[a-f0-9]+: f2 3e ff 20 bnd notrack jmp QWORD PTR \[rax\]
+[ ]*[a-f0-9]+: f2 3e 41 ff 20 bnd notrack jmp QWORD PTR \[r8\]
+[ ]*[a-f0-9]+: 67 f2 3e ff 10 bnd notrack call QWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 67 f2 3e 41 ff 10 bnd notrack call QWORD PTR \[r8d\]
+[ ]*[a-f0-9]+: 67 f2 3e ff 20 bnd notrack jmp QWORD PTR \[eax\]
+[ ]*[a-f0-9]+: 67 f2 3e 41 ff 20 bnd notrack jmp QWORD PTR \[r8d\]
[ ]*[a-f0-9]+: 3e f2 ff d0 ds bnd call rax
[ ]*[a-f0-9]+: 3e 66 ff d0 ds call ax
[ ]*[a-f0-9]+: 66 3e ff d0 ds call ax
diff --git a/gas/testsuite/gas/i386/x86-64-notrack.d b/gas/testsuite/gas/i386/x86-64-notrack.d
index 0f63f12..cf725d4 100644
--- a/gas/testsuite/gas/i386/x86-64-notrack.d
+++ b/gas/testsuite/gas/i386/x86-64-notrack.d
@@ -11,18 +11,50 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 3e 41 ff d0 notrack callq \*%r8
[ ]*[a-f0-9]+: 3e ff e0 notrack jmpq \*%rax
[ ]*[a-f0-9]+: 3e 41 ff e0 notrack jmpq \*%r8
+[ ]*[a-f0-9]+: 3e ff 10 notrack callq \*\(%rax\)
+[ ]*[a-f0-9]+: 3e 41 ff 10 notrack callq \*\(%r8\)
+[ ]*[a-f0-9]+: 3e ff 20 notrack jmpq \*\(%rax\)
+[ ]*[a-f0-9]+: 3e 41 ff 20 notrack jmpq \*\(%r8\)
+[ ]*[a-f0-9]+: 67 3e ff 10 notrack callq \*\(%eax\)
+[ ]*[a-f0-9]+: 67 3e 41 ff 10 notrack callq \*\(%r8d\)
+[ ]*[a-f0-9]+: 67 3e ff 20 notrack jmpq \*\(%eax\)
+[ ]*[a-f0-9]+: 67 3e 41 ff 20 notrack jmpq \*\(%r8d\)
[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack callq \*%rax
[ ]*[a-f0-9]+: f2 3e 41 ff d0 bnd notrack callq \*%r8
[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmpq \*%rax
[ ]*[a-f0-9]+: f2 3e 41 ff e0 bnd notrack jmpq \*%r8
+[ ]*[a-f0-9]+: f2 3e ff 10 bnd notrack callq \*\(%rax\)
+[ ]*[a-f0-9]+: f2 3e 41 ff 10 bnd notrack callq \*\(%r8\)
+[ ]*[a-f0-9]+: f2 3e ff 20 bnd notrack jmpq \*\(%rax\)
+[ ]*[a-f0-9]+: f2 3e 41 ff 20 bnd notrack jmpq \*\(%r8\)
+[ ]*[a-f0-9]+: 67 f2 3e ff 10 bnd notrack callq \*\(%eax\)
+[ ]*[a-f0-9]+: 67 f2 3e 41 ff 10 bnd notrack callq \*\(%r8d\)
+[ ]*[a-f0-9]+: 67 f2 3e ff 20 bnd notrack jmpq \*\(%eax\)
+[ ]*[a-f0-9]+: 67 f2 3e 41 ff 20 bnd notrack jmpq \*\(%r8d\)
[ ]*[a-f0-9]+: 3e ff d0 notrack callq \*%rax
[ ]*[a-f0-9]+: 3e 41 ff d0 notrack callq \*%r8
[ ]*[a-f0-9]+: 3e ff e0 notrack jmpq \*%rax
[ ]*[a-f0-9]+: 3e 41 ff e0 notrack jmpq \*%r8
+[ ]*[a-f0-9]+: 3e ff 10 notrack callq \*\(%rax\)
+[ ]*[a-f0-9]+: 3e 41 ff 10 notrack callq \*\(%r8\)
+[ ]*[a-f0-9]+: 3e ff 20 notrack jmpq \*\(%rax\)
+[ ]*[a-f0-9]+: 3e 41 ff 20 notrack jmpq \*\(%r8\)
+[ ]*[a-f0-9]+: 67 3e ff 10 notrack callq \*\(%eax\)
+[ ]*[a-f0-9]+: 67 3e 41 ff 10 notrack callq \*\(%r8d\)
+[ ]*[a-f0-9]+: 67 3e ff 20 notrack jmpq \*\(%eax\)
+[ ]*[a-f0-9]+: 67 3e 41 ff 20 notrack jmpq \*\(%r8d\)
[ ]*[a-f0-9]+: f2 3e ff d0 bnd notrack callq \*%rax
[ ]*[a-f0-9]+: f2 3e 41 ff d0 bnd notrack callq \*%r8
[ ]*[a-f0-9]+: f2 3e ff e0 bnd notrack jmpq \*%rax
[ ]*[a-f0-9]+: f2 3e 41 ff e0 bnd notrack jmpq \*%r8
+[ ]*[a-f0-9]+: f2 3e ff 10 bnd notrack callq \*\(%rax\)
+[ ]*[a-f0-9]+: f2 3e 41 ff 10 bnd notrack callq \*\(%r8\)
+[ ]*[a-f0-9]+: f2 3e ff 20 bnd notrack jmpq \*\(%rax\)
+[ ]*[a-f0-9]+: f2 3e 41 ff 20 bnd notrack jmpq \*\(%r8\)
+[ ]*[a-f0-9]+: 67 f2 3e ff 10 bnd notrack callq \*\(%eax\)
+[ ]*[a-f0-9]+: 67 f2 3e 41 ff 10 bnd notrack callq \*\(%r8d\)
+[ ]*[a-f0-9]+: 67 f2 3e ff 20 bnd notrack jmpq \*\(%eax\)
+[ ]*[a-f0-9]+: 67 f2 3e 41 ff 20 bnd notrack jmpq \*\(%r8d\)
[ ]*[a-f0-9]+: 3e f2 ff d0 ds bnd callq \*%rax
[ ]*[a-f0-9]+: 3e 66 ff d0 ds callw \*%ax
[ ]*[a-f0-9]+: 66 3e ff d0 ds callw \*%ax
diff --git a/gas/testsuite/gas/i386/x86-64-notrack.s b/gas/testsuite/gas/i386/x86-64-notrack.s
index f90a870..7db0812 100644
--- a/gas/testsuite/gas/i386/x86-64-notrack.s
+++ b/gas/testsuite/gas/i386/x86-64-notrack.s
@@ -8,32 +8,75 @@ _start:
notrack jmp *%rax
notrack jmp *%r8
+ notrack call *(%rax)
+ notrack call *(%r8)
+ notrack jmp *(%rax)
+ notrack jmp *(%r8)
+
+ notrack call *(%eax)
+ notrack call *(%r8d)
+ notrack jmp *(%eax)
+ notrack jmp *(%r8d)
+
bnd notrack call *%rax
bnd notrack call *%r8
bnd notrack jmp *%rax
bnd notrack jmp *%r8
+ bnd notrack call *(%rax)
+ bnd notrack call *(%r8)
+ bnd notrack jmp *(%rax)
+ bnd notrack jmp *(%r8)
+
+ bnd notrack call *(%eax)
+ bnd notrack call *(%r8d)
+ bnd notrack jmp *(%eax)
+ bnd notrack jmp *(%r8d)
+
.intel_syntax noprefix
notrack call rax
notrack call r8
notrack jmp rax
notrack jmp r8
+ notrack call QWORD PTR [rax]
+ notrack call QWORD PTR [r8]
+ notrack jmp QWORD PTR [rax]
+ notrack jmp QWORD PTR [r8]
+
+ notrack call QWORD PTR [eax]
+ notrack call QWORD PTR [r8d]
+ notrack jmp QWORD PTR [eax]
+ notrack jmp QWORD PTR [r8d]
+
bnd notrack call rax
bnd notrack call r8
bnd notrack jmp rax
bnd notrack jmp r8
+ bnd notrack call QWORD PTR [rax]
+ bnd notrack call QWORD PTR [r8]
+ bnd notrack jmp QWORD PTR [rax]
+ bnd notrack jmp QWORD PTR [r8]
+
+ bnd notrack call QWORD PTR [eax]
+ bnd notrack call QWORD PTR [r8d]
+ bnd notrack jmp QWORD PTR [eax]
+ bnd notrack jmp QWORD PTR [r8d]
+
+ # ds bnd callq *%rax
.byte 0x3e
.byte 0xf2
.byte 0xff
.byte 0xd0
+ # ds callw *%ax
.byte 0x3e
.byte 0x66
.byte 0xff
.byte 0xd0
+ # ds callw *%ax
.byte 0x66
.byte 0x3e
.byte 0xff
diff --git a/gas/testsuite/gas/i386/x86-64-notrackbad.l b/gas/testsuite/gas/i386/x86-64-notrackbad.l
index f76c7e5..cd51682 100644
--- a/gas/testsuite/gas/i386/x86-64-notrackbad.l
+++ b/gas/testsuite/gas/i386/x86-64-notrackbad.l
@@ -1,20 +1,16 @@
.*: Assembler messages:
-.*:6: Error: expecting register indirect branch instruction after `notrack'
+.*:6: Error: expecting indirect branch instruction after `notrack'
.*:6: Warning: skipping prefixes on this instruction
-.*:7: Error: expecting register indirect branch instruction after `notrack'
+.*:7: Error: expecting indirect branch instruction after `notrack'
.*:7: Warning: skipping prefixes on this instruction
-.*:9: Error: expecting register indirect branch instruction after `notrack'
-.*:10: Error: expecting register indirect branch instruction after `notrack'
-.*:11: Error: same type of prefix used twice
+.*:9: Error: same type of prefix used twice
+.*:10: Error: expecting no other prefixes after `notrack'
+.*:11: Error: expecting no other prefixes after `notrack'
.*:12: Error: expecting no other prefixes after `notrack'
-.*:13: Error: expecting no other prefixes after `notrack'
-.*:14: Error: expecting no other prefixes after `notrack'
-.*:17: Error: expecting register indirect branch instruction after `notrack'
-.*:18: Error: expecting register indirect branch instruction after `notrack'
-.*:19: Error: same type of prefix used twice
-.*:20: Error: expecting no other prefixes after `notrack'
-.*:21: Error: expecting no other prefixes after `notrack'
-.*:22: Error: expecting no other prefixes after `notrack'
+.*:15: Error: same type of prefix used twice
+.*:16: Error: expecting no other prefixes after `notrack'
+.*:17: Error: expecting no other prefixes after `notrack'
+.*:18: Error: expecting no other prefixes after `notrack'
GAS LISTING .*
@@ -24,30 +20,22 @@ GAS LISTING .*
[ ]*4[ ]+\.text
[ ]*5[ ]+_start:
[ ]*6[ ]+\?\?\?\? [0-9A-F]* notrack call foo
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
+\*\*\*\* Error: expecting indirect branch instruction after `notrack'
\*\*\*\* Warning: skipping prefixes on this instruction
[ ]*6[ ]+[0-9A-F]*
[ ]*7[ ]+\?\?\?\? [0-9A-F]* notrack jmp foo
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
+\*\*\*\* Error: expecting indirect branch instruction after `notrack'
\*\*\*\* Warning: skipping prefixes on this instruction
[ ]*7[ ]+[0-9A-F]*
[ ]*8[ ]+
-[ ]*9[ ]+\?\?\?\? 3EFF10 notrack call \*\(%rax\)
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
-[ ]*10[ ]+\?\?\?\? 3EFF20 notrack jmp \*\(%rax\)
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
-[ ]*11[ ]+fs notrack call \*%rax
-[ ]*12[ ]+notrack fs call \*%rax
-[ ]*13[ ]+notrack bnd call \*%rax
-[ ]*14[ ]+notrack data16 call \*%rax
-[ ]*15[ ]+
-[ ]*16[ ]+\.intel_syntax noprefix
-[ ]*17[ ]+\?\?\?\? 3EFF10 notrack call \[rax\]
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
-[ ]*18[ ]+\?\?\?\? 3EFF20 notrack jmp \[rax\]
-\*\*\*\* Error: expecting register indirect branch instruction after `notrack'
-[ ]*19[ ]+fs notrack call rax
-[ ]*20[ ]+notrack fs call rax
-[ ]*21[ ]+notrack bnd call rax
-[ ]*22.*[ ]+notrack data16 call rax
+[ ]*9[ ]+fs notrack call \*%rax
+[ ]*10[ ]+notrack fs call \*%rax
+[ ]*11[ ]+notrack bnd call \*%rax
+[ ]*12[ ]+notrack data16 call \*%rax
+[ ]*13[ ]+
+[ ]*14[ ]+\.intel_syntax noprefix
+[ ]*15[ ]+fs notrack call rax
+[ ]*16[ ]+notrack fs call rax
+[ ]*17[ ]+notrack bnd call rax
+[ ]*18[ ]+[\? 0-9A-F]*[ ]+notrack data16 call rax
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-notrackbad.s b/gas/testsuite/gas/i386/x86-64-notrackbad.s
index 59d6248..f859a9f 100644
--- a/gas/testsuite/gas/i386/x86-64-notrackbad.s
+++ b/gas/testsuite/gas/i386/x86-64-notrackbad.s
@@ -6,16 +6,12 @@ _start:
notrack call foo
notrack jmp foo
- notrack call *(%rax)
- notrack jmp *(%rax)
fs notrack call *%rax
notrack fs call *%rax
notrack bnd call *%rax
notrack data16 call *%rax
.intel_syntax noprefix
- notrack call [rax]
- notrack jmp [rax]
fs notrack call rax
notrack fs call rax
notrack bnd call rax
diff --git a/gas/testsuite/gas/s390/esa-g5.d b/gas/testsuite/gas/s390/esa-g5.d
index 5d53caf..949ef14 100644
--- a/gas/testsuite/gas/s390/esa-g5.d
+++ b/gas/testsuite/gas/s390/esa-g5.d
@@ -481,4 +481,6 @@ Disassembly of section .text:
.*: 17 69 [ ]*xr %r6,%r9
.*: b2 76 00 00 [ ]*xsch
.*: f8 58 5f ff af ff [ ]*zap 4095\(6,%r5\),4095\(9,%r10\)
+.*: b2 21 b0 69 [ ]*ipte %r6,%r9,%r11
+.*: b2 21 bd 69 [ ]*ipte %r6,%r9,%r11,13
.*: 07 07 [ ]*nopr %r7
diff --git a/gas/testsuite/gas/s390/esa-g5.s b/gas/testsuite/gas/s390/esa-g5.s
index 75d97fd..c417b81 100644
--- a/gas/testsuite/gas/s390/esa-g5.s
+++ b/gas/testsuite/gas/s390/esa-g5.s
@@ -475,3 +475,5 @@ foo:
xr %r6,%r9
xsch
zap 4095(6,%r5),4095(9,%r10)
+ ipte %r6,%r9,%r11
+ ipte %r6,%r9,%r11,13
diff --git a/gas/testsuite/gas/s390/zarch-z196.d b/gas/testsuite/gas/s390/zarch-z196.d
index c68b43a..3889d32 100644
--- a/gas/testsuite/gas/s390/zarch-z196.d
+++ b/gas/testsuite/gas/s390/zarch-z196.d
@@ -259,6 +259,4 @@ Disassembly of section .text:
.*: b9 2c 00 00 [ ]*pcc
.*: b9 2d 60 59 [ ]*kmctr %r5,%r6,%r9
.*: b9 28 00 00 [ ]*pckmo
-.*: b2 21 00 69 [ ]*ipte %r6,%r9
-.*: b2 21 b0 69 [ ]*ipte %r6,%r9,%r11
.*: 07 07 [ ]*nopr %r7
diff --git a/gas/testsuite/gas/s390/zarch-z196.s b/gas/testsuite/gas/s390/zarch-z196.s
index 612a2f7..31be5a6 100644
--- a/gas/testsuite/gas/s390/zarch-z196.s
+++ b/gas/testsuite/gas/s390/zarch-z196.s
@@ -261,5 +261,3 @@ foo:
pcc
kmctr %r5,%r6,%r9
pckmo
- ipte %r6,%r9
- ipte %r6,%r9,%r11
diff --git a/gas/testsuite/gas/s390/zarch-z990.d b/gas/testsuite/gas/s390/zarch-z990.d
index fccff46..980a5f6 100644
--- a/gas/testsuite/gas/s390/zarch-z990.d
+++ b/gas/testsuite/gas/s390/zarch-z990.d
@@ -44,7 +44,8 @@ Disassembly of section .text:
.*: eb 6f 50 00 80 80 [ ]*icmh %r6,15,-524288\(%r5\)
.*: eb 6f 50 00 80 81 [ ]*icmy %r6,15,-524288\(%r5\)
.*: e3 65 a0 00 80 73 [ ]*icy %r6,-524288\(%r5,%r10\)
-.*: b9 8e 50 69 [ ]*idte %r6,%r5,%r9
+.*: b9 8e 90 6b [ ]*idte %r6,%r9,%r11
+.*: b9 8e 9d 6b [ ]*idte %r6,%r9,%r11,13
.*: eb 69 50 00 80 9a [ ]*lamy %a6,%a9,-524288\(%r5\)
.*: e3 65 a0 00 80 71 [ ]*lay %r6,-524288\(%r5,%r10\)
.*: e3 65 a0 00 80 76 [ ]*lb %r6,-524288\(%r5,%r10\)
diff --git a/gas/testsuite/gas/s390/zarch-z990.s b/gas/testsuite/gas/s390/zarch-z990.s
index 98ef4bb..72fe768 100644
--- a/gas/testsuite/gas/s390/zarch-z990.s
+++ b/gas/testsuite/gas/s390/zarch-z990.s
@@ -38,7 +38,8 @@ foo:
icmh %r6,15,-524288(%r5)
icmy %r6,15,-524288(%r5)
icy %r6,-524288(%r5,%r10)
- idte %r6,%r5,%r9
+ idte %r6,%r9,%r11
+ idte %r6,%r9,%r11,13
lamy %a6,%a9,-524288(%r5)
lay %r6,-524288(%r5,%r10)
lb %r6,-524288(%r5,%r10)
diff --git a/gas/testsuite/gas/s390/zarch-zEC12.d b/gas/testsuite/gas/s390/zarch-zEC12.d
index 1999a12..a4be510 100644
--- a/gas/testsuite/gas/s390/zarch-zEC12.d
+++ b/gas/testsuite/gas/s390/zarch-zEC12.d
@@ -54,21 +54,16 @@ Disassembly of section .text:
.*: b2 e8 c0 56 [ ]*ppa %r5,%r6,12
.*: b9 8f 60 59 [ ]*crdte %r5,%r6,%r9
.*: b9 8f 61 59 [ ]*crdte %r5,%r6,%r9,1
-.*: b9 8e 90 6b [ ]*idte %r6,%r9,%r11
-.*: b9 8e 9d 6b [ ]*idte %r6,%r9,%r11,13
-.*: b2 21 00 69 [ ]*ipte %r6,%r9
-.*: b2 21 b0 69 [ ]*ipte %r6,%r9,%r11
-.*: b2 21 bd 69 [ ]*ipte %r6,%r9,%r11,13
-.*: c5 a0 0c 00 00 0c [ ]*bprp 10,13e <bar>,13e <bar>
-.*: c5 a0 00 00 00 00 [ ]*bprp 10,12c <foo\+0x12c>,12c <foo\+0x12c>
-[ ]*12d: R_390_PLT12DBL bar\+0x1
-[ ]*12f: R_390_PLT24DBL bar\+0x3
-.*: c7 a0 00 00 00 00 [ ]*bpp 10,132 <foo\+0x132>,0
-[ ]*136: R_390_PLT16DBL bar\+0x4
-.*: c7 a0 00 00 00 00 [ ]*bpp 10,138 <foo\+0x138>,0
-[ ]*13c: R_390_PC16DBL baz\+0x4
+.*: c5 a0 0c 00 00 0c [ ]*bprp 10,12a <bar>,12a <bar>
+.*: c5 a0 00 00 00 00 [ ]*bprp 10,118 <foo\+0x118>,118 <foo\+0x118>
+[ ]*119: R_390_PLT12DBL bar\+0x1
+[ ]*11b: R_390_PLT24DBL bar\+0x3
+.*: c7 a0 00 00 00 00 [ ]*bpp 10,11e <foo\+0x11e>,0
+[ ]*122: R_390_PLT16DBL bar\+0x4
+.*: c7 a0 00 00 00 00 [ ]*bpp 10,124 <foo\+0x124>,0
+[ ]*128: R_390_PC16DBL baz\+0x4
-000000000000013e <bar>:
+000000000000012a <bar>:
.*: 07 07 [ ]*nopr %r7
diff --git a/gas/testsuite/gas/s390/zarch-zEC12.s b/gas/testsuite/gas/s390/zarch-zEC12.s
index 7da8799..4754b20 100644
--- a/gas/testsuite/gas/s390/zarch-zEC12.s
+++ b/gas/testsuite/gas/s390/zarch-zEC12.s
@@ -53,13 +53,6 @@ foo:
crdte %r5,%r6,%r9
crdte %r5,%r6,%r9,1
- idte %r6,%r9,%r11
- idte %r6,%r9,%r11,13
-
- ipte %r6,%r9
- ipte %r6,%r9,%r11
- ipte %r6,%r9,%r11,13
-
bprp 10,bar,bar
bprp 10,bar@PLT,bar@PLT
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 263d57f..ac5965a 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,956 @@
+2017-06-26 Simon Marchi <simon.marchi@ericsson.com>
+
+ * record-full.c (netorder16): Remove.
+
+2017-06-26 Simon Marchi <simon.marchi@ericsson.com>
+
+ * common/diagnostics.h: Define macros for GCC.
+ (DIAGNOSTIC_IGNORE_UNUSED_FUNCTION): New macro.
+ * common/vec.h: Include diagnostics.h.
+ (DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION): New macro.
+ (DEF_VEC_I, DEF_VEC_P, DEF_VEC_O): Ignore -Wunused-function
+ warning.
+
+2017-06-26 Simon Marchi <simon.marchi@ericsson.com>
+
+ * common/diagnostics.h (DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER):
+ New macro.
+ * ada-lex.l: Ignore deprecated register warnings.
+
+2017-06-25 Simon Marchi <simon.marchi@ericsson.com>
+
+ * main.c (get_init_files): Replace "SYSTEM_GDBINIT +
+ datadir_len" with "&SYSTEM_GDBINIT[datadir_len]".
+
+2017-06-25 Simon Marchi <simon.marchi@ericsson.com>
+
+ * dtrace-probe.c (dtrace_process_dof_probe): Put semi-colon on
+ its own line.
+
+2017-06-25 Simon Marchi <simon.marchi@ericsson.com>
+
+ * nat/x86-dregs.c (x86_show_dr): Print registers one per line.
+
+2017-06-23 Alan Hayward <alan.hayward@arm.com>
+
+ * xtensa-tdep.c (XTENSA_MAX_REGISTER_SIZE): Add.
+ (xtensa_register_write_masked): Use XTENSA_MAX_REGISTER_SIZE.
+ (xtensa_register_read_masked): Likewise.
+
+2017-06-22 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * common/environ.c (gdb_environ::unset): Update comment.
+
+2017-06-22 Alan Hayward <alan.hayward@arm.com>
+
+ * python/py-unwind.c (pyuw_sniffer): Allocate space for
+ registers.
+
+2017-06-22 Alan Hayward <alan.hayward@arm.com>
+
+ * record-full.c (record_full_exec_insn): Use byte_vector.
+
+2017-06-22 Yao Qi <yao.qi@linaro.org>
+
+ * regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Regenerated.
+ * regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerated.
+
+2017-06-22 Alan Hayward <alan.hayward@arm.com>
+
+ * remote.c (cached_reg): Move from here...
+ * regcache.h (cached_reg): ...to here.
+ * python/py-unwind.c (struct reg_info): Remove.
+ (cached_frame_info): Use cached_reg_t.
+ (pyuw_prev_register): Likewise.
+ (pyuw_sniffer): Use cached_reg_t and allocate registers.
+ (pyuw_dealloc_cache): Free all registers.
+
+2017-06-22 Pedro Alves <palves@redhat.com>
+ Simon Marchi <simon.marchi@ericsson.com>
+
+ * unittests/environ-selftests.c (run_tests): Ignore -Wself-move
+ warning.
+ * common/diagnostics.h: New file.
+
+2017-06-22 Pedro Alves <palves@redhat.com>
+
+ * common/agent.h: Add include guards.
+
+2017-06-21 Simon Marchi <simon.marchi@ericsson.com>
+
+ * target.h (struct target_ops) <to_xfer_partial>: Update doc to
+ talk about addressable units instead of bytes.
+
+2017-06-20 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * common/environ.c (gdb_environ::unset): Use '::iterator' instead
+ of '::const_iterator'.
+
+2017-06-20 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
+ 'unittests/environ-selftests.c'.
+ (SUBDIR_UNITTESTS_OBS): Add 'environ-selftests.o'.
+ * charset.c (find_charset_names): Declare object 'iconv_env'.
+ Update code to use 'iconv_env' object. Remove call to
+ 'free_environ'.
+ * common/environ.c: Include <utility>.
+ (make_environ): Delete function.
+ (free_environ): Delete function.
+ (gdb_environ::clear): New function.
+ (gdb_environ::operator=): New function.
+ (gdb_environ::get): Likewise.
+ (environ_vector): Delete function.
+ (set_in_environ): Delete function.
+ (gdb_environ::set): New function.
+ (unset_in_environ): Delete function.
+ (gdb_environ::unset): New function.
+ (gdb_environ::envp): Likewise.
+ * common/environ.h: Include <vector>.
+ (struct gdb_environ): Delete; transform into...
+ (class gdb_environ): ... this class.
+ (free_environ): Delete prototype.
+ (init_environ, get_in_environ, set_in_environ, unset_in_environ,
+ environ_vector): Likewise.
+ * infcmd.c (run_command_1): Update code to call
+ 'envp' from 'gdb_environ' class.
+ (environment_info): Update code to call methods from 'gdb_environ'
+ class.
+ (unset_environment_command): Likewise.
+ (path_info): Likewise.
+ (path_command): Likewise.
+ * inferior.c (inferior::~inferior): Delete call to 'free_environ'.
+ (inferior::inferior): Initialize 'environment' using the host's
+ information.
+ * inferior.h: Remove forward declaration of 'struct gdb_environ'.
+ Include "environ.h".
+ (class inferior) <environment>: Change type from 'struct
+ gdb_environ' to 'gdb_environ'.
+ * mi/mi-cmd-env.c (mi_cmd_env_path): Update code to call
+ methods from 'gdb_environ' class.
+ * solib.c (solib_find_1): Likewise
+ * unittests/environ-selftests.c: New file.
+
+2017-06-20 Yao Qi <yao.qi@linaro.org>
+
+ * features/i386/i386-linux.xml: Exchange the order of including
+ 32bit-linux.xml and 32bit-sse.xml.
+ * features/i386/i386-linux.c: Regenerated.
+
+2017-06-20 Yao Qi <yao.qi@linaro.org>
+
+ * target-descriptions.c (tdesc_reg): Add ctor, dtor.
+ Delete copy ctor and assignment operator.
+ (tdesc_type): Likewise.
+ (tdesc_feature): Likewise.
+ (tdesc_free_reg): Remove.
+ (tdesc_create_reg): Use new.
+ (tdesc_free_type): Remove.
+ (tdesc_create_vector): Use new.
+ (tdesc_create_union): Likewise.
+ (tdesc_create_flags): Likewise.
+ (tdesc_create_enum): Likewise.
+ (tdesc_free_feature): Delete.
+ (free_target_description): Use delete.
+
+2017-06-19 John Baldwin <jhb@FreeBSD.org>
+
+ * mips-tdep.c (print_gp_register_row): Don't error for unavailable
+ registers.
+
+2017-06-19 Pedro Alves <palves@redhat.com>
+
+ * dwarf2read.c (write_psymtabs_to_index): Construct file_closer
+ after gdb::unlinker.
+
+2017-06-19 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * mi/mi-cm-env.c (_initialize_mi_cmd_env): Use getenv instead of
+ gdb_environ to access an environment variable.
+
+2017-06-18 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+ * nat/linux-ptrace.c (linux_fork_to_function): Add cast to
+ gdb_byte*.
+
+2017-06-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * nat/fork-inferior.h (trace_start_error): Add ATTRIBUTE_PRINTF.
+
+2017-06-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * configure: Re-generate.
+ * warning.m4 (build_warnings): Add -Wno-mismatched-tags.
+
+2017-06-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * configure: Re-generate.
+ * warning.m4: Pass -Werror to compiler when checking for
+ supported warning flags.
+
+2017-06-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * Makefile.in (COMPILE.pre): Add "-x c++".
+
+2017-06-16 Alan Hayward <alan.hayward@arm.com>
+ Pedro Alves <palves@redhat.com>
+ Yao Qi <yao.qi@linaro.org>
+
+ * defs.h (RequireLongest): New.
+ (extract_integer): Declare function template.
+ (extract_signed_integer): Remove the declaration, but define it
+ static inline.
+ (extract_unsigned_integer): Likewise.
+ (store_integer): Declare function template.
+ (store_signed_integer): Remove the declaration, but define it
+ static inline.
+ (store_unsigned_integer): Likewise.
+ * findvar.c (extract_integer): New function template.
+ (extract_signed_integer): Remove.
+ (extract_unsigned_integer): Remove.
+ (extract_integer<LONGEST>, extract_integer<ULONGEST>): Explicit
+ instantiations.
+ (store_integer): New function template.
+ (store_signed_integer): Remove.
+ (store_unsigned_integer): Remove.
+ (store_integer): Explicit instantiations.
+ * regcache.c (regcache_raw_read_signed): Update.
+ (regcache::raw_read): New function.
+ (regcache::raw_read_signed): Remove.
+ (regcache::raw_read_unsigned): Remove.
+ (regcache_raw_read_unsigned): Update.
+ (regcache_raw_write_unsigned): Update.
+ (regcache::raw_write_signed): Remove.
+ (regcache::raw_write): New function.
+ (regcache_cooked_read_signed): Update.
+ (regcache::raw_write_unsigned): Remove.
+ (regcache::cooked_read_signed): Remove.
+ (regcache_cooked_read_unsigned): Update.
+ (regcache::cooked_read_unsigned): Remove.
+ (regcache_cooked_write_signed): Update.
+ (regcache_cooked_write_unsigned): Update.
+ * regcache.h (regcache) <raw_read_signed>: Remove.
+ <raw_write_signed, raw_read_unsigned, raw_write_unsigned>: Remove.
+ <raw_read, raw_write>: New.
+ <cooked_read_signed, cooked_write_signed>: Remove.
+ <cooked_write_unsigned, cooked_read_unsigned>: Remove.
+ <cooked_read, cooked_write>: New.
+ * sh64-tdep.c (sh64_pseudo_register_read): Update.
+ (sh64_pseudo_register_write): Update.
+
+2017-06-16 Anton Kolesov <anton.kolesov@synopsys.com>
+
+ * arc-tdep.c (arc_disassembler_options): New variable.
+ (arc_gdbarch_init): Set and use it. Use arc_delayed_print_insn instead
+ of default_print_insn.
+ (arc_delayed_print_insn): Set info->section when needed,
+ use default_print_insn to retrieve a disassembler.
+
+2017-06-14 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ PR gdb/21574
+ * infcmd.c (_initialize_infcmd): Expand "help run" documentation
+ to mention $SHELL and startup-with-shell.
+
+2017-06-14 Max Filippov <jcmvbkbc@gmail.com>
+
+ * MAINTAINERS: Move Maxim Grigoriev to the Past Maintainers.
+
+2017-06-14 Yao Qi <yao.qi@linaro.org>
+
+ * aarch64-tdep.c (aarch64_gdb_print_insn): Call
+ default_print_insn instead of print_insn_aarch64.
+ * arm-tdep.c (gdb_print_insn_arm): Call
+ default_print_insn instead of print_insn_big_arm
+ and print_insn_little_arm.
+ * i386-tdep.c (i386_print_insn): Call default_print_insn
+ instead of print_insn_i386.
+ * ia64-tdep.c (ia64_print_insn): Call
+ default_print_insn instead of print_insn_ia64.
+ * mips-tdep.c (gdb_print_insn_mips): Call
+ default_print_insn instead of print_insn_big_mips
+ and print_insn_little_mips.
+ * spu-tdep.c (gdb_print_insn_spu): Call default_print_insn
+ instead of print_insn_spu.
+
+2017-06-14 Pedro Alves <palves@redhat.com>
+
+ * ada-lang.c: Include "common/byte-vector.h".
+ (ada_value_primitive_packed_val): Use gdb::byte_vector.
+ * charset.c (wchar_iterator::iterate): Resize the vector instead
+ of reserving it.
+ * common/byte-vector.h: Include "common/def-vector.h".
+ (wchar_iterator::m_out): Now a gdb::def_vector<gdb_wchar_t>.
+ * cli/cli-dump.c: Include "common/byte-vector.h".
+ (dump_memory_to_file, restore_binary_file): Use gdb::byte_vector.
+ * common/byte-vector.h: New file.
+ * common/def-vector.h: New file.
+ * common/default-init-alloc.h: New file.
+ * dwarf2loc.c: Include "common/byte-vector.h".
+ (rw_pieced_value): Use gdb::byte_vector, and resize the vector
+ instead of reserving it.
+ * dwarf2read.c: Include "common/byte-vector.h".
+ (data_buf::m_vec): Now a gdb::byte_vector.
+ * gdb_regex.c: Include "common/def-vector.h".
+ (compiled_regex::compiled_regex): Use gdb::def_vector<char>.
+ * mi/mi-main.c: Include "common/byte-vector.h".
+ (mi_cmd_data_read_memory): Use gdb::byte_vector.
+ * printcmd.c: Include "common/byte-vector.h".
+ (print_scalar_formatted): Use gdb::byte_vector.
+ * valprint.c: Include "common/byte-vector.h".
+ (maybe_negate_by_bytes, print_decimal_chars): Use
+ gdb::byte_vector.
+
+2017-06-13 Simon Marchi <simon.marchi@ericsson.com>
+
+ * darwin-nat.c: Include "nat/fork-inferior.h".
+
+2017-06-13 Simon Marchi <simon.marchi@ericsson.com>
+
+ * configure.nat: Factor out Darwin bits that are not
+ architecture-specific. Add fork-inferior.o.
+
+2017-06-13 Simon Marchi <simon.marchi@ericsson.com>
+
+ * configure.nat: Factor out AIX bits that are not
+ architecture-specific. Add fork-inferior.o.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (rw_pieced_value): New. Merge logic from...
+ (read_pieced_value, write_pieced_value): ...here. Reduce to
+ wrappers that just call rw_pieced_value.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (write_pieced_value): When writing the data for a
+ memory piece, use write_memory_with_notification instead of
+ write_memory.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * valops.c (read_value_memory): Change embedded_offset to
+ represent a bit offset instead of a byte offset.
+ * value.h (read_value_memory): Adjust comment.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (read_pieced_value): Remove unnecessary variables
+ dest_offset_bits and source_offset_bits.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (read_pieced_value): Respect the piece offset, as
+ given by DW_OP_bit_piece.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (read_pieced_value): Move the buffer allocation and
+ some other preparations to the places where sufficient information
+ is available.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (bits_to_bytes): New function.
+ (read_pieced_value): Fix offset calculations for register pieces
+ on big-endian targets.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (read_pieced_value): Remove buffer_size variable.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (write_pieced_value): When writing to a bit-field,
+ transfer the source value's least significant bits, instead of its
+ lowest-addressed ones. Rename type_len to max_offset.
+ (read_pieced_value): Mirror above changes to write_pieced_value as
+ applicable.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (write_pieced_value): In DWARF_VALUE_MEMORY,
+ truncate full bytes from dest_offset_bits before using it as an
+ offset into the buffer.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (write_pieced_value): Include transfer size in
+ byte-wise check.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (write_pieced_value): Fix copy/paste error in the
+ calculation of this_size.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (read_pieced_value): Respect parent value's offset
+ when targeting a bit-field.
+ (write_pieced_value): Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (struct piece_closure) <addr_size>: Remove field.
+ (allocate_piece_closure): Drop addr_size parameter.
+ (dwarf2_evaluate_loc_desc_full): Adjust call to
+ allocate_piece_closure.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ PR gdb/21226
+ * dwarf2loc.c (read_pieced_value): Anchor stack value pieces at
+ the LSB end, independent of endianness.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * dwarf2loc.c (write_pieced_value): Fix order of calculations for
+ size capping.
+
+2017-06-13 Yao Qi <yao.qi@linaro.org>
+
+ * mips-linux-nat.c: Move include features/mips*-linux.c to
+ mips-linux-tdep.c.
+ (_initialize_mips_linux_nat): Move initialize_tdesc_mips* calls
+ to mips-linux-tdep.c.
+ * mips-linux-tdep.c: Include features/mips*-linux.c
+ (_initialize_mips_linux_tdep): Call initialize_tdesc_mips*
+ functions.
+ * mips-linux-tdep.h (tdesc_mips_linux): Declare.
+ (tdesc_mips_dsp_linux, tdesc_mips64_linux): Declare.
+ (tdesc_mips64_dsp_linux): Declare.
+
+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ * valprint.h (val_print_type_code_int): Remove.
+ * valprint.c (generic_val_print_int): Always call
+ val_print_scalar_formatted.
+ (val_print_type_code_int): Remove.
+ * printcmd.c (print_scalar_formatted): Handle options->format==0.
+ * f-valprint.c (f_val_print): Use val_print_scalar_formatted.
+ * c-valprint.c (c_val_print_int): Use val_print_scalar_formatted.
+ * ada-valprint.c (ada_val_print_num): Use
+ val_print_scalar_formatted.
+
+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ * printcmd.c (print_scalar_formatted): Unify the two switches.
+ Don't convert scalars to LONGEST.
+
+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ PR exp/16225:
+ * valprint.h (print_decimal_chars): Update.
+ * valprint.c (maybe_negate_by_bytes): New function.
+ (print_decimal_chars): Add "is_signed" argument.
+ * printcmd.c (print_scalar_formatted): Update.
+
+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ PR exp/16225:
+ * valprint.h (print_binary_chars, print_hex_chars): Update.
+ * valprint.c (val_print_type_code_int): Update.
+ (print_binary_chars): Add "zero_pad" argument.
+ (emit_octal_digit): New function.
+ (print_octal_chars): Don't zero-pad.
+ (print_decimal_chars): Likewise.
+ (print_hex_chars): Add "zero_pad" argument.
+ * sh64-tdep.c (sh64_do_fp_register): Update.
+ * regcache.c (regcache::dump): Update.
+ * printcmd.c (print_scalar_formatted): Update.
+ * infcmd.c (default_print_one_register_info): Update.
+
+2017-06-12 Pedro Alves <palves@redhat.com>
+ Alan Hayward <alan.hayward@arm.com>
+
+ * mips-tdep.c (MAX_MIPS_ABI_REGSIZE): New.
+ (mips_eabi_push_dummy_call): Rename local 'regsize' to
+ 'abi_regsize'. Rename local array 'valbuf' to 'ref_valbuf', and
+ use MAX_MIPS_ABI_REGSIZE instead of MAX_REGISTER_SIZE to size it.
+ Assert that abi_regsize bytes fit in 'ref_valbuf'.
+
+2017-06-12 Pedro Alves <palves@redhat.com>
+
+ * dwarf2read.c (mapped_symtab::data): Now a vector of
+ symtab_index_entry instead of vector of
+ std::unique_ptr<symtab_index_entry>. All users adjusted to check
+ whether an element's name is NULL instead of checking whether the
+ element itself is NULL.
+ (find_slot): Change return type. Adjust.
+ (hash_expand, , add_index_entry, uniquify_cu_indices)
+ (write_hash_table): Adjust.
+
+2017-06-12 Pedro Alves <palves@redhat.com>
+
+ * dwarf2read.c (recursively_count_psymbols): New function.
+ (write_psymtabs_to_index): Call it to compute number of psyms and
+ pass estimate size of psyms_seen to unordered_set's ctor.
+
+2017-06-12 Pedro Alves <palves@redhat.com>
+
+ * dwarf2read.c (write_hash_table): Check if key already exists
+ before emplacing.
+
+2017-06-12 Pedro Alves <palves@redhat.com>
+
+ * dwarf2read.c (data_buf::append_space): Rename to...
+ (data_buf::grow): ... this, and make private. Adjust all callers.
+ (data_buf::append_uint): New method.
+ (add_address_entry, write_one_signatured_type)
+ (write_psymtabs_to_index): Use it.
+
+2017-06-12 Pedro Alves <palves@redhat.com>
+
+ * dwarf2read.c (file_write(FILE *, const void *, size_t)): Delete.
+ (file_write (FILE *, const std::vector<Elem>&)): Delete.
+ (data_buf::file_write): Call ::fwrite directly.
+
+2017-06-12 Pedro Alves <palves@redhat.com>
+
+ * dwarf2read.c (uniquify_cu_indices): Use std::unique and
+ std::vector::erase.
+
+2017-06-12 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Code cleanup: C++ify .gdb_index producer.
+ * dwarf2read.c: Include <unordered_set> and <unordered_map>.
+ (MAYBE_SWAP) [WORDS_BIGENDIAN]: Cast to offset_type.
+ (struct strtab_entry, hash_strtab_entry, eq_strtab_entry)
+ (create_strtab, add_string): Remove.
+ (file_write, data_buf): New.
+ (struct symtab_index_entry): Use std::vector for cu_indices.
+ (struct mapped_symtab): Use std::vector for data.
+ (hash_symtab_entry, eq_symtab_entry, delete_symtab_entry)
+ (create_symbol_hash_table, create_mapped_symtab, cleanup_mapped_symtab):
+ Remove.
+ (find_slot): Change return type. Update it to the new data structures.
+ (hash_expand, add_index_entry): Update it to the new data structures.
+ (offset_type_compare): Remove.
+ (uniquify_cu_indices): Update it to the new data structures.
+ (c_str_view, c_str_view_hasher, vector_hasher): New.
+ (add_indices_to_cpool): Remove.
+ (write_hash_table): Update it to the new data structures.
+ (struct psymtab_cu_index_map, hash_psymtab_cu_index)
+ (eq_psymtab_cu_index): Remove.
+ (psym_index_map): New typedef.
+ (struct addrmap_index_data): Change addr_obstack pointer to data_buf
+ reference and std::unordered_map for cu_index_htab.
+ (add_address_entry, add_address_entry_worker, write_address_map)
+ (write_psymbols): Update it to the new data structures.
+ (write_obstack): Remove.
+ (struct signatured_type_index_data): Change types_list to a data_buf
+ reference and psyms_seen to a std::unordered_set reference.
+ (write_one_signatured_type, recursively_write_psymbols)
+ (write_psymtabs_to_index): Update it to the new data structures.
+
+2017-06-11 Simon Marchi <simon.marchi@ericsson.com>
+
+ * NEWS (Changes since GDB 8.0): Announce {set,show} debug
+ separate-debug-file commands.
+ * symfile.h (separate_debug_file_debug): New global.
+ * symfile.c (separate_debug_file_debug): New global.
+ (separate_debug_file_exists, find_separate_debug_file): Add
+ debug output.
+ (_initialize_symfile): Add "set debug separate-debug-file"
+ command.
+ * build-id.c (build_id_to_debug_bfd,
+ find_separate_debug_file_by_buildid): Add debug output.
+
+2017-06-10 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * gdbarch.sh (displaced_step_free_closure): Remove.
+ * gdbarch.h, gdbarch.c: Re-generate.
+ * aarch64-linux-tdep.c (aarch64_linux_init_abi): Don't set
+ displaced_step_free_closure.
+ * amd64-linux-tdep.c (amd64_linux_init_abi_common): Likewise.
+ * arm-linux-tdep.c (arm_linux_init_abi): Likewise.
+ * i386-linux-tdep.c (i386_linux_init_abi): Likewise.
+ * rs6000-aix-tdep.c (rs6000_aix_init_osabi): Likewise.
+ * rs6000-tdep.c (rs6000_gdbarch_init): Likewise.
+ * s390-linux-tdep.c (s390_gdbarch_init): Likewise.
+ * arch-utils.h (simple_displaced_step_free_closure): Remove.
+ * arch-utils.c (simple_displaced_step_free_closure): Remove.
+ * infrun.c (displaced_step_clear): Call xfree instead of
+ gdbarch_displaced_step_free_closure.
+
+2017-06-08 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * common/common-utils.c (stringify_argv): Check for "arg[0] !=
+ NULL".
+
+2017-06-08 Alan Hayward <alan.hayward@arm.com>
+
+ * mn10300-tdep.c (MN10300_MAX_REGISTER_SIZE): Add.
+ (mn10300_extract_return_value): Use MN10300_MAX_REGISTER_SIZE.
+ (mn10300_push_dummy_call): Likewise.
+
+2017-06-08 Alan Hayward <alan.hayward@arm.com>
+
+ * mi/mi-main.c (register_changed_p): Use value_contents_eq.
+
+2017-06-08 Alan Hayward <alan.hayward@arm.com>
+
+ * mi/mi-main.c (register_changed_p): Use cooked_read_value.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * NEWS (Changes since GDB 8.0): Announce that GDBserver is now
+ able to start inferiors using a shell.
+ (New remote packets): Announce new packet "QStartupWithShell".
+ * remote.c: Add PACKET_QStartupWithShell.
+ (extended_remote_create_inferior): Handle new
+ PACKET_QStartupWithShell.
+ (remote_protocol_features) <QStartupWithShell>: New entry for
+ PACKET_QStartupWithShell.
+ (_initialize_remote): Call "add_packet_config_cmd" for
+ QStartupShell.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+ Pedro Alves <palves@redhat.com>
+
+ * Makefile.in (HFILES_NO_SRCDIR): Add "common/common-inferior.h"
+ and "nat/fork-inferior.h".
+ * common/common-inferior.h: New file, with contents from
+ "gdb/inferior.h".
+ * commom/common-utils.c: Include "common-utils.h".
+ (stringify_argv): New function.
+ * common/common-utils.h (stringify_argv): New prototype.
+ * configure.nat: Add "fork-inferior.o" as a dependency for
+ "*linux*", "fbsd*" and "nbsd*" hosts.
+ * corefile.c (get_exec_file): Update comment.
+ * darwin-nat.c (darwin_ptrace_him): Call "gdb_startup_inferior"
+ instead of "startup_inferior".
+ (darwin_create_inferior): Call "add_thread_silent" after
+ "fork_inferior".
+ * fork-child.c: Cleanup unnecessary includes.
+ (SHELL_FILE): Move to "common/common-fork-child.c".
+ (environ): Likewise.
+ (exec_wrapper): Initialize.
+ (get_exec_wrapper): New function.
+ (breakup_args): Move to "common/common-fork-child.c"; rename to
+ "breakup_args_for_exec".
+ (escape_bang_in_quoted_argument): Move to
+ "common/common-fork-child.c".
+ (saved_ui): New variable.
+ (prefork_hook): New function.
+ (postfork_hook): Likewise.
+ (postfork_child_hook): Likewise.
+ (gdb_startup_inferior): Likewise.
+ (fork_inferior): Move to "common/common-fork-child.c". Update
+ function to support gdbserver.
+ (startup_inferior): Likewise.
+ * gdbcore.h (get_exec_file): Remove declaration.
+ * gnu-nat.c (gnu_create_inferior): Call "gdb_startup_inferior"
+ instead of "startup_inferior". Call "add_thread_silent" after
+ "fork_inferior".
+ * inf-ptrace.c: Include "nat/fork-inferior.h" and "utils.h".
+ (inf_ptrace_create_inferior): Call "gdb_startup_inferior"
+ instead of "startup_inferior". Call "add_thread_silent" after
+ "fork_inferior".
+ * inferior.h: Include "common-inferior.h".
+ (trace_start_error): Move to "common/common-utils.h".
+ (trace_start_error_with_name): Likewise.
+ (fork_inferior): Move prototype to "nat/fork-inferior.h".
+ (startup_inferior): Likewise.
+ (gdb_startup_inferior): New prototype.
+ * nat/fork-inferior.c: New file, with contents from "fork-child.c".
+ * nat/fork-inferior.h: New file.
+ * procfs.c (procfs_init_inferior): Call "gdb_startup_inferior"
+ instead of "startup_inferior". Call "add_thread_silent" after
+ "fork_inferior".
+ * target.h (target_terminal_init): Move prototype to
+ "target/target.h".
+ (target_terminal_inferior): Likewise.
+ (target_terminal_ours): Likewise.
+ * target/target.h (target_terminal_init): New prototype, moved
+ from "target.h".
+ (target_terminal_inferior): Likewise.
+ (target_terminal_ours): Likewise.
+ * utils.c (gdb_flush_out_err): New function.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * Makefile.in (HFILES_NO_SRCDIR): Add "common/common-gdbthread.h".
+ * common/common-gdbthread.h: New file, with parts from
+ "gdb/gdbthread.h".
+ * gdbthread.h: Include "common-gdbthread.h".
+ (switch_to_thread): Moved to "common/common-gdbthread.h".
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * Makefile.in (SFILES): Add "common/job-control.c".
+ (HFILES_NO_SRCDIR): Add "common/job-control.h".
+ (COMMON_OBS): Add "job-control.o".
+ * common/job-control.c: New file, with contents from
+ "gdb/inflow.c".
+ * common/job-control.h: New file, with contents from "terminal.h".
+ * fork-child.c: Include "job-control.h".
+ * inflow.c: Include "job-control.h".
+ (gdb_setpgid): Move to "common/common-inflow.c".
+ (_initialize_inflow): Move setting of "job_control" to
+ "handle_job_control".
+ * terminal.h (job_control): Moved to "common/common-terminal.h".
+ (gdb_setpgid): Likewise.
+ * top.c: Include "job_control.h".
+ * utils.c: Likewise.
+ (job_control): Moved to "job-control.c".
+
+2017-06-07 Pedro Alves <palves@redhat.com>
+
+ * Makefile.in (SFILES): Add gdb_regex.c.
+ (COMMON_OBS): Add gdb_regex.o.
+ * ada-lang.c (ada_add_standard_exceptions)
+ (ada_add_exceptions_from_frame, name_matches_regex)
+ (ada_add_global_exceptions, ada_exceptions_list_1): Change regex
+ parameter type to compiled_regex. Adjust.
+ (ada_exceptions_list): Use compiled_regex.
+ * break-catch-throw.c (exception_catchpoint::pattern): Now a
+ std::unique_ptr<compiled_regex>.
+ (exception_catchpoint::~exception_catchpoint): Remove regfree
+ call.
+ (check_status_exception_catchpoint): Adjust to use compiled_regex.
+ (handle_gnu_v3_exceptions): Adjust to use compiled_regex.
+ * breakpoint.c (solib_catchpoint::compiled): Now a
+ std::unique_ptr<compiled_regex>.
+ (solib_catchpoint::~solib_catchpoint): Remove regfree call.
+ (check_status_catch_solib): Adjust to use compiled_regex.
+ (add_solib_catchpoint): Adjust to use compiled_regex.
+ * cli/cli-cmds.c (apropos_command): Use compiled_regex.
+ * cli/cli-decode.c (apropos_cmd): Change regex parameter to
+ compiled_regex reference. Adjust to use it.
+ * cli/cli-decode.h: Remove struct re_pattern_buffer forward
+ declaration. Include "gdb_regex.h".
+ (apropos_cmd): Change regex parameter to compiled_regex reference.
+ * gdb_regex.c: New file.
+ * gdb_regex.h (make_regfree_cleanup, get_regcomp_error): Delete
+ declarations.
+ (class compiled_regex): New.
+ * linux-tdep.c: Include "common/gdb_optional.h".
+ (struct mapping_regexes): New, factored out from
+ mapping_is_anonymous_p, and adjusted to use compiled_regex.
+ (mapping_is_anonymous_p): Use mapping_regexes wrapped in a
+ gdb::optional and remove cleanups. Adjust to compiled_regex.
+ * probe.c: Include "common/gdb_optional.h".
+ (collect_probes): Use compiled_regex and gdb::optional and remove
+ cleanups.
+ * skip.c: Include "common/gdb_optional.h".
+ (skiplist_entry::compiled_function_regexp): Now a
+ gdb::optional<compiled_regex>.
+ (skiplist_entry::compiled_function_regexp_is_valid): Delete field.
+ (free_skiplist_entry): Remove regfree call.
+ (compile_skip_regexp, skip_rfunction_p): Adjust to use
+ compiled_regex and gdb::optional.
+ * symtab.c: Include "common/gdb_optional.h".
+ (search_symbols): Use compiled_regex and gdb::optional.
+ * utils.c (do_regfree_cleanup, make_regfree_cleanup)
+ (get_regcomp_error, compile_rx_or_error): Delete. Some bits moved
+ to gdb_regex.c.
+
+2017-06-07 Alan Hayward <alan.hayward@arm.com>
+
+ * regcache.c (regcache::save): Avoid buffer use.
+ (regcache::dump): Likewise.
+
+2017-06-07 Alan Hayward <alan.hayward@arm.com>
+
+ * sh-tdep.c (sh_pseudo_register_read): Remove
+ MAX_REGISTER_SIZE.
+ (sh_pseudo_register_write): Likewise.
+ * sh64-tdep.c (sh64_pseudo_register_read): Likewise.
+ (sh64_pseudo_register_write): Likewise
+
+2017-06-07 Alan Hayward <alan.hayward@arm.com>
+
+ * aarch64-tdep.c (aarch64_store_return_value): Use
+ V_REGISTER_SIZE.
+ (aarch64_pseudo_read_value): Likewise.
+ (aarch64_pseudo_write): Likewise.
+
+2017-06-06 Yao Qi <yao.qi@linaro.org>
+
+ * regformats/regdef.h (set_register_cache): Remove the
+ declaration.
+
+2017-06-06 Alan Hayward <alan.hayward@arm.com>
+
+ * frame.c (frame_unwind_register_signed): Use
+ frame_unwind_register_value.
+
+2017-06-06 Pedro Alves <palves@redhat.com>
+
+ PR breakpoints/21553
+ * breakpoint.c (create_breakpoints_sal_default)
+ (init_breakpoint_sal, create_breakpoint_sal): Use
+ gdb::unique_xmalloc_ptr for string parameters.
+ (create_breakpoint): Constify 'extra_string' and 'cond_string'
+ parameters. Replace cleanups with gdb::unique_xmalloc_ptr.
+ (base_breakpoint_create_breakpoints_sal)
+ (bkpt_create_breakpoints_sal, tracepoint_create_breakpoints_sal)
+ (strace_marker_create_breakpoints_sal)
+ (create_breakpoints_sal_default): Use gdb::unique_xmalloc_ptr for
+ string parameters.
+ * breakpoint.h (breakpoint_ops::create_breakpoints_sal): Use
+ gdb::unique_xmalloc_ptr for string parameters.
+ (create_breakpoint): Constify 'extra_string' and 'cond_string'
+ parameters.
+
+2017-06-06 Alan Hayward <alan.hayward@arm.com>
+
+ * alpha-tdep.c (alpha_register_to_value): Use
+ get_frame_register_value.
+ (alpha_value_to_register): Use ALPHA_REGISTER_SIZE.
+
+2017-06-06 Alan Hayward <alan.hayward@arm.com>
+
+ * ia64-tdep.c (IA64_MAX_FP_REGISTER_SIZE) Add.
+ (ia64_register_to_value): Use IA64_MAX_FP_REGISTER_SIZE.
+ (ia64_value_to_register): Likewise.
+ (ia64_extract_return_value): Likewise.
+ (ia64_store_return_value): Likewise.
+ (ia64_push_dummy_call): Likewise.
+
+2017-06-04 Joel Brobecker <brobecker@adacore.com>
+
+ GDB 8.0 released.
+
+2017-06-03 Simon Marchi <simon.marchi@ericsson.com>
+
+ * x86-linux-nat.c (struct arch_lwp_info): Remove.
+
+2017-06-03 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * linux-nat.c (linux_nat_post_attach_wait): Remove FIRST
+ parameter.
+ (linux_nat_attach): Adjust call to linux_nat_post_attach_wait.
+
+2017-06-02 Simon Marchi <simon.marchi@ericsson.com>
+
+ * event-loop.c (poll_timers): Unallocate timer using delete
+ instead of xfree.
+
+2017-06-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * breakpoint.h (struct breakpoint_ops) <dtor>: Remove.
+ (struct breakpoint) <~breakpoint>: New.
+ (struct watchpoint): Inherit from breakpoint.
+ <~watchpoint>: New.
+ <base>: Remove.
+ (struct tracepoint): Inherit from breakpoint.
+ <base>: Remove.
+ * breakpoint.c (longjmp_breakpoint_ops): Remove.
+ (struct longjmp_breakpoint): Inherit from breakpoint.
+ <~longjmp_breakpoint>: New.
+ <base>: Remove.
+ (new_breakpoint_from_type): Remove casts.
+ (watchpoint_in_thread_scope): Remove reference to base field.
+ (watchpoint_del_at_next_stop): Likewise.
+ (update_watchpoint): Likewise.
+ (watchpoint_check): Likewise.
+ (bpstat_check_watchpoint): Likewise.
+ (set_longjmp_breakpoint): Likewise.
+ (struct fork_catchpoint): Inherit from breakpoint.
+ <base>: Remove.
+ (struct solib_catchpoint): Inherit from breakpoint.
+ <~solib_catchpoint>: New.
+ <base>: Remove.
+ (dtor_catch_solib): Change to ...
+ (solib_catchpoint::~solib_catchpoint): ... this.
+ (breakpoint_hit_catch_solib): Remove reference to base field.
+ (add_solib_catchpoint): Likewise.
+ (create_fork_vfork_event_catchpoint): Likewise.
+ (struct exec_catchpoint): Inherit from breakpoint.
+ <~exec_catchpoint>: New.
+ <base>: Remove.
+ (dtor_catch_exec): Change to ...
+ (exec_catchpoint::~exec_catchpoint): ... this.
+ (dtor_watchpoint): Change to ...
+ (watchpoint::~watchpoint): ... this.
+ (watch_command_1): Remove reference to base field.
+ (catch_exec_command_1): Likewise.
+ (base_breakpoint_dtor): Change to ...
+ (breakpoint::~breakpoint): ... this.
+ (base_breakpoint_ops): Remove dtor field value.
+ (longjmp_bkpt_dtor): Change to ...
+ (longjmp_breakpoint::~longjmp_breakpoint): ... this.
+ (strace_marker_create_breakpoints_sal): Remove reference to base
+ field.
+ (delete_breakpoint): Don't manually call breakpoint destructor.
+ (create_tracepoint_from_upload): Remove reference to base field.
+ (trace_pass_set_count): Likewise.
+ (initialize_breakpoint_ops): Don't initialize
+ momentary_breakpoint_ops, don't set dtors.
+ * ada-lang.c (struct ada_catchpoint): Inherit from breakpoint.
+ <~ada_catchpoint>: New.
+ <base>: Remove.
+ (create_excep_cond_exprs): Remove reference to base field.
+ (dtor_exception): Change to ...
+ (ada_catchpoint::~ada_catchpoint): ... this.
+ (dtor_catch_exception): Remove.
+ (dtor_catch_exception_unhandled): Remove.
+ (dtor_catch_assert): Remove.
+ (create_ada_exception_catchpoint): Remove reference to base
+ field.
+ (initialize_ada_catchpoint_ops): Don't set dtors.
+ * break-catch-sig.c (struct signal_catchpoint): Inherit from
+ breakpoint.
+ <~signal_catchpoint>: New.
+ <base>: Remove.
+ (signal_catchpoint_dtor): Change to ...
+ (signal_catchpoint::~signal_catchpoint): ... this.
+ (create_signal_catchpoint): Remove reference to base field.
+ (initialize_signal_catchpoint_ops): Don't set dtor.
+ * break-catch-syscall.c (struct syscall_catchpoint): Inherit
+ from breakpoint.
+ <~syscall_catchpoint>: New.
+ <base>: Remove.
+ (dtor_catch_syscall): Change to ...
+ (syscall_catchpoint::~syscall_catchpoint): ... this.
+ (create_syscall_event_catchpoint): Remove reference to base
+ field.
+ (initialize_syscall_catchpoint_ops): Don't set dtor.
+ * break-catch-throw.c (struct exception_catchpoint): Inherit
+ from breakpoint.
+ <~exception_catchpoint>: New.
+ <base>: Remove.
+ (dtor_exception_catchpoint): Change to ...
+ (exception_catchpoint::~exception_catchpoint): ... this.
+ (handle_gnu_v3_exceptions): Remove reference to base field.
+ (initialize_throw_catchpoint_ops): Don't set dtor.
+ * ctf.c (ctf_get_traceframe_address): Remove reference to base
+ field.
+ * remote.c (remote_get_tracepoint_status): Likewise.
+ * tracefile-tfile.c (tfile_get_traceframe_address): Likewise.
+ * tracefile.c (tracefile_fetch_registers): Likewise.
+ * tracepoint.c (actions_command): Likewise.
+ (validate_actionline): Likewise.
+ (tfind_1): Likewise.
+ (get_traceframe_location): Likewise.
+ (find_matching_tracepoint_location): Likewise.
+ (parse_tracepoint_status): Likewise.
+ * mi/mi-cmd-break.c (mi_cmd_break_passcount): Likewise.
+
+2017-06-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * breakpoint.c (struct longjmp_breakpoint): New struct.
+ (is_tracepoint_type): Change return type to bool.
+ (is_longjmp_type): New function.
+ (new_breakpoint_from_type): Handle longjmp kinds of breakpoints.
+ (set_raw_breakpoint_without_location): Use
+ new_breakpoint_from_type.
+ (set_raw_breakpoint): Likewise.
+
+2017-06-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * breakpoint.c (new_breakpoint_from_type): New function.
+ (create_breakpoint_sal): Use new_breakpoint_from_type and
+ unique_ptr.
+ (create_breakpoint): Likewise.
+
2017-05-31 Simon Marchi <simon.marchi@ericsson.com>
* memattr.c (mem_info_command): Rename to ...
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index 13bbb92..c0e3cee 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -332,7 +332,6 @@ the native maintainer when resolving ABI issues.
Corinna Vinschen vinschen@redhat.com
xtensa --target=xtensa-elf
- Maxim Grigoriev maxim2405@gmail.com
All developers recognized by this file can make arbitrary changes to
OBSOLETE targets.
@@ -728,6 +727,7 @@ Michael Snyder (global)
Christopher Faylor (MS Windows, host & native)
Daniel Jacobowitz (global, GNU/Linux MIPS,
C++, GDBserver) drow at false dot org
+Maxim Grigoriev (xtensa) maxim2405 at gmail dot com
Folks that have been caught up in a paper trail:
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index d31571c..a9a4b4e 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -114,7 +114,7 @@ depcomp = $(SHELL) $(srcdir)/../depcomp
# Note that these are overridden by GNU make-specific code below if
# GNU make is used. The overrides implement dependency tracking.
-COMPILE.pre = $(CXX) $(CXX_DIALECT)
+COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
COMPILE.post = -c -o $@
COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
POSTCOMPILE = @true
@@ -534,6 +534,7 @@ SUBDIR_PYTHON_LDFLAGS =
SUBDIR_PYTHON_CFLAGS =
SUBDIR_UNITTESTS_SRCS = \
+ unittests/environ-selftests.c \
unittests/function-view-selftests.c \
unittests/offset-type-selftests.c \
unittests/optional-selftests.c \
@@ -541,6 +542,7 @@ SUBDIR_UNITTESTS_SRCS = \
unittests/scoped_restore-selftests.c
SUBDIR_UNITTESTS_OBS = \
+ environ-selftests.o \
function-view-selftests.o \
offset-type-selftests.o \
optional-selftests.o \
@@ -1112,6 +1114,7 @@ SFILES = \
gdb_bfd.c \
gdb-dlfcn.c \
gdb_obstack.c \
+ gdb_regex.c \
gdb_usleep.c \
gdbarch.c \
gdbarch-selftests.c \
@@ -1242,6 +1245,7 @@ SFILES = \
common/fileio.c \
common/filestuff.c \
common/format.c \
+ common/job-control.c \
common/gdb_vecs.c \
common/new-op.c \
common/print-utils.c \
@@ -1514,9 +1518,11 @@ HFILES_NO_SRCDIR = \
common/common-debug.h \
common/common-defs.h \
common/common-exceptions.h \
+ common/common-gdbthread.h \
common/common-regcache.h \
common/common-types.h \
common/common-utils.h \
+ common/job-control.h \
common/errors.h \
common/environ.h \
common/fileio.h \
@@ -1529,6 +1535,7 @@ HFILES_NO_SRCDIR = \
common/gdb_termios.h \
common/gdb_vecs.h \
common/gdb_wait.h \
+ common/common-inferior.h \
common/host-defs.h \
common/print-utils.h \
common/ptid.h \
@@ -1569,6 +1576,7 @@ HFILES_NO_SRCDIR = \
nat/amd64-linux-siginfo.h \
nat/gdb_ptrace.h \
nat/gdb_thread_db.h \
+ nat/fork-inferior.h \
nat/linux-btrace.h \
nat/linux-namespaces.h \
nat/linux-nat.h \
@@ -1671,6 +1679,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
common-agent.o \
common-debug.o \
common-exceptions.o \
+ job-control.o \
common-regcache.o \
common-utils.o \
complaints.o \
@@ -1725,6 +1734,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
gdb_bfd.o \
gdb-dlfcn.o \
gdb_obstack.o \
+ gdb_regex.o \
gdb_usleep.o \
gdb_vecs.o \
gdbarch.o \
diff --git a/gdb/NEWS b/gdb/NEWS
index b37267f..0b1661c 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -7,6 +7,26 @@ set|show compile-gcc
*** Changes since GDB 8.0
+* On Unix systems, GDBserver now does globbing expansion and variable
+ substitution in inferior command line arguments.
+
+ This is done by starting inferiors using a shell, like GDB does.
+ See "set startup-with-shell" in the user manual for how to disable
+ this from GDB when using "target extended-remote". When using
+ "target remote", you can disable the startup with shell by using the
+ new "--no-startup-with-shell" GDBserver command line option.
+
+* New remote packets
+
+QStartupWithShell
+ Indicates whether the inferior must be started with a shell or not.
+
+* New commands
+
+set debug separate-debug-file
+show debug separate-debug-file
+ Control the display of debug output about separate debug file search.
+
*** Changes in GDB 8.0
* GDB now supports access to the PKU register on GNU/Linux. The register is
@@ -413,6 +433,9 @@ show max-value-size
* New remote packets
+QStartupWithShell
+ Indicates whether the inferior must be started with a shell or not.
+
exec stop reason
Indicates that an exec system call was executed.
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index b94ccb2..d2ca70a 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -1204,8 +1204,6 @@ aarch64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_displaced_step_copy_insn (gdbarch,
aarch64_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, aarch64_displaced_step_fixup);
- set_gdbarch_displaced_step_free_closure (gdbarch,
- simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
set_gdbarch_displaced_step_hw_singlestep (gdbarch,
aarch64_displaced_step_hw_singlestep);
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 000540a..75bb00f 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1777,7 +1777,7 @@ static int
aarch64_gdb_print_insn (bfd_vma memaddr, disassemble_info *info)
{
info->symbols = NULL;
- return print_insn_aarch64 (memaddr, info);
+ return default_print_insn (memaddr, info);
}
/* AArch64 BRK software debug mode instruction.
@@ -1987,7 +1987,7 @@ aarch64_store_return_value (struct type *type, struct regcache *regs,
for (i = 0; i < elements; i++)
{
int regno = AARCH64_V0_REGNUM + i;
- bfd_byte tmpbuf[MAX_REGISTER_SIZE];
+ bfd_byte tmpbuf[V_REGISTER_SIZE];
if (aarch64_debug)
{
@@ -2241,7 +2241,7 @@ aarch64_pseudo_read_value (struct gdbarch *gdbarch,
struct regcache *regcache,
int regnum)
{
- gdb_byte reg_buf[MAX_REGISTER_SIZE];
+ gdb_byte reg_buf[V_REGISTER_SIZE];
struct value *result_value;
gdb_byte *buf;
@@ -2336,7 +2336,7 @@ static void
aarch64_pseudo_write (struct gdbarch *gdbarch, struct regcache *regcache,
int regnum, const gdb_byte *buf)
{
- gdb_byte reg_buf[MAX_REGISTER_SIZE];
+ gdb_byte reg_buf[V_REGISTER_SIZE];
/* Ensure the register buffer is zero, we want gdb writes of the
various 'scalar' pseudo registers to behavior like architectural
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 34e087e..7c60624 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -61,6 +61,7 @@
#include "arch-utils.h"
#include "cli/cli-utils.h"
#include "common/function-view.h"
+#include "common/byte-vector.h"
/* Define whether or not the C operator '/' truncates towards zero for
differently signed operands (truncation direction is undefined in C).
@@ -2567,8 +2568,7 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
gdb_byte *unpacked;
const int is_scalar = is_scalar_type (type);
const int is_big_endian = gdbarch_bits_big_endian (get_type_arch (type));
- std::unique_ptr<gdb_byte[]> staging;
- int staging_len = 0;
+ gdb::byte_vector staging;
type = ada_check_typedef (type);
@@ -2586,14 +2586,14 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
packed, and therefore maybe not at a byte boundary. So, what
we do, is unpack the data into a byte-aligned buffer, and then
use that buffer as our object's value for resolving the type. */
- staging_len = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
- staging.reset (new gdb_byte[staging_len]);
+ int staging_len = (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
+ staging.resize (staging_len);
ada_unpack_from_contents (src, bit_offset, bit_size,
- staging.get (), staging_len,
+ staging.data (), staging.size (),
is_big_endian, has_negatives (type),
is_scalar);
- type = resolve_dynamic_type (type, staging.get (), 0);
+ type = resolve_dynamic_type (type, staging.data (), 0);
if (TYPE_LENGTH (type) < (bit_size + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
{
/* This happens when the length of the object is dynamic,
@@ -2656,12 +2656,12 @@ ada_value_primitive_packed_val (struct value *obj, const gdb_byte *valaddr,
return v;
}
- if (staging != NULL && staging_len == TYPE_LENGTH (type))
+ if (staging.size () == TYPE_LENGTH (type))
{
/* Small short-cut: If we've unpacked the data into a buffer
of the same size as TYPE's length, then we can reuse that,
instead of doing the unpacking again. */
- memcpy (unpacked, staging.get (), staging_len);
+ memcpy (unpacked, staging.data (), staging.size ());
}
else
ada_unpack_from_contents (src, bit_offset, bit_size,
@@ -12257,14 +12257,11 @@ static const struct bp_location_ops ada_catchpoint_location_ops =
ada_catchpoint_location_dtor
};
-/* An instance of this type is used to represent an Ada catchpoint.
- It includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. */
+/* An instance of this type is used to represent an Ada catchpoint. */
-struct ada_catchpoint
+struct ada_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
+ ~ada_catchpoint () override;
/* The name of the specific exception the user specified. */
char *excep_string;
@@ -12285,7 +12282,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
return;
/* Same if there are no locations... */
- if (c->base.loc == NULL)
+ if (c->loc == NULL)
return;
/* Compute the condition expression in text form, from the specific
@@ -12295,7 +12292,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
/* Iterate over all the catchpoint's locations, and parse an
expression for each. */
- for (bl = c->base.loc; bl != NULL; bl = bl->next)
+ for (bl = c->loc; bl != NULL; bl = bl->next)
{
struct ada_catchpoint_location *ada_loc
= (struct ada_catchpoint_location *) bl;
@@ -12316,7 +12313,7 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
{
warning (_("failed to reevaluate internal exception condition "
"for catchpoint %d: %s"),
- c->base.number, e.message);
+ c->number, e.message);
}
END_CATCH
}
@@ -12327,17 +12324,11 @@ create_excep_cond_exprs (struct ada_catchpoint *c)
do_cleanups (old_chain);
}
-/* Implement the DTOR method in the breakpoint_ops structure for all
- exception catchpoint kinds. */
+/* ada_catchpoint destructor. */
-static void
-dtor_exception (enum ada_exception_catchpoint_kind ex, struct breakpoint *b)
+ada_catchpoint::~ada_catchpoint ()
{
- struct ada_catchpoint *c = (struct ada_catchpoint *) b;
-
- xfree (c->excep_string);
-
- bkpt_breakpoint_ops.dtor (b);
+ xfree (this->excep_string);
}
/* Implement the ALLOCATE_LOCATION method in the breakpoint_ops
@@ -12623,12 +12614,6 @@ print_recreate_exception (enum ada_exception_catchpoint_kind ex,
/* Virtual table for "catch exception" breakpoints. */
-static void
-dtor_catch_exception (struct breakpoint *b)
-{
- dtor_exception (ada_catch_exception, b);
-}
-
static struct bp_location *
allocate_location_catch_exception (struct breakpoint *self)
{
@@ -12675,12 +12660,6 @@ static struct breakpoint_ops catch_exception_breakpoint_ops;
/* Virtual table for "catch exception unhandled" breakpoints. */
-static void
-dtor_catch_exception_unhandled (struct breakpoint *b)
-{
- dtor_exception (ada_catch_exception_unhandled, b);
-}
-
static struct bp_location *
allocate_location_catch_exception_unhandled (struct breakpoint *self)
{
@@ -12729,12 +12708,6 @@ static struct breakpoint_ops catch_exception_unhandled_breakpoint_ops;
/* Virtual table for "catch assert" breakpoints. */
-static void
-dtor_catch_assert (struct breakpoint *b)
-{
- dtor_exception (ada_catch_assert, b);
-}
-
static struct bp_location *
allocate_location_catch_assert (struct breakpoint *self)
{
@@ -13060,13 +13033,13 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
= ada_exception_sal (ex_kind, excep_string, &addr_string, &ops);
c = new ada_catchpoint ();
- init_ada_exception_breakpoint (&c->base, gdbarch, sal, addr_string,
+ init_ada_exception_breakpoint (c, gdbarch, sal, addr_string,
ops, tempflag, disabled, from_tty);
c->excep_string = excep_string;
create_excep_cond_exprs (c);
if (cond_string != NULL)
- set_breakpoint_condition (&c->base, cond_string, from_tty);
- install_breakpoint (0, &c->base, 1);
+ set_breakpoint_condition (c, cond_string, from_tty);
+ install_breakpoint (0, c, 1);
}
/* Implement the "catch exception" command. */
@@ -13246,14 +13219,15 @@ sort_remove_dups_ada_exceptions_list (VEC(ada_exc_info) **exceptions,
gets pushed. */
static void
-ada_add_standard_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
+ada_add_standard_exceptions (compiled_regex *preg,
+ VEC(ada_exc_info) **exceptions)
{
int i;
for (i = 0; i < ARRAY_SIZE (standard_exc); i++)
{
if (preg == NULL
- || regexec (preg, standard_exc[i], 0, NULL, 0) == 0)
+ || preg->exec (standard_exc[i], 0, NULL, 0) == 0)
{
struct bound_minimal_symbol msymbol
= ada_lookup_simple_minsym (standard_exc[i]);
@@ -13280,7 +13254,8 @@ ada_add_standard_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
gets pushed. */
static void
-ada_add_exceptions_from_frame (regex_t *preg, struct frame_info *frame,
+ada_add_exceptions_from_frame (compiled_regex *preg,
+ struct frame_info *frame,
VEC(ada_exc_info) **exceptions)
{
const struct block *block = get_frame_block (frame, 0);
@@ -13317,10 +13292,10 @@ ada_add_exceptions_from_frame (regex_t *preg, struct frame_info *frame,
/* Return true if NAME matches PREG or if PREG is NULL. */
static bool
-name_matches_regex (const char *name, regex_t *preg)
+name_matches_regex (const char *name, compiled_regex *preg)
{
return (preg == NULL
- || regexec (preg, ada_decode (name), 0, NULL, 0) == 0);
+ || preg->exec (ada_decode (name), 0, NULL, 0) == 0);
}
/* Add all exceptions defined globally whose name name match
@@ -13343,7 +13318,8 @@ name_matches_regex (const char *name, regex_t *preg)
gets pushed. */
static void
-ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
+ada_add_global_exceptions (compiled_regex *preg,
+ VEC(ada_exc_info) **exceptions)
{
struct objfile *objfile;
struct compunit_symtab *s;
@@ -13391,7 +13367,7 @@ ada_add_global_exceptions (regex_t *preg, VEC(ada_exc_info) **exceptions)
do not match. Otherwise, all exceptions are listed. */
static VEC(ada_exc_info) *
-ada_exceptions_list_1 (regex_t *preg)
+ada_exceptions_list_1 (compiled_regex *preg)
{
VEC(ada_exc_info) *result = NULL;
struct cleanup *old_chain
@@ -13444,19 +13420,11 @@ ada_exceptions_list_1 (regex_t *preg)
VEC(ada_exc_info) *
ada_exceptions_list (const char *regexp)
{
- VEC(ada_exc_info) *result = NULL;
- struct cleanup *old_chain = NULL;
- regex_t reg;
+ if (regexp == NULL)
+ return ada_exceptions_list_1 (NULL);
- if (regexp != NULL)
- old_chain = compile_rx_or_error (&reg, regexp,
- _("invalid regular expression"));
-
- result = ada_exceptions_list_1 (regexp != NULL ? &reg : NULL);
-
- if (old_chain != NULL)
- do_cleanups (old_chain);
- return result;
+ compiled_regex reg (regexp, REG_NOSUB, _("invalid regular expression"));
+ return ada_exceptions_list_1 (&reg);
}
/* Implement the "info exceptions" command. */
@@ -14091,7 +14059,6 @@ initialize_ada_catchpoint_ops (void)
ops = &catch_exception_breakpoint_ops;
*ops = bkpt_breakpoint_ops;
- ops->dtor = dtor_catch_exception;
ops->allocate_location = allocate_location_catch_exception;
ops->re_set = re_set_catch_exception;
ops->check_status = check_status_catch_exception;
@@ -14102,7 +14069,6 @@ initialize_ada_catchpoint_ops (void)
ops = &catch_exception_unhandled_breakpoint_ops;
*ops = bkpt_breakpoint_ops;
- ops->dtor = dtor_catch_exception_unhandled;
ops->allocate_location = allocate_location_catch_exception_unhandled;
ops->re_set = re_set_catch_exception_unhandled;
ops->check_status = check_status_catch_exception_unhandled;
@@ -14113,7 +14079,6 @@ initialize_ada_catchpoint_ops (void)
ops = &catch_assert_breakpoint_ops;
*ops = bkpt_breakpoint_ops;
- ops->dtor = dtor_catch_assert;
ops->allocate_location = allocate_location_catch_assert;
ops->re_set = re_set_catch_assert;
ops->check_status = check_status_catch_assert;
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 0825290..fe97352 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -41,6 +41,14 @@ POSEXP (e"+"?{NUM10})
%{
+#include "common/diagnostics.h"
+
+/* Some old versions of flex generate code that uses the "register" keyword,
+ which clang warns about. This was observed for example with flex 2.5.35,
+ as shipped with macOS 10.12. */
+DIAGNOSTIC_PUSH
+DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
+
#define NUMERAL_WIDTH 256
#define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
@@ -648,3 +656,5 @@ dummy_function ada_flex_use[] =
{
(dummy_function) yyunput
};
+
+DIAGNOSTIC_POP
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index d2489a2..8095eed 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -859,7 +859,8 @@ ada_val_print_num (struct type *type, const gdb_byte *valaddr,
}
else
{
- val_print_type_code_int (type, valaddr + offset_aligned, stream);
+ val_print_scalar_formatted (type, offset_aligned,
+ original_value, options, 0, stream);
if (ada_is_character_type (type))
{
LONGEST c;
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index d7cc0f4..06ee90c 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -244,17 +244,26 @@ alpha_register_to_value (struct frame_info *frame, int regnum,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte in[MAX_REGISTER_SIZE];
+ struct value *value = get_frame_register_value (frame, regnum);
- /* Convert to TYPE. */
- if (!get_frame_register_bytes (frame, regnum, 0,
- register_size (gdbarch, regnum),
- in, optimizedp, unavailablep))
- return 0;
+ gdb_assert (value != NULL);
+ *optimizedp = value_optimized_out (value);
+ *unavailablep = !value_entirely_available (value);
+
+ if (*optimizedp || *unavailablep)
+ {
+ release_value (value);
+ value_free (value);
+ return 0;
+ }
+
+ /* Convert to VALTYPE. */
gdb_assert (TYPE_LENGTH (valtype) == 4);
- alpha_sts (gdbarch, out, in);
- *optimizedp = *unavailablep = 0;
+ alpha_sts (gdbarch, out, value_contents_all (value));
+
+ release_value (value);
+ value_free (value);
return 1;
}
@@ -262,9 +271,11 @@ static void
alpha_value_to_register (struct frame_info *frame, int regnum,
struct type *valtype, const gdb_byte *in)
{
- gdb_byte out[MAX_REGISTER_SIZE];
+ gdb_byte out[ALPHA_REGISTER_SIZE];
gdb_assert (TYPE_LENGTH (valtype) == 4);
+ gdb_assert (register_size (get_frame_arch (frame), regnum)
+ <= ALPHA_REGISTER_SIZE);
alpha_lds (get_frame_arch (frame), out, in);
put_frame_register (frame, regnum, out);
diff --git a/gdb/amd64-linux-tdep.c b/gdb/amd64-linux-tdep.c
index 0e2f285..4ef0f78 100644
--- a/gdb/amd64-linux-tdep.c
+++ b/gdb/amd64-linux-tdep.c
@@ -1848,8 +1848,6 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_displaced_step_copy_insn (gdbarch,
amd64_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, amd64_displaced_step_fixup);
- set_gdbarch_displaced_step_free_closure (gdbarch,
- simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch,
linux_displaced_step_location);
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index d9ee5c6..21f7015 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -145,6 +145,8 @@ static const char *const core_arcompact_register_names[] = {
"lp_count", "reserved", "limm", "pcl",
};
+static char *arc_disassembler_options = NULL;
+
/* Functions are sorted in the order as they are used in the
_initialize_arc_tdep (), which uses the same order as gdbarch.h. Static
functions are defined before the first invocation. */
@@ -1405,12 +1407,34 @@ arc_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
int
arc_delayed_print_insn (bfd_vma addr, struct disassemble_info *info)
{
- int (*print_insn) (bfd_vma, struct disassemble_info *);
- /* exec_bfd may be null, if GDB is run without a target BFD file. Opcodes
- will handle NULL value gracefully. */
- print_insn = arc_get_disassembler (exec_bfd);
- gdb_assert (print_insn != NULL);
- return print_insn (addr, info);
+ /* Standard BFD "machine number" field allows libocodes disassembler to
+ distinguish ARC 600, 700 and v2 cores, however v2 encompasses both ARC EM
+ and HS, which have some difference between. There are two ways to specify
+ what is the target core:
+ 1) via the disassemble_info->disassembler_options;
+ 2) otherwise libopcodes will use private (architecture-specific) ELF
+ header.
+
+ Using disassembler_options is preferable, because it comes directly from
+ GDBserver which scanned an actual ARC core identification info. However,
+ not all GDBservers report core architecture, so as a fallback GDB still
+ should support analysis of ELF header. The libopcodes disassembly code
+ uses the section to find the BFD and the BFD to find the ELF header,
+ therefore this function should set disassemble_info->section properly.
+
+ disassembler_options was already set by non-target specific code with
+ proper options obtained via gdbarch_disassembler_options ().
+
+ This function might be called multiple times in a sequence, reusing same
+ disassemble_info. */
+ if ((info->disassembler_options == NULL) && (info->section == NULL))
+ {
+ struct obj_section *s = find_pc_section (addr);
+ if (s != NULL)
+ info->section = s->the_bfd_section;
+ }
+
+ return default_print_insn (addr, info);
}
/* Baremetal breakpoint instructions.
@@ -2013,6 +2037,8 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_frame_align (gdbarch, arc_frame_align);
+ set_gdbarch_print_insn (gdbarch, arc_delayed_print_insn);
+
set_gdbarch_cannot_step_breakpoint (gdbarch, 1);
/* "nonsteppable" watchpoint means that watchpoint triggers before
@@ -2041,6 +2067,31 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
if (tdep->jb_pc >= 0)
set_gdbarch_get_longjmp_target (gdbarch, arc_get_longjmp_target);
+ /* Disassembler options. Enforce CPU if it was specified in XML target
+ description, otherwise use default method of determining CPU (ELF private
+ header). */
+ if (info.target_desc != NULL)
+ {
+ const struct bfd_arch_info *tdesc_arch
+ = tdesc_architecture (info.target_desc);
+ if (tdesc_arch != NULL)
+ {
+ xfree (arc_disassembler_options);
+ /* FIXME: It is not really good to change disassembler options
+ behind the scene, because that might override options
+ specified by the user. However as of now ARC doesn't support
+ `set disassembler-options' hence this code is the only place
+ where options are changed. It also changes options for all
+ existing gdbarches, which also can be problematic, if
+ arc_gdbarch_init will start reusing existing gdbarch
+ instances. */
+ arc_disassembler_options = xstrprintf ("cpu=%s",
+ tdesc_arch->printable_name);
+ set_gdbarch_disassembler_options (gdbarch,
+ &arc_disassembler_options);
+ }
+ }
+
tdesc_use_registers (gdbarch, tdesc, tdesc_data);
return gdbarch;
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index c011b0f..2ae3413 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -60,14 +60,6 @@ simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
return (struct displaced_step_closure *) buf;
}
-
-void
-simple_displaced_step_free_closure (struct gdbarch *gdbarch,
- struct displaced_step_closure *closure)
-{
- xfree (closure);
-}
-
int
default_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
struct displaced_step_closure *closure)
diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h
index 040afca..2aa9159 100644
--- a/gdb/arch-utils.h
+++ b/gdb/arch-utils.h
@@ -85,13 +85,6 @@ extern struct displaced_step_closure *
CORE_ADDR from, CORE_ADDR to,
struct regcache *regs);
-/* Simple implementation of gdbarch_displaced_step_free_closure: Call
- xfree.
- This is appropriate for use with simple_displaced_step_copy_insn. */
-extern void
- simple_displaced_step_free_closure (struct gdbarch *gdbarch,
- struct displaced_step_closure *closure);
-
/* Default implementation of gdbarch_displaced_hw_singlestep. */
extern int
default_displaced_step_hw_singlestep (struct gdbarch *,
diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c
index 094ed72..95c5260 100644
--- a/gdb/arm-linux-tdep.c
+++ b/gdb/arm-linux-tdep.c
@@ -1812,8 +1812,6 @@ arm_linux_init_abi (struct gdbarch_info info,
set_gdbarch_displaced_step_copy_insn (gdbarch,
arm_linux_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, arm_displaced_step_fixup);
- set_gdbarch_displaced_step_free_closure (gdbarch,
- simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
/* Reversible debugging, process record. */
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 691fae7..9943324 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -7773,10 +7773,7 @@ gdb_print_insn_arm (bfd_vma memaddr, disassemble_info *info)
else
info->symbols = NULL;
- if (info->endian == BFD_ENDIAN_BIG)
- return print_insn_big_arm (memaddr, info);
- else
- return print_insn_little_arm (memaddr, info);
+ return default_print_insn (memaddr, info);
}
/* The following define instruction sequences that will cause ARM
diff --git a/gdb/break-catch-sig.c b/gdb/break-catch-sig.c
index 5f02fe6..3eede93 100644
--- a/gdb/break-catch-sig.c
+++ b/gdb/break-catch-sig.c
@@ -38,16 +38,12 @@ typedef enum gdb_signal gdb_signal_type;
DEF_VEC_I (gdb_signal_type);
/* An instance of this type is used to represent a signal catchpoint.
- It includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. A breakpoint is
- really of this type iff its ops pointer points to
+ A breakpoint is really of this type iff its ops pointer points to
SIGNAL_CATCHPOINT_OPS. */
-struct signal_catchpoint
+struct signal_catchpoint : public breakpoint
{
- /* The base class. */
-
- struct breakpoint base;
+ ~signal_catchpoint () override;
/* Signal numbers used for the 'catch signal' feature. If no signal
has been specified for filtering, its value is NULL. Otherwise,
@@ -89,17 +85,11 @@ signal_to_name_or_int (enum gdb_signal sig)
-/* Implement the "dtor" breakpoint_ops method for signal
- catchpoints. */
+/* signal_catchpoint destructor. */
-static void
-signal_catchpoint_dtor (struct breakpoint *b)
+signal_catchpoint::~signal_catchpoint ()
{
- struct signal_catchpoint *c = (struct signal_catchpoint *) b;
-
- VEC_free (gdb_signal_type, c->signals_to_be_caught);
-
- base_breakpoint_ops.dtor (b);
+ VEC_free (gdb_signal_type, this->signals_to_be_caught);
}
/* Implement the "insert_location" breakpoint_ops method for signal
@@ -372,11 +362,11 @@ create_signal_catchpoint (int tempflag, VEC (gdb_signal_type) *filter,
struct gdbarch *gdbarch = get_current_arch ();
c = new signal_catchpoint ();
- init_catchpoint (&c->base, gdbarch, tempflag, NULL, &signal_catchpoint_ops);
+ init_catchpoint (c, gdbarch, tempflag, NULL, &signal_catchpoint_ops);
c->signals_to_be_caught = filter;
c->catch_all = catch_all;
- install_breakpoint (0, &c->base, 1);
+ install_breakpoint (0, c, 1);
}
@@ -473,7 +463,6 @@ initialize_signal_catchpoint_ops (void)
ops = &signal_catchpoint_ops;
*ops = base_breakpoint_ops;
- ops->dtor = signal_catchpoint_dtor;
ops->insert_location = signal_catchpoint_insert_location;
ops->remove_location = signal_catchpoint_remove_location;
ops->breakpoint_hit = signal_catchpoint_breakpoint_hit;
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 322f680..92ab91b 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -31,15 +31,12 @@
#include "xml-syscall.h"
/* An instance of this type is used to represent a syscall catchpoint.
- It includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. A breakpoint is
- really of this type iff its ops pointer points to
+ A breakpoint is really of this type iff its ops pointer points to
CATCH_SYSCALL_BREAKPOINT_OPS. */
-struct syscall_catchpoint
+struct syscall_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
+ ~syscall_catchpoint () override;
/* Syscall numbers used for the 'catch syscall' feature. If no
syscall has been specified for filtering, its value is NULL.
@@ -48,17 +45,11 @@ struct syscall_catchpoint
VEC(int) *syscalls_to_be_caught;
};
-/* Implement the "dtor" breakpoint_ops method for syscall
- catchpoints. */
+/* catch_syscall destructor. */
-static void
-dtor_catch_syscall (struct breakpoint *b)
+syscall_catchpoint::~syscall_catchpoint ()
{
- struct syscall_catchpoint *c = (struct syscall_catchpoint *) b;
-
- VEC_free (int, c->syscalls_to_be_caught);
-
- base_breakpoint_ops.dtor (b);
+ VEC_free (int, this->syscalls_to_be_caught);
}
static const struct inferior_data *catch_syscall_inferior_data = NULL;
@@ -434,10 +425,10 @@ create_syscall_event_catchpoint (int tempflag, VEC(int) *filter,
struct gdbarch *gdbarch = get_current_arch ();
c = new syscall_catchpoint ();
- init_catchpoint (&c->base, gdbarch, tempflag, NULL, ops);
+ init_catchpoint (c, gdbarch, tempflag, NULL, ops);
c->syscalls_to_be_caught = filter;
- install_breakpoint (0, &c->base, 1);
+ install_breakpoint (0, c, 1);
}
/* Splits the argument using space as delimiter. Returns an xmalloc'd
@@ -701,7 +692,6 @@ initialize_syscall_catchpoint_ops (void)
/* Syscall catchpoints. */
ops = &catch_syscall_breakpoint_ops;
*ops = base_breakpoint_ops;
- ops->dtor = dtor_catch_syscall;
ops->insert_location = insert_catch_syscall;
ops->remove_location = remove_catch_syscall;
ops->breakpoint_hit = breakpoint_hit_catch_syscall;
diff --git a/gdb/break-catch-throw.c b/gdb/break-catch-throw.c
index 2714bbf..0074d06 100644
--- a/gdb/break-catch-throw.c
+++ b/gdb/break-catch-throw.c
@@ -74,11 +74,9 @@ static struct breakpoint_ops gnu_v3_exception_catchpoint_ops;
/* The type of an exception catchpoint. */
-struct exception_catchpoint
+struct exception_catchpoint : public breakpoint
{
- /* The base class. */
-
- struct breakpoint base;
+ ~exception_catchpoint () override;
/* The kind of exception catchpoint. */
@@ -89,10 +87,10 @@ struct exception_catchpoint
char *exception_rx;
- /* If non-NULL, an xmalloc'd, compiled regular expression which is
- used to determine which exceptions to stop on. */
+ /* If non-NULL, a compiled regular expression which is used to
+ determine which exceptions to stop on. */
- regex_t *pattern;
+ std::unique_ptr<compiled_regex> pattern;
};
@@ -142,17 +140,11 @@ classify_exception_breakpoint (struct breakpoint *b)
return cp->kind;
}
-/* Implement the 'dtor' method. */
+/* exception_catchpoint destructor. */
-static void
-dtor_exception_catchpoint (struct breakpoint *self)
+exception_catchpoint::~exception_catchpoint ()
{
- struct exception_catchpoint *cp = (struct exception_catchpoint *) self;
-
- xfree (cp->exception_rx);
- if (cp->pattern != NULL)
- regfree (cp->pattern);
- bkpt_breakpoint_ops.dtor (self);
+ xfree (this->exception_rx);
}
/* Implement the 'check_status' method. */
@@ -191,7 +183,7 @@ check_status_exception_catchpoint (struct bpstats *bs)
if (!type_name.empty ())
{
- if (regexec (self->pattern, type_name.c_str (), 0, NULL, 0) != 0)
+ if (self->pattern->exec (type_name.c_str (), 0, NULL, 0) != 0)
bs->stop = 0;
}
}
@@ -383,31 +375,28 @@ handle_gnu_v3_exceptions (int tempflag, char *except_rx,
const char *cond_string,
enum exception_event_kind ex_event, int from_tty)
{
- regex_t *pattern = NULL;
+ std::unique_ptr<compiled_regex> pattern;
if (except_rx != NULL)
{
- pattern = XNEW (regex_t);
- make_cleanup (xfree, pattern);
-
- compile_rx_or_error (pattern, except_rx,
- _("invalid type-matching regexp"));
+ pattern.reset (new compiled_regex (except_rx, REG_NOSUB,
+ _("invalid type-matching regexp")));
}
std::unique_ptr<exception_catchpoint> cp (new exception_catchpoint ());
- init_catchpoint (&cp->base, get_current_arch (), tempflag, cond_string,
+ init_catchpoint (cp.get (), get_current_arch (), tempflag, cond_string,
&gnu_v3_exception_catchpoint_ops);
/* We need to reset 'type' in order for code in breakpoint.c to do
the right thing. */
- cp->base.type = bp_breakpoint;
+ cp->type = bp_breakpoint;
cp->kind = ex_event;
cp->exception_rx = except_rx;
- cp->pattern = pattern;
+ cp->pattern = std::move (pattern);
- re_set_exception_catchpoint (&cp->base);
+ re_set_exception_catchpoint (cp.get ());
- install_breakpoint (0, &cp->base, 1);
+ install_breakpoint (0, cp.get (), 1);
cp.release ();
}
@@ -558,7 +547,6 @@ initialize_throw_catchpoint_ops (void)
/* GNU v3 exception catchpoints. */
ops = &gnu_v3_exception_catchpoint_ops;
*ops = bkpt_breakpoint_ops;
- ops->dtor = dtor_exception_catchpoint;
ops->re_set = re_set_exception_catchpoint;
ops->print_it = print_it_exception_catchpoint;
ops->print_one = print_one_exception_catchpoint;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 150b08c..053ccef 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -120,7 +120,9 @@ static void
static void create_breakpoints_sal_default (struct gdbarch *,
struct linespec_result *,
- char *, char *, enum bptype,
+ gdb::unique_xmalloc_ptr<char>,
+ gdb::unique_xmalloc_ptr<char>,
+ enum bptype,
enum bpdisp, int, int,
int,
const struct breakpoint_ops *,
@@ -309,9 +311,6 @@ static struct breakpoint_ops internal_breakpoint_ops;
/* Momentary breakpoints class type. */
static struct breakpoint_ops momentary_breakpoint_ops;
-/* Momentary breakpoints for bp_longjmp and bp_exception class type. */
-static struct breakpoint_ops longjmp_breakpoint_ops;
-
/* The breakpoint_ops structure to be used in regular user created
breakpoints. */
struct breakpoint_ops bkpt_breakpoint_ops;
@@ -1160,22 +1159,51 @@ check_no_tracepoint_commands (struct command_line *commands)
}
}
+struct longjmp_breakpoint : public breakpoint
+{
+ ~longjmp_breakpoint () override;
+};
+
/* Encapsulate tests for different types of tracepoints. */
-static int
-is_tracepoint_type (enum bptype type)
+static bool
+is_tracepoint_type (bptype type)
{
return (type == bp_tracepoint
|| type == bp_fast_tracepoint
|| type == bp_static_tracepoint);
}
+static bool
+is_longjmp_type (bptype type)
+{
+ return type == bp_longjmp || type == bp_exception;
+}
+
int
is_tracepoint (const struct breakpoint *b)
{
return is_tracepoint_type (b->type);
}
+/* Factory function to create an appropriate instance of breakpoint given
+ TYPE. */
+
+static std::unique_ptr<breakpoint>
+new_breakpoint_from_type (bptype type)
+{
+ breakpoint *b;
+
+ if (is_tracepoint_type (type))
+ b = new tracepoint ();
+ else if (is_longjmp_type (type))
+ b = new longjmp_breakpoint ();
+ else
+ b = new breakpoint ();
+
+ return std::unique_ptr<breakpoint> (b);
+}
+
/* A helper function that validates that COMMANDS are valid for a
breakpoint. This function will throw an exception if a problem is
found. */
@@ -1707,7 +1735,7 @@ is_watchpoint (const struct breakpoint *bpt)
static int
watchpoint_in_thread_scope (struct watchpoint *b)
{
- return (b->base.pspace == current_program_space
+ return (b->pspace == current_program_space
&& (ptid_equal (b->watchpoint_thread, null_ptid)
|| (ptid_equal (inferior_ptid, b->watchpoint_thread)
&& !is_executing (inferior_ptid))));
@@ -1719,17 +1747,15 @@ watchpoint_in_thread_scope (struct watchpoint *b)
static void
watchpoint_del_at_next_stop (struct watchpoint *w)
{
- struct breakpoint *b = &w->base;
-
- if (b->related_breakpoint != b)
+ if (w->related_breakpoint != w)
{
- gdb_assert (b->related_breakpoint->type == bp_watchpoint_scope);
- gdb_assert (b->related_breakpoint->related_breakpoint == b);
- b->related_breakpoint->disposition = disp_del_at_next_stop;
- b->related_breakpoint->related_breakpoint = b->related_breakpoint;
- b->related_breakpoint = b;
+ gdb_assert (w->related_breakpoint->type == bp_watchpoint_scope);
+ gdb_assert (w->related_breakpoint->related_breakpoint == w);
+ w->related_breakpoint->disposition = disp_del_at_next_stop;
+ w->related_breakpoint->related_breakpoint = w->related_breakpoint;
+ w->related_breakpoint = w;
}
- b->disposition = disp_del_at_next_stop;
+ w->disposition = disp_del_at_next_stop;
}
/* Extract a bitfield value from value VAL using the bit parameters contained in
@@ -1850,7 +1876,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
if (!watchpoint_in_thread_scope (b))
return;
- if (b->base.disposition == disp_del_at_next_stop)
+ if (b->disposition == disp_del_at_next_stop)
return;
frame_saved = 0;
@@ -1888,7 +1914,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
/* We don't free locations. They are stored in the bp_location array
and update_global_location_list will eventually delete them and
remove breakpoints if needed. */
- b->base.loc = NULL;
+ b->loc = NULL;
if (within_current_scope && reparse)
{
@@ -1908,11 +1934,11 @@ update_watchpoint (struct watchpoint *b, int reparse)
/* Note that unlike with breakpoints, the watchpoint's condition
expression is stored in the breakpoint object, not in the
locations (re)created below. */
- if (b->base.cond_string != NULL)
+ if (b->cond_string != NULL)
{
b->cond_exp.reset ();
- s = b->base.cond_string;
+ s = b->cond_string;
b->cond_exp = parse_exp_1 (&s, 0, b->cond_exp_valid_block, 0);
}
}
@@ -1929,8 +1955,8 @@ update_watchpoint (struct watchpoint *b, int reparse)
the target gains execution, through breakpoint_re_set. */
if (!can_use_hw_watchpoints)
{
- if (b->base.ops->works_in_software_mode (&b->base))
- b->base.type = bp_watchpoint;
+ if (b->ops->works_in_software_mode (b))
+ b->type = bp_watchpoint;
else
error (_("Can't set read/access watchpoint when "
"hardware watchpoints are disabled."));
@@ -1950,7 +1976,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
happens, the code that reports it updates b->val directly.
We don't keep track of the memory value for masked
watchpoints. */
- if (!b->val_valid && !is_masked_watchpoint (&b->base))
+ if (!b->val_valid && !is_masked_watchpoint (b))
{
if (b->val_bitsize != 0)
{
@@ -2013,13 +2039,13 @@ update_watchpoint (struct watchpoint *b, int reparse)
}
type = hw_write;
- if (b->base.type == bp_read_watchpoint)
+ if (b->type == bp_read_watchpoint)
type = hw_read;
- else if (b->base.type == bp_access_watchpoint)
+ else if (b->type == bp_access_watchpoint)
type = hw_access;
- loc = allocate_bp_location (&b->base);
- for (tmp = &(b->base.loc); *tmp != NULL; tmp = &((*tmp)->next))
+ loc = allocate_bp_location (b);
+ for (tmp = &(b->loc); *tmp != NULL; tmp = &((*tmp)->next))
;
*tmp = loc;
loc->gdbarch = get_type_arch (value_type (v));
@@ -2069,7 +2095,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
/* If this is a software watchpoint, we try to turn it
to a hardware one -- count resources as if B was of
hardware watchpoint type. */
- type = b->base.type;
+ type = b->type;
if (type == bp_watchpoint)
type = bp_hardware_watchpoint;
@@ -2080,16 +2106,16 @@ update_watchpoint (struct watchpoint *b, int reparse)
manually. */
/* Count resources used by all watchpoints except B. */
- i = hw_watchpoint_used_count_others (&b->base, type, &other_type_used);
+ i = hw_watchpoint_used_count_others (b, type, &other_type_used);
/* Add in the resources needed for B. */
- i += hw_watchpoint_use_count (&b->base);
+ i += hw_watchpoint_use_count (b);
target_resources_ok
= target_can_use_hardware_watchpoint (type, i, other_type_used);
if (target_resources_ok <= 0)
{
- int sw_mode = b->base.ops->works_in_software_mode (&b->base);
+ int sw_mode = b->ops->works_in_software_mode (b);
if (target_resources_ok == 0 && !sw_mode)
error (_("Target does not support this type of "
@@ -2099,7 +2125,7 @@ update_watchpoint (struct watchpoint *b, int reparse)
"resources for this watchpoint."));
/* Downgrade to software watchpoint. */
- b->base.type = bp_watchpoint;
+ b->type = bp_watchpoint;
}
else
{
@@ -2107,10 +2133,10 @@ update_watchpoint (struct watchpoint *b, int reparse)
found we have enough resources to turn it to a
hardware watchpoint. Otherwise, this is a
nop. */
- b->base.type = type;
+ b->type = type;
}
}
- else if (!b->base.ops->works_in_software_mode (&b->base))
+ else if (!b->ops->works_in_software_mode (b))
{
if (!can_use_hw_watchpoints)
error (_("Can't set read/access watchpoint when "
@@ -2120,11 +2146,11 @@ update_watchpoint (struct watchpoint *b, int reparse)
"read/access watchpoint."));
}
else
- b->base.type = bp_watchpoint;
+ b->type = bp_watchpoint;
- loc_type = (b->base.type == bp_watchpoint? bp_loc_other
+ loc_type = (b->type == bp_watchpoint? bp_loc_other
: bp_loc_hardware_watchpoint);
- for (bl = b->base.loc; bl; bl = bl->next)
+ for (bl = b->loc; bl; bl = bl->next)
bl->loc_type = loc_type;
}
@@ -2139,15 +2165,15 @@ update_watchpoint (struct watchpoint *b, int reparse)
above left it without any location set up. But,
bpstat_stop_status requires a location to be able to report
stops, so make sure there's at least a dummy one. */
- if (b->base.type == bp_watchpoint && b->base.loc == NULL)
- software_watchpoint_add_no_memory_location (&b->base, frame_pspace);
+ if (b->type == bp_watchpoint && b->loc == NULL)
+ software_watchpoint_add_no_memory_location (b, frame_pspace);
}
else if (!within_current_scope)
{
printf_filtered (_("\
Watchpoint %d deleted because the program has left the block\n\
in which its expression is valid.\n"),
- b->base.number);
+ b->number);
watchpoint_del_at_next_stop (b);
}
@@ -5167,7 +5193,7 @@ watchpoint_check (void *p)
struct value *mark;
struct value *new_val;
- if (is_masked_watchpoint (&b->base))
+ if (is_masked_watchpoint (b))
/* Since we don't know the exact trigger address (from
stopped_data_address), just tell the user we've triggered
a mask watchpoint. */
@@ -5227,13 +5253,13 @@ watchpoint_check (void *p)
uiout->field_string
("reason", async_reason_lookup (EXEC_ASYNC_WATCHPOINT_SCOPE));
uiout->text ("\nWatchpoint ");
- uiout->field_int ("wpnum", b->base.number);
+ uiout->field_int ("wpnum", b->number);
uiout->text (" deleted because the program has left the block in\n"
"which its expression is valid.\n");
}
/* Make sure the watchpoint's commands aren't executed. */
- decref_counted_command_line (&b->base.commands);
+ decref_counted_command_line (&b->commands);
watchpoint_del_at_next_stop (b);
return WP_DELETED;
@@ -5275,7 +5301,7 @@ bpstat_check_watchpoint (bpstat bs)
{
int must_check_value = 0;
- if (b->base.type == bp_watchpoint)
+ if (b->type == bp_watchpoint)
/* For a software watchpoint, we must always check the
watched value. */
must_check_value = 1;
@@ -5285,7 +5311,7 @@ bpstat_check_watchpoint (bpstat bs)
this watchpoint. */
must_check_value = 1;
else if (b->watchpoint_triggered == watch_triggered_unknown
- && b->base.type == bp_hardware_watchpoint)
+ && b->type == bp_hardware_watchpoint)
/* We were stopped by a hardware watchpoint, but the target could
not report the data address. We must check the watchpoint's
value. Access and read watchpoints are out of luck; without
@@ -5296,7 +5322,7 @@ bpstat_check_watchpoint (bpstat bs)
{
char *message
= xstrprintf ("Error evaluating expression for watchpoint %d\n",
- b->base.number);
+ b->number);
struct cleanup *cleanups = make_cleanup (xfree, message);
int e = catch_errors (watchpoint_check, bs, message,
RETURN_MASK_ALL);
@@ -5313,7 +5339,7 @@ bpstat_check_watchpoint (bpstat bs)
bs->stop = 0;
break;
case WP_VALUE_CHANGED:
- if (b->base.type == bp_read_watchpoint)
+ if (b->type == bp_read_watchpoint)
{
/* There are two cases to consider here:
@@ -5384,8 +5410,8 @@ bpstat_check_watchpoint (bpstat bs)
}
break;
case WP_VALUE_NOT_CHANGED:
- if (b->base.type == bp_hardware_watchpoint
- || b->base.type == bp_watchpoint)
+ if (b->type == bp_hardware_watchpoint
+ || b->type == bp_watchpoint)
{
/* Don't stop: write watchpoints shouldn't fire if
the value hasn't changed. */
@@ -5402,7 +5428,7 @@ bpstat_check_watchpoint (bpstat bs)
SWITCH_THRU_ALL_UIS ()
{
printf_filtered (_("Watchpoint %d deleted.\n"),
- b->base.number);
+ b->number);
}
watchpoint_del_at_next_stop (b);
/* We've already printed what needs to be printed. */
@@ -7430,11 +7456,12 @@ set_raw_breakpoint_without_location (struct gdbarch *gdbarch,
enum bptype bptype,
const struct breakpoint_ops *ops)
{
- struct breakpoint *b = new breakpoint ();
+ std::unique_ptr<breakpoint> b = new_breakpoint_from_type (bptype);
- init_raw_breakpoint_without_location (b, gdbarch, bptype, ops);
- add_to_breakpoint_chain (b);
- return b;
+ init_raw_breakpoint_without_location (b.get (), gdbarch, bptype, ops);
+ add_to_breakpoint_chain (b.get ());
+
+ return b.release ();
}
/* Initialize loc->function_name. EXPLICIT_LOC says no indirect function
@@ -7546,11 +7573,12 @@ set_raw_breakpoint (struct gdbarch *gdbarch,
struct symtab_and_line sal, enum bptype bptype,
const struct breakpoint_ops *ops)
{
- struct breakpoint *b = new breakpoint ();
+ std::unique_ptr<breakpoint> b = new_breakpoint_from_type (bptype);
- init_raw_breakpoint (b, gdbarch, sal, bptype, ops);
- add_to_breakpoint_chain (b);
- return b;
+ init_raw_breakpoint (b.get (), gdbarch, sal, bptype, ops);
+ add_to_breakpoint_chain (b.get ());
+
+ return b.release ();
}
/* Call this routine when stepping and nexting to enable a breakpoint
@@ -7578,7 +7606,7 @@ set_longjmp_breakpoint (struct thread_info *tp, struct frame_id frame)
/* longjmp_breakpoint_ops ensures INITIATING_FRAME is cleared again
after their removal. */
clone = momentary_breakpoint_from_master (b, type,
- &longjmp_breakpoint_ops, 1);
+ &momentary_breakpoint_ops, 1);
clone->thread = thread;
}
@@ -8000,16 +8028,11 @@ disable_breakpoints_in_freed_objfile (struct objfile *objfile)
/* FORK & VFORK catchpoints. */
/* An instance of this type is used to represent a fork or vfork
- catchpoint. It includes a "struct breakpoint" as a kind of base
- class; users downcast to "struct breakpoint *" when needed. A
- breakpoint is really of this type iff its ops pointer points to
- CATCH_FORK_BREAKPOINT_OPS. */
+ catchpoint. A breakpoint is really of this type iff its ops pointer points
+ to CATCH_FORK_BREAKPOINT_OPS. */
-struct fork_catchpoint
+struct fork_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
-
/* Process id of a child process whose forking triggered this
catchpoint. This field is only valid immediately after this
catchpoint has triggered. */
@@ -8248,15 +8271,12 @@ print_recreate_catch_vfork (struct breakpoint *b, struct ui_file *fp)
static struct breakpoint_ops catch_vfork_breakpoint_ops;
/* An instance of this type is used to represent an solib catchpoint.
- It includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. A breakpoint is
- really of this type iff its ops pointer points to
+ A breakpoint is really of this type iff its ops pointer points to
CATCH_SOLIB_BREAKPOINT_OPS. */
-struct solib_catchpoint
+struct solib_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
+ ~solib_catchpoint () override;
/* True for "catch load", false for "catch unload". */
unsigned char is_load;
@@ -8264,19 +8284,12 @@ struct solib_catchpoint
/* Regular expression to match, if any. COMPILED is only valid when
REGEX is non-NULL. */
char *regex;
- regex_t compiled;
+ std::unique_ptr<compiled_regex> compiled;
};
-static void
-dtor_catch_solib (struct breakpoint *b)
+solib_catchpoint::~solib_catchpoint ()
{
- struct solib_catchpoint *self = (struct solib_catchpoint *) b;
-
- if (self->regex)
- regfree (&self->compiled);
- xfree (self->regex);
-
- base_breakpoint_ops.dtor (b);
+ xfree (this->regex);
}
static int
@@ -8313,7 +8326,7 @@ breakpoint_hit_catch_solib (const struct bp_location *bl,
if (other->type != bp_shlib_event)
continue;
- if (self->base.pspace != NULL && other->pspace != self->base.pspace)
+ if (self->pspace != NULL && other->pspace != self->pspace)
continue;
for (other_bl = other->loc; other_bl != NULL; other_bl = other_bl->next)
@@ -8343,7 +8356,7 @@ check_status_catch_solib (struct bpstats *bs)
++ix)
{
if (!self->regex
- || regexec (&self->compiled, iter->so_name, 0, NULL, 0) == 0)
+ || self->compiled->exec (iter->so_name, 0, NULL, 0) == 0)
return;
}
}
@@ -8357,7 +8370,7 @@ check_status_catch_solib (struct bpstats *bs)
++ix)
{
if (!self->regex
- || regexec (&self->compiled, iter, 0, NULL, 0) == 0)
+ || self->compiled->exec (iter, 0, NULL, 0) == 0)
return;
}
}
@@ -8473,27 +8486,19 @@ add_solib_catchpoint (const char *arg, int is_load, int is_temp, int enabled)
if (*arg != '\0')
{
- int errcode;
-
- errcode = regcomp (&c->compiled, arg, REG_NOSUB);
- if (errcode != 0)
- {
- char *err = get_regcomp_error (errcode, &c->compiled);
-
- make_cleanup (xfree, err);
- error (_("Invalid regexp (%s): %s"), err, arg);
- }
+ c->compiled.reset (new compiled_regex (arg, REG_NOSUB,
+ _("Invalid regexp")));
c->regex = xstrdup (arg);
}
c->is_load = is_load;
- init_catchpoint (&c->base, gdbarch, is_temp, NULL,
+ init_catchpoint (c, gdbarch, is_temp, NULL,
&catch_solib_breakpoint_ops);
- c->base.enable_state = enabled ? bp_enabled : bp_disabled;
+ c->enable_state = enabled ? bp_enabled : bp_disabled;
discard_cleanups (cleanup);
- install_breakpoint (0, &c->base, 1);
+ install_breakpoint (0, c, 1);
}
/* A helper function that does all the work for "catch load" and
@@ -8569,25 +8574,22 @@ create_fork_vfork_event_catchpoint (struct gdbarch *gdbarch,
{
struct fork_catchpoint *c = new fork_catchpoint ();
- init_catchpoint (&c->base, gdbarch, tempflag, cond_string, ops);
+ init_catchpoint (c, gdbarch, tempflag, cond_string, ops);
c->forked_inferior_pid = null_ptid;
- install_breakpoint (0, &c->base, 1);
+ install_breakpoint (0, c, 1);
}
/* Exec catchpoints. */
/* An instance of this type is used to represent an exec catchpoint.
- It includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. A breakpoint is
- really of this type iff its ops pointer points to
+ A breakpoint is really of this type iff its ops pointer points to
CATCH_EXEC_BREAKPOINT_OPS. */
-struct exec_catchpoint
+struct exec_catchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
+ ~exec_catchpoint () override;
/* Filename of a program whose exec triggered this catchpoint.
This field is only valid immediately after this catchpoint has
@@ -8595,17 +8597,11 @@ struct exec_catchpoint
char *exec_pathname;
};
-/* Implement the "dtor" breakpoint_ops method for exec
- catchpoints. */
+/* Exec catchpoint destructor. */
-static void
-dtor_catch_exec (struct breakpoint *b)
+exec_catchpoint::~exec_catchpoint ()
{
- struct exec_catchpoint *c = (struct exec_catchpoint *) b;
-
- xfree (c->exec_pathname);
-
- base_breakpoint_ops.dtor (b);
+ xfree (this->exec_pathname);
}
static int
@@ -9163,8 +9159,9 @@ static void
init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
struct symtabs_and_lines sals,
event_location_up &&location,
- char *filter, char *cond_string,
- char *extra_string,
+ gdb::unique_xmalloc_ptr<char> filter,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string,
enum bptype type, enum bpdisp disposition,
int thread, int task, int ignore_count,
const struct breakpoint_ops *ops, int from_tty,
@@ -9210,8 +9207,8 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
b->thread = thread;
b->task = task;
- b->cond_string = cond_string;
- b->extra_string = extra_string;
+ b->cond_string = cond_string.release ();
+ b->extra_string = extra_string.release ();
b->ignore_count = ignore_count;
b->enable_state = enabled ? bp_enabled : bp_disabled;
b->disposition = disposition;
@@ -9295,47 +9292,36 @@ init_breakpoint_sal (struct breakpoint *b, struct gdbarch *gdbarch,
b->location = std::move (location);
else
b->location = new_address_location (b->loc->address, NULL, 0);
- b->filter = filter;
+ b->filter = filter.release ();
}
static void
create_breakpoint_sal (struct gdbarch *gdbarch,
struct symtabs_and_lines sals,
event_location_up &&location,
- char *filter, char *cond_string,
- char *extra_string,
+ gdb::unique_xmalloc_ptr<char> filter,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string,
enum bptype type, enum bpdisp disposition,
int thread, int task, int ignore_count,
const struct breakpoint_ops *ops, int from_tty,
int enabled, int internal, unsigned flags,
int display_canonical)
{
- struct breakpoint *b;
- struct cleanup *old_chain;
-
- if (is_tracepoint_type (type))
- {
- struct tracepoint *t;
-
- t = new tracepoint ();
- b = &t->base;
- }
- else
- b = new breakpoint ();
-
- old_chain = make_cleanup (xfree, b);
+ std::unique_ptr<breakpoint> b = new_breakpoint_from_type (type);
- init_breakpoint_sal (b, gdbarch,
+ init_breakpoint_sal (b.get (), gdbarch,
sals, std::move (location),
- filter, cond_string, extra_string,
+ std::move (filter),
+ std::move (cond_string),
+ std::move (extra_string),
type, disposition,
thread, task, ignore_count,
ops, from_tty,
enabled, internal, flags,
display_canonical);
- discard_cleanups (old_chain);
- install_breakpoint (internal, b, 0);
+ install_breakpoint (internal, b.release (), 0);
}
/* Add SALS.nelts breakpoints to the breakpoint table. For each
@@ -9356,7 +9342,8 @@ create_breakpoint_sal (struct gdbarch *gdbarch,
static void
create_breakpoints_sal (struct gdbarch *gdbarch,
struct linespec_result *canonical,
- char *cond_string, char *extra_string,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string,
enum bptype type, enum bpdisp disposition,
int thread, int task, int ignore_count,
const struct breakpoint_ops *ops, int from_tty,
@@ -9375,13 +9362,14 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
event_location_up location
= (canonical->location != NULL
? copy_event_location (canonical->location.get ()) : NULL);
- char *filter_string = lsal->canonical ? xstrdup (lsal->canonical) : NULL;
+ gdb::unique_xmalloc_ptr<char> filter_string
+ (lsal->canonical != NULL ? xstrdup (lsal->canonical) : NULL);
- make_cleanup (xfree, filter_string);
create_breakpoint_sal (gdbarch, lsal->sals,
std::move (location),
- filter_string,
- cond_string, extra_string,
+ std::move (filter_string),
+ std::move (cond_string),
+ std::move (extra_string),
type, disposition,
thread, task, ignore_count, ops,
from_tty, enabled, internal, flags,
@@ -9660,8 +9648,9 @@ decode_static_tracepoint_spec (const char **arg_p)
int
create_breakpoint (struct gdbarch *gdbarch,
- const struct event_location *location, char *cond_string,
- int thread, char *extra_string,
+ const struct event_location *location,
+ const char *cond_string,
+ int thread, const char *extra_string,
int parse_extra,
int tempflag, enum bptype type_wanted,
int ignore_count,
@@ -9753,9 +9742,13 @@ create_breakpoint (struct gdbarch *gdbarch,
breakpoint. */
if (!pending)
{
+ gdb::unique_xmalloc_ptr<char> cond_string_copy;
+ gdb::unique_xmalloc_ptr<char> extra_string_copy;
+
if (parse_extra)
{
char *rest;
+ char *cond;
struct linespec_sals *lsal;
lsal = VEC_index (linespec_sals, canonical.sals, 0);
@@ -9766,15 +9759,9 @@ create_breakpoint (struct gdbarch *gdbarch,
re-parse it in context of each sal. */
find_condition_and_thread (extra_string, lsal->sals.sals[0].pc,
- &cond_string, &thread, &task, &rest);
- if (cond_string)
- make_cleanup (xfree, cond_string);
- if (rest)
- make_cleanup (xfree, rest);
- if (rest)
- extra_string = rest;
- else
- extra_string = NULL;
+ &cond, &thread, &task, &rest);
+ cond_string_copy.reset (cond);
+ extra_string_copy.reset (rest);
}
else
{
@@ -9784,39 +9771,25 @@ create_breakpoint (struct gdbarch *gdbarch,
/* Create a private copy of condition string. */
if (cond_string)
- {
- cond_string = xstrdup (cond_string);
- make_cleanup (xfree, cond_string);
- }
+ cond_string_copy.reset (xstrdup (cond_string));
/* Create a private copy of any extra string. */
if (extra_string)
- {
- extra_string = xstrdup (extra_string);
- make_cleanup (xfree, extra_string);
- }
+ extra_string_copy.reset (xstrdup (extra_string));
}
ops->create_breakpoints_sal (gdbarch, &canonical,
- cond_string, extra_string, type_wanted,
+ std::move (cond_string_copy),
+ std::move (extra_string_copy),
+ type_wanted,
tempflag ? disp_del : disp_donttouch,
thread, task, ignore_count, ops,
from_tty, enabled, internal, flags);
}
else
{
- struct breakpoint *b;
-
- if (is_tracepoint_type (type_wanted))
- {
- struct tracepoint *t;
-
- t = new tracepoint ();
- b = &t->base;
- }
- else
- b = new breakpoint ();
+ std::unique_ptr <breakpoint> b = new_breakpoint_from_type (type_wanted);
- init_raw_breakpoint_without_location (b, gdbarch, type_wanted, ops);
+ init_raw_breakpoint_without_location (b.get (), gdbarch, type_wanted, ops);
b->location = copy_event_location (location);
if (parse_extra)
@@ -9824,22 +9797,12 @@ create_breakpoint (struct gdbarch *gdbarch,
else
{
/* Create a private copy of condition string. */
- if (cond_string)
- {
- cond_string = xstrdup (cond_string);
- make_cleanup (xfree, cond_string);
- }
- b->cond_string = cond_string;
+ b->cond_string = cond_string != NULL ? xstrdup (cond_string) : NULL;
b->thread = thread;
}
/* Create a private copy of any extra string. */
- if (extra_string != NULL)
- {
- extra_string = xstrdup (extra_string);
- make_cleanup (xfree, extra_string);
- }
- b->extra_string = extra_string;
+ b->extra_string = extra_string != NULL ? xstrdup (extra_string) : NULL;
b->ignore_count = ignore_count;
b->disposition = tempflag ? disp_del : disp_donttouch;
b->condition_not_parsed = 1;
@@ -9848,7 +9811,7 @@ create_breakpoint (struct gdbarch *gdbarch,
&& type_wanted != bp_hardware_breakpoint) || thread != -1)
b->pspace = current_program_space;
- install_breakpoint (internal, b, 0);
+ install_breakpoint (internal, b.release (), 0);
}
if (VEC_length (linespec_sals, canonical.sals) > 1)
@@ -10503,18 +10466,13 @@ watchpoint_exp_is_const (const struct expression *exp)
return 1;
}
-/* Implement the "dtor" breakpoint_ops method for watchpoints. */
+/* Watchpoint destructor. */
-static void
-dtor_watchpoint (struct breakpoint *self)
+watchpoint::~watchpoint ()
{
- struct watchpoint *w = (struct watchpoint *) self;
-
- xfree (w->exp_string);
- xfree (w->exp_string_reparse);
- value_free (w->val);
-
- base_breakpoint_ops.dtor (self);
+ xfree (this->exp_string);
+ xfree (this->exp_string_reparse);
+ value_free (this->val);
}
/* Implement the "re_set" breakpoint_ops method for watchpoints. */
@@ -10999,7 +10957,7 @@ static void
watch_command_1 (const char *arg, int accessflag, int from_tty,
int just_location, int internal)
{
- struct breakpoint *b, *scope_breakpoint = NULL;
+ struct breakpoint *scope_breakpoint = NULL;
const struct block *exp_valid_block = NULL, *cond_exp_valid_block = NULL;
struct value *val, *mark, *result;
int saved_bitpos = 0, saved_bitsize = 0;
@@ -11238,16 +11196,16 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
bp_type = bp_hardware_watchpoint;
w = new watchpoint ();
- b = &w->base;
+
if (use_mask)
- init_raw_breakpoint_without_location (b, NULL, bp_type,
+ init_raw_breakpoint_without_location (w, NULL, bp_type,
&masked_watchpoint_breakpoint_ops);
else
- init_raw_breakpoint_without_location (b, NULL, bp_type,
+ init_raw_breakpoint_without_location (w, NULL, bp_type,
&watchpoint_breakpoint_ops);
- b->thread = thread;
- b->disposition = disp_donttouch;
- b->pspace = current_program_space;
+ w->thread = thread;
+ w->disposition = disp_donttouch;
+ w->pspace = current_program_space;
w->exp = std::move (exp);
w->exp_valid_block = exp_valid_block;
w->cond_exp_valid_block = cond_exp_valid_block;
@@ -11278,9 +11236,9 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
}
if (cond_start)
- b->cond_string = savestring (cond_start, cond_end - cond_start);
+ w->cond_string = savestring (cond_start, cond_end - cond_start);
else
- b->cond_string = 0;
+ w->cond_string = 0;
if (frame_id_p (watchpoint_frame))
{
@@ -11297,8 +11255,8 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
{
/* The scope breakpoint is related to the watchpoint. We will
need to act on them together. */
- b->related_breakpoint = scope_breakpoint;
- scope_breakpoint->related_breakpoint = b;
+ w->related_breakpoint = scope_breakpoint;
+ scope_breakpoint->related_breakpoint = w;
}
if (!just_location)
@@ -11312,12 +11270,12 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
}
CATCH (e, RETURN_MASK_ALL)
{
- delete_breakpoint (b);
+ delete_breakpoint (w);
throw_exception (e);
}
END_CATCH
- install_breakpoint (internal, b, 1);
+ install_breakpoint (internal, w, 1);
do_cleanups (back_to);
}
@@ -11787,11 +11745,11 @@ catch_exec_command_1 (char *arg_entry, int from_tty,
error (_("Junk at end of arguments."));
c = new exec_catchpoint ();
- init_catchpoint (&c->base, gdbarch, tempflag, cond_string,
+ init_catchpoint (c, gdbarch, tempflag, cond_string,
&catch_exec_breakpoint_ops);
c->exec_pathname = NULL;
- install_breakpoint (0, &c->base, 1);
+ install_breakpoint (0, c, 1);
}
void
@@ -12756,16 +12714,14 @@ static const struct bp_location_ops bp_location_ops =
bp_location_dtor
};
-/* Default breakpoint_ops methods all breakpoint_ops ultimately
- inherit from. */
+/* Destructor for the breakpoint base class. */
-static void
-base_breakpoint_dtor (struct breakpoint *self)
+breakpoint::~breakpoint ()
{
- decref_counted_command_line (&self->commands);
- xfree (self->cond_string);
- xfree (self->extra_string);
- xfree (self->filter);
+ decref_counted_command_line (&this->commands);
+ xfree (this->cond_string);
+ xfree (this->extra_string);
+ xfree (this->filter);
}
static struct bp_location *
@@ -12866,8 +12822,8 @@ base_breakpoint_create_sals_from_location
static void
base_breakpoint_create_breakpoints_sal (struct gdbarch *gdbarch,
struct linespec_result *c,
- char *cond_string,
- char *extra_string,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string,
enum bptype type_wanted,
enum bpdisp disposition,
int thread,
@@ -12906,7 +12862,6 @@ base_breakpoint_after_condition_true (struct bpstats *bs)
struct breakpoint_ops base_breakpoint_ops =
{
- base_breakpoint_dtor,
base_breakpoint_allocate_location,
base_breakpoint_re_set,
base_breakpoint_insert_location,
@@ -13116,8 +13071,8 @@ bkpt_create_sals_from_location (const struct event_location *location,
static void
bkpt_create_breakpoints_sal (struct gdbarch *gdbarch,
struct linespec_result *canonical,
- char *cond_string,
- char *extra_string,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string,
enum bptype type_wanted,
enum bpdisp disposition,
int thread,
@@ -13127,7 +13082,8 @@ bkpt_create_breakpoints_sal (struct gdbarch *gdbarch,
int internal, unsigned flags)
{
create_breakpoints_sal_default (gdbarch, canonical,
- cond_string, extra_string,
+ std::move (cond_string),
+ std::move (extra_string),
type_wanted,
disposition, thread, task,
ignore_count, ops, from_tty,
@@ -13274,15 +13230,12 @@ momentary_bkpt_print_mention (struct breakpoint *b)
It gets cleared already on the removal of the first one of such placed
breakpoints. This is OK as they get all removed altogether. */
-static void
-longjmp_bkpt_dtor (struct breakpoint *self)
+longjmp_breakpoint::~longjmp_breakpoint ()
{
- struct thread_info *tp = find_thread_global_id (self->thread);
+ thread_info *tp = find_thread_global_id (this->thread);
- if (tp)
+ if (tp != NULL)
tp->initiating_frame = null_frame_id;
-
- momentary_breakpoint_ops.dtor (self);
}
/* Specific methods for probe breakpoints. */
@@ -13438,8 +13391,8 @@ tracepoint_create_sals_from_location (const struct event_location *location,
static void
tracepoint_create_breakpoints_sal (struct gdbarch *gdbarch,
struct linespec_result *canonical,
- char *cond_string,
- char *extra_string,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string,
enum bptype type_wanted,
enum bpdisp disposition,
int thread,
@@ -13449,7 +13402,8 @@ tracepoint_create_breakpoints_sal (struct gdbarch *gdbarch,
int internal, unsigned flags)
{
create_breakpoints_sal_default (gdbarch, canonical,
- cond_string, extra_string,
+ std::move (cond_string),
+ std::move (extra_string),
type_wanted,
disposition, thread, task,
ignore_count, ops, from_tty,
@@ -13594,8 +13548,8 @@ strace_marker_create_sals_from_location (const struct event_location *location,
static void
strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
struct linespec_result *canonical,
- char *cond_string,
- char *extra_string,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string,
enum bptype type_wanted,
enum bpdisp disposition,
int thread,
@@ -13627,9 +13581,10 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
location = copy_event_location (canonical->location.get ());
tp = new tracepoint ();
- init_breakpoint_sal (&tp->base, gdbarch, expanded,
+ init_breakpoint_sal (tp, gdbarch, expanded,
std::move (location), NULL,
- cond_string, extra_string,
+ std::move (cond_string),
+ std::move (extra_string),
type_wanted, disposition,
thread, task, ignore_count, ops,
from_tty, enabled, internal, flags,
@@ -13642,7 +13597,7 @@ strace_marker_create_breakpoints_sal (struct gdbarch *gdbarch,
corresponds to this one */
tp->static_trace_marker_id_idx = i;
- install_breakpoint (internal, &tp->base, 0);
+ install_breakpoint (internal, tp, 0);
}
}
@@ -13762,7 +13717,6 @@ delete_breakpoint (struct breakpoint *bpt)
self-contained, but it's not the case now. */
update_global_location_list (UGLL_DONT_INSERT);
- bpt->ops->dtor (bpt);
/* On the chance that someone will soon try again to delete this
same bp, we mark it as deleted before freeing its storage. */
bpt->type = bp_none;
@@ -14383,8 +14337,8 @@ create_sals_from_location_default (const struct event_location *location,
static void
create_breakpoints_sal_default (struct gdbarch *gdbarch,
struct linespec_result *canonical,
- char *cond_string,
- char *extra_string,
+ gdb::unique_xmalloc_ptr<char> cond_string,
+ gdb::unique_xmalloc_ptr<char> extra_string,
enum bptype type_wanted,
enum bpdisp disposition,
int thread,
@@ -14393,8 +14347,9 @@ create_breakpoints_sal_default (struct gdbarch *gdbarch,
int from_tty, int enabled,
int internal, unsigned flags)
{
- create_breakpoints_sal (gdbarch, canonical, cond_string,
- extra_string,
+ create_breakpoints_sal (gdbarch, canonical,
+ std::move (cond_string),
+ std::move (extra_string),
type_wanted, disposition,
thread, task, ignore_count, ops, from_tty,
enabled, internal, flags);
@@ -15258,7 +15213,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
if (utp->pass > 0)
{
xsnprintf (small_buf, sizeof (small_buf), "%d %d", utp->pass,
- tp->base.number);
+ tp->number);
trace_pass_command (small_buf, 0);
}
@@ -15276,7 +15231,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL, NULL);
- breakpoint_set_commands (&tp->base, std::move (cmd_list));
+ breakpoint_set_commands (tp, std::move (cmd_list));
}
else if (!VEC_empty (char_ptr, utp->actions)
|| !VEC_empty (char_ptr, utp->step_actions))
@@ -15285,7 +15240,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
utp->number);
/* Copy any status information that might be available. */
- tp->base.hit_count = utp->hit_count;
+ tp->hit_count = utp->hit_count;
tp->traceframe_usage = utp->traceframe_usage;
return tp;
@@ -15371,10 +15326,10 @@ static void
trace_pass_set_count (struct tracepoint *tp, int count, int from_tty)
{
tp->pass_count = count;
- observer_notify_breakpoint_modified (&tp->base);
+ observer_notify_breakpoint_modified (tp);
if (from_tty)
printf_filtered (_("Setting tracepoint %d's passcount to %d\n"),
- tp->base.number, count);
+ tp->number, count);
}
/* Set passcount for tracepoint.
@@ -15880,11 +15835,6 @@ initialize_breakpoint_ops (void)
ops->print_it = momentary_bkpt_print_it;
ops->print_mention = momentary_bkpt_print_mention;
- /* Momentary breakpoints for bp_longjmp and bp_exception. */
- ops = &longjmp_breakpoint_ops;
- *ops = momentary_breakpoint_ops;
- ops->dtor = longjmp_bkpt_dtor;
-
/* Probe breakpoints. */
ops = &bkpt_probe_breakpoint_ops;
*ops = bkpt_breakpoint_ops;
@@ -15896,7 +15846,6 @@ initialize_breakpoint_ops (void)
/* Watchpoints. */
ops = &watchpoint_breakpoint_ops;
*ops = base_breakpoint_ops;
- ops->dtor = dtor_watchpoint;
ops->re_set = re_set_watchpoint;
ops->insert_location = insert_watchpoint;
ops->remove_location = remove_watchpoint;
@@ -15971,7 +15920,6 @@ initialize_breakpoint_ops (void)
/* Exec catchpoints. */
ops = &catch_exec_breakpoint_ops;
*ops = base_breakpoint_ops;
- ops->dtor = dtor_catch_exec;
ops->insert_location = insert_catch_exec;
ops->remove_location = remove_catch_exec;
ops->breakpoint_hit = breakpoint_hit_catch_exec;
@@ -15983,7 +15931,6 @@ initialize_breakpoint_ops (void)
/* Solib-related catchpoints. */
ops = &catch_solib_breakpoint_ops;
*ops = base_breakpoint_ops;
- ops->dtor = dtor_catch_solib;
ops->insert_location = insert_catch_solib;
ops->remove_location = remove_catch_solib;
ops->breakpoint_hit = breakpoint_hit_catch_solib;
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 26b0aa5..d955184 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -512,10 +512,6 @@ enum print_stop_action
struct breakpoint_ops
{
- /* Destructor. Releases everything from SELF (but not SELF
- itself). */
- void (*dtor) (struct breakpoint *self);
-
/* Allocate a location for this breakpoint. */
struct bp_location * (*allocate_location) (struct breakpoint *);
@@ -608,7 +604,8 @@ struct breakpoint_ops
This function is called inside `create_breakpoint'. */
void (*create_breakpoints_sal) (struct gdbarch *,
struct linespec_result *,
- char *, char *,
+ gdb::unique_xmalloc_ptr<char>,
+ gdb::unique_xmalloc_ptr<char>,
enum bptype, enum bpdisp, int, int,
int, const struct breakpoint_ops *,
int, int, int, unsigned);
@@ -680,6 +677,8 @@ extern int target_exact_watchpoints;
struct breakpoint
{
+ virtual ~breakpoint ();
+
/* Methods associated with this breakpoint. */
const breakpoint_ops *ops = NULL;
@@ -783,14 +782,11 @@ struct breakpoint
gdbscm_breakpoint_object *scm_bp_object = NULL;
};
-/* An instance of this type is used to represent a watchpoint. It
- includes a "struct breakpoint" as a kind of base class; users
- downcast to "struct breakpoint *" when needed. */
+/* An instance of this type is used to represent a watchpoint. */
-struct watchpoint
+struct watchpoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
+ ~watchpoint () override;
/* String form of exp to use for displaying to the user (malloc'd),
or NULL if none. */
@@ -867,14 +863,10 @@ extern int is_breakpoint (const struct breakpoint *bpt);
extern int is_watchpoint (const struct breakpoint *bpt);
/* An instance of this type is used to represent all kinds of
- tracepoints. It includes a "struct breakpoint" as a kind of base
- class; users downcast to "struct breakpoint *" when needed. */
+ tracepoints. */
-struct tracepoint
+struct tracepoint : public breakpoint
{
- /* The base class. */
- struct breakpoint base;
-
/* Number of times this tracepoint should single-step and collect
additional data. */
long step_count;
@@ -1338,8 +1330,8 @@ enum breakpoint_create_flags
extern int create_breakpoint (struct gdbarch *gdbarch,
const struct event_location *location,
- char *cond_string, int thread,
- char *extra_string,
+ const char *cond_string, int thread,
+ const char *extra_string,
int parse_extra,
int tempflag, enum bptype wanted_type,
int ignore_count,
diff --git a/gdb/build-id.c b/gdb/build-id.c
index 0f63223..4b2b63e 100644
--- a/gdb/build-id.c
+++ b/gdb/build-id.c
@@ -112,6 +112,9 @@ build_id_to_debug_bfd (size_t build_id_len, const bfd_byte *build_id)
s += sprintf (s, "%02x", (unsigned) *data++);
strcpy (s, ".debug");
+ if (separate_debug_file_debug)
+ printf_unfiltered (_(" Trying %s\n"), link);
+
/* lrealpath() is expensive even for the usually non-existent files. */
if (access (link, F_OK) == 0)
filename = lrealpath (link);
@@ -147,6 +150,10 @@ find_separate_debug_file_by_buildid (struct objfile *objfile)
build_id = build_id_bfd_get (objfile->obfd);
if (build_id != NULL)
{
+ if (separate_debug_file_debug)
+ printf_unfiltered (_("\nLooking for separate debug info (build-id) for "
+ "%s\n"), objfile_name (objfile));
+
gdb_bfd_ref_ptr abfd (build_id_to_debug_bfd (build_id->size,
build_id->data));
/* Prevent looping on a stripped .debug file. */
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index ab1de5c..653fed6 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -454,8 +454,8 @@ c_val_print_int (struct type *type, struct type *unresolved_type,
}
else
{
- val_print_type_code_int (type, valaddr + embedded_offset * unit_size,
- stream);
+ val_print_scalar_formatted (type, embedded_offset,
+ original_value, options, 0, stream);
/* C and C++ has no single byte int type, char is used
instead. Since we don't know whether the value is really
intended to be used as an integer or a character, print
diff --git a/gdb/charset.c b/gdb/charset.c
index f55e482..be95bbe 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -673,7 +673,7 @@ wchar_iterator::iterate (enum wchar_iterate_result *out_result,
++out_request;
if (out_request > m_out.size ())
- m_out.reserve (out_request);
+ m_out.resize (out_request);
continue;
case EINVAL:
@@ -794,16 +794,14 @@ find_charset_names (void)
int err, status;
int fail = 1;
int flags;
- struct gdb_environ *iconv_env;
+ gdb_environ iconv_env = gdb_environ::from_host_environ ();
char *iconv_program;
/* Older iconvs, e.g. 2.2.2, don't omit the intro text if stdout is
not a tty. We need to recognize it and ignore it. This text is
subject to translation, so force LANGUAGE=C. */
- iconv_env = make_environ ();
- init_environ (iconv_env);
- set_in_environ (iconv_env, "LANGUAGE", "C");
- set_in_environ (iconv_env, "LC_ALL", "C");
+ iconv_env.set ("LANGUAGE", "C");
+ iconv_env.set ("LC_ALL", "C");
child = pex_init (PEX_USE_PIPES, "iconv", NULL);
@@ -827,7 +825,7 @@ find_charset_names (void)
/* Note that we simply ignore errors here. */
if (!pex_run_in_environment (child, flags,
args[0], const_cast<char **> (args),
- environ_vector (iconv_env),
+ iconv_env.envp (),
NULL, NULL, &err))
{
FILE *in = pex_read_output (child, 0);
@@ -901,7 +899,6 @@ find_charset_names (void)
xfree (iconv_program);
pex_free (child);
- free_environ (iconv_env);
if (fail)
{
diff --git a/gdb/charset.h b/gdb/charset.h
index 51180e3..821974a 100644
--- a/gdb/charset.h
+++ b/gdb/charset.h
@@ -19,7 +19,7 @@
#ifndef CHARSET_H
#define CHARSET_H
-#include <vector>
+#include "common/def-vector.h"
/* If the target program uses a different character set than the host,
GDB has some support for translating between the two; GDB converts
@@ -144,7 +144,7 @@ class wchar_iterator
size_t m_width;
/* The output buffer. */
- std::vector<gdb_wchar_t> m_out;
+ gdb::def_vector<gdb_wchar_t> m_out;
};
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 2a5b128..0930342 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1336,28 +1336,13 @@ show_user (char *args, int from_tty)
static void
apropos_command (char *searchstr, int from_tty)
{
- regex_t pattern;
- int code;
-
if (searchstr == NULL)
error (_("REGEXP string is empty"));
- code = regcomp (&pattern, searchstr, REG_ICASE);
- if (code == 0)
- {
- struct cleanup *cleanups;
+ compiled_regex pattern (searchstr, REG_ICASE,
+ _("Error in regular expression"));
- cleanups = make_regfree_cleanup (&pattern);
- apropos_cmd (gdb_stdout, cmdlist, &pattern, "");
- do_cleanups (cleanups);
- }
- else
- {
- char *err = get_regcomp_error (code, &pattern);
-
- make_cleanup (xfree, err);
- error (_("Error in regular expression: %s"), err);
- }
+ apropos_cmd (gdb_stdout, cmdlist, pattern, "");
}
/* Subroutine of alias_command to simplify it.
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index d386d02..383adf8 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -917,7 +917,7 @@ add_com_suppress_notification (const char *name, enum command_class theclass,
void
apropos_cmd (struct ui_file *stream,
struct cmd_list_element *commandlist,
- struct re_pattern_buffer *regex, const char *prefix)
+ compiled_regex &regex, const char *prefix)
{
struct cmd_list_element *c;
int returnvalue;
@@ -928,9 +928,10 @@ apropos_cmd (struct ui_file *stream,
returnvalue = -1; /* Needed to avoid double printing. */
if (c->name != NULL)
{
+ size_t name_len = strlen (c->name);
+
/* Try to match against the name. */
- returnvalue = re_search (regex, c->name, strlen(c->name),
- 0, strlen (c->name), NULL);
+ returnvalue = regex.search (c->name, name_len, 0, name_len, NULL);
if (returnvalue >= 0)
{
print_help_for_command (c, prefix,
@@ -939,8 +940,10 @@ apropos_cmd (struct ui_file *stream,
}
if (c->doc != NULL && returnvalue < 0)
{
+ size_t doc_len = strlen (c->doc);
+
/* Try to match against documentation. */
- if (re_search(regex,c->doc,strlen(c->doc),0,strlen(c->doc),NULL) >=0)
+ if (regex.search (c->doc, doc_len, 0, doc_len, NULL) >= 0)
{
print_help_for_command (c, prefix,
0 /* don't recurse */, stream);
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 66159fd..11248ba 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -23,8 +23,7 @@
/* Include the public interfaces. */
#include "command.h"
-
-struct re_pattern_buffer;
+#include "gdb_regex.h"
#if 0
/* FIXME: cagney/2002-03-17: Once cmd_type() has been removed, ``enum
@@ -234,7 +233,7 @@ extern void help_cmd_list (struct cmd_list_element *, enum command_class,
extern void help_cmd (const char *, struct ui_file *);
extern void apropos_cmd (struct ui_file *, struct cmd_list_element *,
- struct re_pattern_buffer *, const char *);
+ compiled_regex &, const char *);
/* Used to mark commands that don't do anything. If we just leave the
function field NULL, the command is interpreted as a help topic, or
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 213622d..d6d4aab 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -31,7 +31,7 @@
#include "cli/cli-utils.h"
#include "gdb_bfd.h"
#include "filestuff.h"
-
+#include "common/byte-vector.h"
static const char *
scan_expression_with_cleanup (const char **cmd, const char *def)
@@ -230,17 +230,17 @@ dump_memory_to_file (const char *cmd, const char *mode, const char *file_format)
/* FIXME: Should use read_memory_partial() and a magic blocking
value. */
- std::unique_ptr<gdb_byte[]> buf (new gdb_byte[count]);
- read_memory (lo, buf.get (), count);
+ gdb::byte_vector buf (count);
+ read_memory (lo, buf.data (), count);
/* Have everything. Open/write the data. */
if (file_format == NULL || strcmp (file_format, "binary") == 0)
{
- dump_binary_file (filename, mode, buf.get (), count);
+ dump_binary_file (filename, mode, buf.data (), count);
}
else
{
- dump_bfd_file (filename, mode, file_format, lo, buf.get (), count);
+ dump_bfd_file (filename, mode, file_format, lo, buf.data (), count);
}
do_cleanups (old_cleanups);
@@ -545,13 +545,13 @@ restore_binary_file (const char *filename, struct callback_data *data)
perror_with_name (filename);
/* Now allocate a buffer and read the file contents. */
- std::unique_ptr<gdb_byte[]> buf (new gdb_byte[len]);
- if (fread (buf.get (), 1, len, file) != len)
+ gdb::byte_vector buf (len);
+ if (fread (buf.data (), 1, len, file) != len)
perror_with_name (filename);
/* Now write the buffer into target memory. */
len = target_write_memory (data->load_start + data->load_offset,
- buf.get (), len);
+ buf.data (), len);
if (len != 0)
warning (_("restore: memory write failed (%s)."), safe_strerror (len));
do_cleanups (cleanup);
diff --git a/gdb/common/agent.h b/gdb/common/agent.h
index 171c591..f24f482 100644
--- a/gdb/common/agent.h
+++ b/gdb/common/agent.h
@@ -17,16 +17,19 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#ifndef COMMON_AGENT_H
+#define COMMON_AGENT_H
+
+#include "common/preprocessor.h"
+
int agent_run_command (int pid, const char *cmd, int len);
int agent_look_up_symbols (void *);
-#define STRINGIZE_1(STR) #STR
-#define STRINGIZE(STR) STRINGIZE_1(STR)
#define IPA_SYM_EXPORTED_NAME(SYM) gdb_agent_ ## SYM
#define IPA_SYM(SYM) \
{ \
- STRINGIZE (IPA_SYM_EXPORTED_NAME (SYM)), \
+ STRINGIFY (IPA_SYM_EXPORTED_NAME (SYM)), \
offsetof (struct ipa_sym_addresses, addr_ ## SYM) \
}
@@ -56,3 +59,5 @@ enum agent_capa
int agent_capability_check (enum agent_capa);
void agent_capability_invalidate (void);
+
+#endif /* COMMON_AGENT_H */
diff --git a/gdb/common/byte-vector.h b/gdb/common/byte-vector.h
new file mode 100644
index 0000000..c17b14d
--- /dev/null
+++ b/gdb/common/byte-vector.h
@@ -0,0 +1,62 @@
+/* Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef COMMON_BYTE_VECTOR_H
+#define COMMON_BYTE_VECTOR_H
+
+#include "common/def-vector.h"
+
+namespace gdb {
+
+/* byte_vector is a gdb_byte std::vector with a custom allocator that
+ unlike std::vector<gdb_byte> does not zero-initialize new elements
+ by default when the vector is created/resized. This is what you
+ usually want when working with byte buffers, since if you're
+ creating or growing a buffer you'll most surely want to fill it in
+ with data, in which case zero-initialization would be a
+ pessimization. For example:
+
+ gdb::byte_vector buf (some_large_size);
+ fill_with_data (buf.data (), buf.size ());
+
+ On the odd case you do need zero initialization, then you can still
+ call the overloads that specify an explicit value, like:
+
+ gdb::byte_vector buf (some_initial_size, 0);
+ buf.resize (a_bigger_size, 0);
+
+ (Or use std::vector<gdb_byte> instead.)
+
+ Note that unlike std::vector<gdb_byte>, function local
+ gdb::byte_vector objects constructed with an initial size like:
+
+ gdb::byte_vector buf (some_size);
+ fill_with_data (buf.data (), buf.size ());
+
+ usually compile down to the exact same as:
+
+ std::unique_ptr<byte[]> buf (new gdb_byte[some_size]);
+ fill_with_data (buf.get (), some_size);
+
+ with the former having the advantage of being a bit more readable,
+ and providing the whole std::vector API, if you end up needing it.
+*/
+using byte_vector = gdb::def_vector<gdb_byte>;
+
+} /* namespace gdb */
+
+#endif /* COMMON_DEF_VECTOR_H */
diff --git a/gdb/common/common-gdbthread.h b/gdb/common/common-gdbthread.h
new file mode 100644
index 0000000..d8635e7
--- /dev/null
+++ b/gdb/common/common-gdbthread.h
@@ -0,0 +1,25 @@
+/* Common multi-process/thread control defs for GDB and gdbserver.
+ Copyright (C) 1987-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef COMMON_GDBTHREAD_H
+#define COMMON_GDBTHREAD_H
+
+/* Switch from one thread to another. */
+extern void switch_to_thread (ptid_t ptid);
+
+#endif /* ! COMMON_GDBTHREAD_H */
diff --git a/gdb/common/common-inferior.h b/gdb/common/common-inferior.h
new file mode 100644
index 0000000..87c1300
--- /dev/null
+++ b/gdb/common/common-inferior.h
@@ -0,0 +1,33 @@
+/* Functions to deal with the inferior being executed on GDB or
+ GDBserver.
+
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef COMMON_INFERIOR_H
+#define COMMON_INFERIOR_H
+
+/* Return the exec wrapper to be used when starting the inferior, or NULL
+ otherwise. */
+extern const char *get_exec_wrapper ();
+
+/* Return the name of the executable file as a string.
+ ERR nonzero means get error if there is none specified;
+ otherwise return 0 in that case. */
+extern char *get_exec_file (int err);
+
+#endif /* ! COMMON_INFERIOR_H */
diff --git a/gdb/common/common-utils.c b/gdb/common/common-utils.c
index e94fdc4..e75a1b9 100644
--- a/gdb/common/common-utils.c
+++ b/gdb/common/common-utils.c
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "common-defs.h"
+#include "common-utils.h"
#include "host-defs.h"
#include <ctype.h>
@@ -328,3 +329,26 @@ free_vector_argv (std::vector<char *> &v)
v.clear ();
}
+
+/* See common/common-utils.h. */
+
+std::string
+stringify_argv (const std::vector<char *> &args)
+{
+ std::string ret;
+
+ if (!args.empty () && args[0] != NULL)
+ {
+ for (auto s : args)
+ if (s != NULL)
+ {
+ ret += s;
+ ret += ' ';
+ }
+
+ /* Erase the last whitespace. */
+ ret.erase (ret.end () - 1);
+ }
+
+ return ret;
+}
diff --git a/gdb/common/common-utils.h b/gdb/common/common-utils.h
index c331f0d..787bac9 100644
--- a/gdb/common/common-utils.h
+++ b/gdb/common/common-utils.h
@@ -108,4 +108,8 @@ extern const char *skip_to_space_const (const char *inp);
freeing all the elements. */
extern void free_vector_argv (std::vector<char *> &v);
+/* Given a vector of arguments ARGV, return a string equivalent to
+ joining all the arguments with a whitespace separating them. */
+extern std::string stringify_argv (const std::vector<char *> &argv);
+
#endif
diff --git a/gdb/common/def-vector.h b/gdb/common/def-vector.h
new file mode 100644
index 0000000..ab9331f
--- /dev/null
+++ b/gdb/common/def-vector.h
@@ -0,0 +1,36 @@
+/* Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef COMMON_DEF_VECTOR_H
+#define COMMON_DEF_VECTOR_H
+
+#include <vector>
+#include "common/default-init-alloc.h"
+
+namespace gdb {
+
+/* A vector that uses an allocator that default constructs using
+ default-initialization rather than value-initialization. The idea
+ is to use this when you don't want zero-initialization of elements
+ of vectors of trivial types. E.g., byte buffers. */
+
+template<typename T> using def_vector
+ = std::vector<T, gdb::default_init_allocator<T>>;
+
+} /* namespace gdb */
+
+#endif /* COMMON_DEF_VECTOR_H */
diff --git a/gdb/common/default-init-alloc.h b/gdb/common/default-init-alloc.h
new file mode 100644
index 0000000..4fb852f
--- /dev/null
+++ b/gdb/common/default-init-alloc.h
@@ -0,0 +1,67 @@
+/* Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef COMMON_DEFAULT_INIT_ALLOC_H
+#define COMMON_DEFAULT_INIT_ALLOC_H
+
+namespace gdb {
+
+/* An allocator that default constructs using default-initialization
+ rather than value-initialization. The idea is to use this when you
+ don't want to default construct elements of containers of trivial
+ types using zero-initialization. */
+
+/* Mostly as implementation convenience, this is implemented as an
+ adapter that given an allocator A, overrides 'A::construct()'. 'A'
+ defaults to std::allocator<T>. */
+
+template<typename T, typename A = std::allocator<T>>
+class default_init_allocator : public A
+{
+public:
+ /* Pull in A's ctors. */
+ using A::A;
+
+ /* Override rebind. */
+ template<typename U>
+ struct rebind
+ {
+ /* A couple helpers just to make it a bit more readable. */
+ typedef std::allocator_traits<A> traits_;
+ typedef typename traits_::template rebind_alloc<U> alloc_;
+
+ /* This is what we're after. */
+ typedef default_init_allocator<U, alloc_> other;
+ };
+
+ /* Make the base allocator's construct method(s) visible. */
+ using A::construct;
+
+ /* .. and provide an override/overload for the case of default
+ construction (i.e., no arguments). This is where we construct
+ with default-init. */
+ template <typename U>
+ void construct (U *ptr)
+ noexcept (std::is_nothrow_default_constructible<U>::value)
+ {
+ ::new ((void *) ptr) U; /* default-init */
+ }
+};
+
+} /* namespace gdb */
+
+#endif /* COMMON_DEFAULT_INIT_ALLOC_H */
diff --git a/gdb/common/diagnostics.h b/gdb/common/diagnostics.h
new file mode 100644
index 0000000..d6ab698
--- /dev/null
+++ b/gdb/common/diagnostics.h
@@ -0,0 +1,56 @@
+/* Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef COMMON_DIAGNOSTICS_H
+#define COMMON_DIAGNOSTICS_H
+
+#include "common/preprocessor.h"
+
+#ifdef __GNUC__
+# define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push")
+# define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop")
+# define DIAGNOSTIC_IGNORE(option) \
+ _Pragma (STRINGIFY (GCC diagnostic ignored option))
+#else
+# define DIAGNOSTIC_PUSH
+# define DIAGNOSTIC_POP
+# define DIAGNOSTIC_IGNORE(option)
+#endif
+
+#if defined (__clang__) /* clang */
+
+# define DIAGNOSTIC_IGNORE_SELF_MOVE DIAGNOSTIC_IGNORE ("-Wself-move")
+# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER \
+ DIAGNOSTIC_IGNORE ("-Wdeprecated-register")
+# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
+ DIAGNOSTIC_IGNORE ("-Wunused-function")
+
+#elif defined (__GNUC__) /* GCC */
+
+# define DIAGNOSTIC_IGNORE_SELF_MOVE
+# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
+# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION \
+ DIAGNOSTIC_IGNORE ("-Wunused-function")
+
+#else /* Other compilers */
+
+# define DIAGNOSTIC_IGNORE_SELF_MOVE
+# define DIAGNOSTIC_IGNORE_DEPRECATED_REGISTER
+# define DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
+#endif
+
+#endif /* COMMON_DIAGNOSTICS_H */
diff --git a/gdb/common/environ.c b/gdb/common/environ.c
index 3145d01..698bda3 100644
--- a/gdb/common/environ.c
+++ b/gdb/common/environ.c
@@ -18,165 +18,119 @@
#include "common-defs.h"
#include "environ.h"
#include <algorithm>
-
+#include <utility>
-/* Return a new environment object. */
+/* See common/environ.h. */
-struct gdb_environ *
-make_environ (void)
+gdb_environ &
+gdb_environ::operator= (gdb_environ &&e)
{
- struct gdb_environ *e;
-
- e = XNEW (struct gdb_environ);
-
- e->allocated = 10;
- e->vector = (char **) xmalloc ((e->allocated + 1) * sizeof (char *));
- e->vector[0] = 0;
- return e;
+ /* Are we self-moving? */
+ if (&e == this)
+ return *this;
+
+ m_environ_vector = std::move (e.m_environ_vector);
+ e.m_environ_vector.clear ();
+ e.m_environ_vector.push_back (NULL);
+ return *this;
}
-/* Free an environment and all the strings in it. */
+/* See common/environ.h. */
-void
-free_environ (struct gdb_environ *e)
-{
- char **vector = e->vector;
-
- while (*vector)
- xfree (*vector++);
-
- xfree (e->vector);
- xfree (e);
-}
-
-/* Copy the environment given to this process into E.
- Also copies all the strings in it, so we can be sure
- that all strings in these environments are safe to free. */
-
-void
-init_environ (struct gdb_environ *e)
+gdb_environ gdb_environ::from_host_environ ()
{
extern char **environ;
- int i;
+ gdb_environ e;
if (environ == NULL)
- return;
-
- for (i = 0; environ[i]; i++) /*EMPTY */ ;
+ return e;
- if (e->allocated < i)
+ for (int i = 0; environ[i] != NULL; ++i)
{
- e->allocated = std::max (i, e->allocated + 10);
- e->vector = (char **) xrealloc ((char *) e->vector,
- (e->allocated + 1) * sizeof (char *));
+ /* Make sure we add the element before the last (NULL). */
+ e.m_environ_vector.insert (e.m_environ_vector.end () - 1,
+ xstrdup (environ[i]));
}
- memcpy (e->vector, environ, (i + 1) * sizeof (char *));
+ return e;
+}
- while (--i >= 0)
- {
- int len = strlen (e->vector[i]);
- char *newobj = (char *) xmalloc (len + 1);
+/* See common/environ.h. */
- memcpy (newobj, e->vector[i], len + 1);
- e->vector[i] = newobj;
- }
+void
+gdb_environ::clear ()
+{
+ for (char *v : m_environ_vector)
+ xfree (v);
+ m_environ_vector.clear ();
+ /* Always add the NULL element. */
+ m_environ_vector.push_back (NULL);
}
-/* Return the vector of environment E.
- This is used to get something to pass to execve. */
+/* Helper function to check if STRING contains an environment variable
+ assignment of VAR, i.e., if STRING starts with 'VAR='. Return true
+ if it contains, false otherwise. */
-char **
-environ_vector (struct gdb_environ *e)
+static bool
+match_var_in_string (char *string, const char *var, size_t var_len)
{
- return e->vector;
+ if (strncmp (string, var, var_len) == 0 && string[var_len] == '=')
+ return true;
+
+ return false;
}
-
-/* Return the value in environment E of variable VAR. */
-char *
-get_in_environ (const struct gdb_environ *e, const char *var)
+/* See common/environ.h. */
+
+const char *
+gdb_environ::get (const char *var) const
{
- int len = strlen (var);
- char **vector = e->vector;
- char *s;
+ size_t len = strlen (var);
- for (; (s = *vector) != NULL; vector++)
- if (strncmp (s, var, len) == 0 && s[len] == '=')
- return &s[len + 1];
+ for (char *el : m_environ_vector)
+ if (el != NULL && match_var_in_string (el, var, len))
+ return &el[len + 1];
- return 0;
+ return NULL;
}
-/* Store the value in E of VAR as VALUE. */
+/* See common/environ.h. */
void
-set_in_environ (struct gdb_environ *e, const char *var, const char *value)
+gdb_environ::set (const char *var, const char *value)
{
- int i;
- int len = strlen (var);
- char **vector = e->vector;
- char *s;
+ /* We have to unset the variable in the vector if it exists. */
+ unset (var);
- for (i = 0; (s = vector[i]) != NULL; i++)
- if (strncmp (s, var, len) == 0 && s[len] == '=')
- break;
-
- if (s == 0)
- {
- if (i == e->allocated)
- {
- e->allocated += 10;
- vector = (char **) xrealloc ((char *) vector,
- (e->allocated + 1) * sizeof (char *));
- e->vector = vector;
- }
- vector[i + 1] = 0;
- }
- else
- xfree (s);
-
- s = (char *) xmalloc (len + strlen (value) + 2);
- strcpy (s, var);
- strcat (s, "=");
- strcat (s, value);
- vector[i] = s;
-
- /* This used to handle setting the PATH and GNUTARGET variables
- specially. The latter has been replaced by "set gnutarget"
- (which has worked since GDB 4.11). The former affects searching
- the PATH to find SHELL, and searching the PATH to find the
- argument of "symbol-file" or "exec-file". Maybe we should have
- some kind of "set exec-path" for that. But in any event, having
- "set env" affect anything besides the inferior is a bad idea.
- What if we want to change the environment we pass to the program
- without afecting GDB's behavior? */
-
- return;
+ /* Insert the element before the last one, which is always NULL. */
+ m_environ_vector.insert (m_environ_vector.end () - 1,
+ concat (var, "=", value, NULL));
}
-/* Remove the setting for variable VAR from environment E. */
+/* See common/environ.h. */
void
-unset_in_environ (struct gdb_environ *e, const char *var)
+gdb_environ::unset (const char *var)
{
- int len = strlen (var);
- char **vector = e->vector;
- char *s;
+ size_t len = strlen (var);
+
+ /* We iterate until '.end () - 1' because the last element is
+ always NULL. */
+ for (std::vector<char *>::iterator el = m_environ_vector.begin ();
+ el != m_environ_vector.end () - 1;
+ ++el)
+ if (match_var_in_string (*el, var, len))
+ {
+ xfree (*el);
+ m_environ_vector.erase (el);
+ break;
+ }
+}
- for (; (s = *vector) != NULL; vector++)
- {
- if (strncmp (s, var, len) == 0 && s[len] == '=')
- {
- xfree (s);
- /* Walk through the vector, shuffling args down by one, including
- the NULL terminator. Can't use memcpy() here since the regions
- overlap, and memmove() might not be available. */
- while ((vector[0] = vector[1]) != NULL)
- {
- vector++;
- }
- break;
- }
- }
+/* See common/environ.h. */
+
+char **
+gdb_environ::envp () const
+{
+ return const_cast<char **> (&m_environ_vector[0]);
}
diff --git a/gdb/common/environ.h b/gdb/common/environ.h
index 3ace69e..0bbb191 100644
--- a/gdb/common/environ.h
+++ b/gdb/common/environ.h
@@ -17,33 +17,65 @@
#if !defined (ENVIRON_H)
#define ENVIRON_H 1
-/* We manipulate environments represented as these structures. */
+#include <vector>
-struct gdb_environ
+/* Class that represents the environment variables as seen by the
+ inferior. */
+
+class gdb_environ
+{
+public:
+ /* Regular constructor and destructor. */
+ gdb_environ ()
+ {
+ /* Make sure that the vector contains at least a NULL element.
+ If/when we add more variables to it, NULL will always be the
+ last element. */
+ m_environ_vector.push_back (NULL);
+ }
+
+ ~gdb_environ ()
{
- /* Number of usable slots allocated in VECTOR.
- VECTOR always has one slot not counted here,
- to hold the terminating zero. */
- int allocated;
- /* A vector of slots, ALLOCATED + 1 of them.
- The first few slots contain strings "VAR=VALUE"
- and the next one contains zero.
- Then come some unused slots. */
- char **vector;
- };
+ clear ();
+ }
+
+ /* Move constructor. */
+ gdb_environ (gdb_environ &&e)
+ : m_environ_vector (std::move (e.m_environ_vector))
+ {
+ /* Make sure that the moved-from vector is left at a valid
+ state (only one NULL element). */
+ e.m_environ_vector.clear ();
+ e.m_environ_vector.push_back (NULL);
+ }
+
+ /* Move assignment. */
+ gdb_environ &operator= (gdb_environ &&e);
-extern struct gdb_environ *make_environ (void);
+ /* Create a gdb_environ object using the host's environment
+ variables. */
+ static gdb_environ from_host_environ ();
-extern void free_environ (struct gdb_environ *);
+ /* Clear the environment variables stored in the object. */
+ void clear ();
-extern void init_environ (struct gdb_environ *);
+ /* Return the value in the environment for the variable VAR. The
+ returned pointer is only valid as long as the gdb_environ object
+ is not modified. */
+ const char *get (const char *var) const;
-extern char *get_in_environ (const struct gdb_environ *, const char *);
+ /* Store VAR=VALUE in the environment. */
+ void set (const char *var, const char *value);
-extern void set_in_environ (struct gdb_environ *, const char *, const char *);
+ /* Unset VAR in environment. */
+ void unset (const char *var);
-extern void unset_in_environ (struct gdb_environ *, const char *);
+ /* Return the environment vector represented as a 'char **'. */
+ char **envp () const;
-extern char **environ_vector (struct gdb_environ *);
+private:
+ /* A vector containing the environment variables. */
+ std::vector<char *> m_environ_vector;
+};
#endif /* defined (ENVIRON_H) */
diff --git a/gdb/common/job-control.c b/gdb/common/job-control.c
new file mode 100644
index 0000000..d76bc57
--- /dev/null
+++ b/gdb/common/job-control.c
@@ -0,0 +1,93 @@
+/* Job control and terminal related functions, for GDB and gdbserver
+ when running under Unix.
+
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "common-defs.h"
+#include "job-control.h"
+#include "gdb_termios.h"
+
+/* Nonzero if we have job control. */
+int job_control;
+
+/* Set the process group ID of the inferior.
+
+ Just using job_control only does part of it because setpgid or
+ setpgrp might not exist on a system without job control.
+
+ For a more clean implementation, in libiberty, put a setpgid which merely
+ calls setpgrp and a setpgrp which does nothing (any system with job control
+ will have one or the other). */
+
+int
+gdb_setpgid ()
+{
+ int retval = 0;
+
+ if (job_control)
+ {
+#if defined (HAVE_TERMIOS) || defined (TIOCGPGRP)
+#ifdef HAVE_SETPGID
+ /* The call setpgid (0, 0) is supposed to work and mean the same
+ thing as this, but on Ultrix 4.2A it fails with EPERM (and
+ setpgid (getpid (), getpid ()) succeeds). */
+ retval = setpgid (getpid (), getpid ());
+#else
+#ifdef HAVE_SETPGRP
+#ifdef SETPGRP_VOID
+ retval = setpgrp ();
+#else
+ retval = setpgrp (getpid (), getpid ());
+#endif
+#endif /* HAVE_SETPGRP */
+#endif /* HAVE_SETPGID */
+#endif /* defined (HAVE_TERMIOS) || defined (TIOCGPGRP) */
+ }
+
+ return retval;
+}
+
+/* See common/common-terminal.h. */
+
+void
+have_job_control ()
+{
+ /* OK, figure out whether we have job control. If neither termios nor
+ sgtty (i.e. termio or go32), leave job_control 0. */
+#if defined (HAVE_TERMIOS)
+ /* Do all systems with termios have the POSIX way of identifying job
+ control? I hope so. */
+#ifdef _POSIX_JOB_CONTROL
+ job_control = 1;
+#else
+#ifdef _SC_JOB_CONTROL
+ job_control = sysconf (_SC_JOB_CONTROL);
+#else
+ job_control = 0; /* Have to assume the worst. */
+#endif /* _SC_JOB_CONTROL */
+#endif /* _POSIX_JOB_CONTROL */
+#endif /* HAVE_TERMIOS */
+
+#ifdef HAVE_SGTTY
+#ifdef TIOCGPGRP
+ job_control = 1;
+#else
+ job_control = 0;
+#endif /* TIOCGPGRP */
+#endif /* sgtty */
+}
diff --git a/gdb/common/job-control.h b/gdb/common/job-control.h
new file mode 100644
index 0000000..9e284aa
--- /dev/null
+++ b/gdb/common/job-control.h
@@ -0,0 +1,38 @@
+/* Job control and terminal related functions, for GDB and gdbserver
+ when running under Unix.
+
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef JOB_CONTROL_H
+#define JOB_CONTROL_H
+
+/* Do we have job control? Can be assumed to always be the same
+ within a given run of GDB. Use in gdb/inflow.c and
+ common/common-inflow.c. */
+extern int job_control;
+
+/* Set the process group of the caller to its own pid, or do nothing
+ if we lack job control. */
+extern int gdb_setpgid ();
+
+/* Determine whether we have job control, and set variable JOB_CONTROL
+ accordingly. This function must be called before any use of
+ JOB_CONTROL. */
+extern void have_job_control ();
+
+#endif /* ! JOB_CONTROL_H */
diff --git a/gdb/common/preprocessor.h b/gdb/common/preprocessor.h
index 6877344..3543a90 100644
--- a/gdb/common/preprocessor.h
+++ b/gdb/common/preprocessor.h
@@ -24,6 +24,10 @@
#define CONCAT_1(a, b) a ## b
#define CONCAT(a, b) CONCAT_1 (a, b)
+/* Stringification. */
+#define STRINGIFY_1(x) #x
+#define STRINGIFY(x) STRINGIFY_1 (x)
+
/* Escape parens out. Useful if you need to pass an argument that
includes commas to another macro. */
#define ESC(...) __VA_ARGS__
diff --git a/gdb/common/vec.h b/gdb/common/vec.h
index 982f771..98d4576 100644
--- a/gdb/common/vec.h
+++ b/gdb/common/vec.h
@@ -20,6 +20,22 @@
#if !defined (GDB_VEC_H)
#define GDB_VEC_H
+#include "diagnostics.h"
+
+/* clang has a bug that makes it warn (-Wunused-function) about unused functions
+ that are the result of the DEF_VEC_* macro expansion. See:
+
+ https://bugs.llvm.org/show_bug.cgi?id=22712
+
+ We specifically ignore this warning for the vec functions when the compiler
+ is clang. */
+#ifdef __clang__
+# define DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION \
+ DIAGNOSTIC_IGNORE_UNUSED_FUNCTION
+#else
+# define DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION
+#endif
+
/* The macros here implement a set of templated vector types and
associated interfaces. These templates are implemented with
macros, as we're not in C++ land. The interface functions are
@@ -408,6 +424,8 @@ typedef struct VEC(T) \
/* Vector of integer-like object. */
#define DEF_VEC_I(T) \
+DIAGNOSTIC_PUSH \
+DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION \
static inline void VEC_OP (T,must_be_integral_type) (void) \
{ \
(void)~(T)0; \
@@ -416,10 +434,13 @@ static inline void VEC_OP (T,must_be_integral_type) (void) \
VEC_T(T); \
DEF_VEC_FUNC_P(T) \
DEF_VEC_ALLOC_FUNC_I(T) \
+DIAGNOSTIC_POP \
struct vec_swallow_trailing_semi
/* Vector of pointer to object. */
#define DEF_VEC_P(T) \
+DIAGNOSTIC_PUSH \
+DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION \
static inline void VEC_OP (T,must_be_pointer_type) (void) \
{ \
(void)((T)1 == (void *)1); \
@@ -428,13 +449,17 @@ static inline void VEC_OP (T,must_be_pointer_type) (void) \
VEC_T(T); \
DEF_VEC_FUNC_P(T) \
DEF_VEC_ALLOC_FUNC_P(T) \
+DIAGNOSTIC_POP \
struct vec_swallow_trailing_semi
/* Vector of object. */
#define DEF_VEC_O(T) \
+DIAGNOSTIC_PUSH \
+DIAGNOSTIC_IGNORE_UNUSED_VEC_FUNCTION \
VEC_T(T); \
DEF_VEC_FUNC_O(T) \
DEF_VEC_ALLOC_FUNC_O(T) \
+DIAGNOSTIC_POP \
struct vec_swallow_trailing_semi
/* Avoid offsetof (or its usual C implementation) as it triggers
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index a294105..3b8b15d 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -28,6 +28,7 @@
#include "macroscope.h"
#include "regcache.h"
#include "common/function-view.h"
+#include "common/preprocessor.h"
/* See compile-internal.h. */
@@ -65,8 +66,7 @@ c_get_range_decl_name (const struct dynamic_prop *prop)
return xstrprintf ("__gdb_prop_%s", host_address_to_string (prop));
}
-#define STR(x) #x
-#define STRINGIFY(x) STR(x)
+
/* Load the plug-in library FE_LIBCC and return the initialization function
FE_CONTEXT. */
diff --git a/gdb/compile/compile-cplus-types.c b/gdb/compile/compile-cplus-types.c
index a91ac5b..3663f9d 100644
--- a/gdb/compile/compile-cplus-types.c
+++ b/gdb/compile/compile-cplus-types.c
@@ -1788,9 +1788,6 @@ ccp_output_result (gcc_type result)
printf_unfiltered ("%lld\n", result);
}
-#define STR(x) #x
-#define STRINGIFY(x) STR(x)
-
#define DECLARE_FORWARD(OP,...) \
auto forward = [&] (const char *fmt, ...) \
{ \
diff --git a/gdb/configure b/gdb/configure
index 1f15d5d3..755e3dc 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -15151,7 +15151,8 @@ build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
--Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized"
+-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \
+-Wno-mismatched-tags"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
@@ -15222,9 +15223,9 @@ $as_echo_n "checking compiler warning flags... " >&6; }
*)
# Check whether GCC accepts it.
saved_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $wtest"
+ CFLAGS="$CFLAGS -Werror $wtest"
saved_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $wtest"
+ CXXFLAGS="$CXXFLAGS -Werror $wtest"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff --git a/gdb/configure.nat b/gdb/configure.nat
index e6c96da..2026ee7 100644
--- a/gdb/configure.nat
+++ b/gdb/configure.nat
@@ -54,7 +54,7 @@
case ${gdb_host} in
*linux*)
NAT_FILE='config/nm-linux.h'
- NATDEPFILES='inf-ptrace.o fork-child.o proc-service.o \
+ NATDEPFILES='inf-ptrace.o fork-child.o fork-inferior.o proc-service.o \
linux-thread-db.o linux-nat.o linux-osdata.o linux-fork.o \
linux-procfs.o linux-ptrace.o linux-waitpid.o \
linux-personality.o linux-namespaces.o'
@@ -62,15 +62,15 @@ case ${gdb_host} in
LOADLIBES='-ldl $(RDYNAMIC)'
;;
fbsd*)
- NATDEPFILES='fork-child.o inf-ptrace.o fbsd-nat.o'
+ NATDEPFILES='fork-child.o fork-inferior.o inf-ptrace.o fbsd-nat.o'
HAVE_NATIVE_GCORE_HOST=1
LOADLIBES='-lkvm'
;;
nbsd*)
- NATDEPFILES='fork-child.o inf-ptrace.o'
+ NATDEPFILES='fork-child.o fork-inferior.o inf-ptrace.o'
;;
obsd*)
- NATDEPFILES='fork-child.o inf-ptrace.o'
+ NATDEPFILES='fork-child.o fork-inferior.o inf-ptrace.o'
;;
cygwin*)
NATDEPFILES='x86-nat.o x86-dregs.o windows-nat.o'
@@ -78,6 +78,13 @@ case ${gdb_host} in
mingw*)
NATDEPFILES='x86-nat.o x86-dregs.o windows-nat.o'
;;
+ aix)
+ NATDEPFILES='fork-inferior.o fork-child.o inf-ptrace.o'
+ ;;
+ darwin)
+ NATDEPFILES='fork-child.o fork-inferior.o darwin-nat.o \
+ darwin-nat-info.o'
+ ;;
esac
# This is where we actually filter by host and host CPU.
@@ -88,7 +95,7 @@ case ${gdb_host} in
# Host: IBM PowerPC running AIX aix-thread.o is not
# listed in NATDEPFILES as it is pulled in by
# configure.
- NATDEPFILES='fork-child.o inf-ptrace.o rs6000-nat.o'
+ NATDEPFILES="${NATDEPFILES} rs6000-nat.o"
# When compiled with cc, for debugging, this argument
# should be passed. We have no idea who our current
@@ -130,9 +137,8 @@ case ${gdb_host} in
case ${gdb_host_cpu} in
i386)
# Host: IA86 running Darwin
- NATDEPFILES='fork-child.o darwin-nat.o \
- i386-darwin-nat.o x86-nat.o x86-dregs.o amd64-nat.o \
- darwin-nat-info.o'
+ NATDEPFILES="${NATDEPFILES} i386-darwin-nat.o x86-nat.o \
+ x86-dregs.o amd64-nat.o"
;;
esac
;;
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 13a90b9..33eb4d1 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -170,9 +170,7 @@ validate_files (void)
}
}
-/* Return the name of the executable file as a string.
- ERR nonzero means get error if there is none specified;
- otherwise return 0 in that case. */
+/* See common/common-inferior.h. */
char *
get_exec_file (int err)
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 8716cad..82e7013 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -1522,8 +1522,8 @@ ctf_get_traceframe_address (void)
struct tracepoint *tp
= get_tracepoint_by_number_on_target (tpnum);
- if (tp && tp->base.loc)
- addr = tp->base.loc->address;
+ if (tp && tp->loc)
+ addr = tp->loc->address;
}
/* Restore the position. */
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index cba84ca..cd67249 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -63,6 +63,7 @@
#include "darwin-nat.h"
#include "common/filestuff.h"
+#include "nat/fork-inferior.h"
/* Quick overview.
Darwin kernel is Mach + BSD derived kernel. Note that they share the
@@ -1790,7 +1791,7 @@ darwin_ptrace_him (int pid)
darwin_init_thread_list (inf);
- startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
+ gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
}
static void
@@ -1833,13 +1834,23 @@ darwin_create_inferior (struct target_ops *ops,
const std::string &allargs,
char **env, int from_tty)
{
+ pid_t pid;
+ ptid_t ptid;
+
/* Do the hard work. */
- fork_inferior (exec_file, allargs, env, darwin_ptrace_me, darwin_ptrace_him,
- darwin_pre_ptrace, NULL, darwin_execvp);
+ pid = fork_inferior (exec_file, allargs, env, darwin_ptrace_me,
+ darwin_ptrace_him, darwin_pre_ptrace, NULL,
+ darwin_execvp);
+ ptid = pid_to_ptid (pid);
/* Return now in case of error. */
if (ptid_equal (inferior_ptid, null_ptid))
return;
+
+ /* We have something that executes now. We'll be running through
+ the shell at this point (if startup-with-shell is true), but the
+ pid shouldn't change. */
+ add_thread_silent (ptid);
}
diff --git a/gdb/defs.h b/gdb/defs.h
index a1a97bb..55d16d1 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -82,6 +82,11 @@ enum compile_i_scope_types
COMPILE_I_PRINT_VALUE_SCOPE,
};
+
+template<typename T>
+using RequireLongest = gdb::Requires<gdb::Or<std::is_same<T, LONGEST>,
+ std::is_same<T, ULONGEST>>>;
+
/* Just in case they're not defined in stdio.h. */
#ifndef SEEK_SET
@@ -637,11 +642,22 @@ enum { MAX_REGISTER_SIZE = 64 };
/* In findvar.c. */
-extern LONGEST extract_signed_integer (const gdb_byte *, int,
- enum bfd_endian);
+template<typename T, typename = RequireLongest<T>>
+T extract_integer (const gdb_byte *addr, int len, enum bfd_endian byte_order);
-extern ULONGEST extract_unsigned_integer (const gdb_byte *, int,
- enum bfd_endian);
+static inline LONGEST
+extract_signed_integer (const gdb_byte *addr, int len,
+ enum bfd_endian byte_order)
+{
+ return extract_integer<LONGEST> (addr, len, byte_order);
+}
+
+static inline ULONGEST
+extract_unsigned_integer (const gdb_byte *addr, int len,
+ enum bfd_endian byte_order)
+{
+ return extract_integer<ULONGEST> (addr, len, byte_order);
+}
extern int extract_long_unsigned_integer (const gdb_byte *, int,
enum bfd_endian, LONGEST *);
@@ -649,11 +665,26 @@ extern int extract_long_unsigned_integer (const gdb_byte *, int,
extern CORE_ADDR extract_typed_address (const gdb_byte *buf,
struct type *type);
-extern void store_signed_integer (gdb_byte *, int,
- enum bfd_endian, LONGEST);
+/* All 'store' functions accept a host-format integer and store a
+ target-format integer at ADDR which is LEN bytes long. */
-extern void store_unsigned_integer (gdb_byte *, int,
- enum bfd_endian, ULONGEST);
+template<typename T, typename = RequireLongest<T>>
+extern void store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
+ T val);
+
+static inline void
+store_signed_integer (gdb_byte *addr, int len,
+ enum bfd_endian byte_order, LONGEST val)
+{
+ return store_integer (addr, len, byte_order, val);
+}
+
+static inline void
+store_unsigned_integer (gdb_byte *addr, int len,
+ enum bfd_endian byte_order, ULONGEST val)
+{
+ return store_integer (addr, len, byte_order, val);
+}
extern void store_typed_address (gdb_byte *buf, struct type *type,
CORE_ADDR addr);
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 000f3c8..8c7c3da 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,23 @@
+2017-06-20 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ PR gdb/21606
+ * python.texi (Python representation of Symbols.): Replace
+ SYMBOL_FUNCTION_DOMAIN by SYMBOL_FUNCTIONS_DOMAIN, fixing typo.
+ * guile.texi (Guile representation of Symbols.): Likewise.
+
+2017-06-11 Simon Marchi <simon.marchi@ericsson.com>
+
+ * gdb.texinfo (Optional Messages about Internal Happenings):
+ Document {set,show} debug separate-debug-file commands.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * gdb.texinfo (Starting) <startup-with-shell>: Add @anchor.
+ (Connecting) <Remote Packet>: Add "startup-with-shell"
+ and "QStartupWithShell" to the table.
+ (Remote Protocol) <QStartupWithShell>: New item, explaining the
+ packet.
+
2017-05-22 Andrew Burgess <andrew.burgess@embecosm.com>
* gdb.texinfo (Packets): Document vMustReplyEmpty packet.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index f42e2cf..2e16570 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -2153,6 +2153,7 @@ This command is available when debugging locally on most targets, excluding
@sc{djgpp}, Cygwin, MS Windows, and QNX Neutrino.
@kindex set startup-with-shell
+@anchor{set startup-with-shell}
@item set startup-with-shell
@itemx set startup-with-shell on
@itemx set startup-with-shell off
@@ -20835,6 +20836,10 @@ are:
@tab @code{QDisableRandomization}
@tab @code{set disable-randomization}
+@item @code{startup-with-shell}
+@tab @code{QStartupWithShell}
+@tab @code{set startup-with-shell}
+
@item @code{conditional-breakpoints-packet}
@tab @code{Z0 and Z1}
@tab @code{Support for target-side breakpoint condition evaluation}
@@ -24003,6 +24008,12 @@ the serial line to the remote machine. The info is printed on the
@value{GDBN} standard output stream. The default is off.
@item show debug remote
Displays the state of display of remote packets.
+
+@item set debug separate-debug-file
+Turns on or off display of debug output about separate debug file search.
+@item show debug separate-debug-file
+Displays the state of separate debug file search debug output.
+
@item set debug serial
Turns on or off display of @value{GDBN} serial debugging info. The
default is off.
@@ -36459,6 +36470,40 @@ by supplying an appropriate @samp{qSupported} response (@pxref{qSupported}).
This should only be done on targets that actually support disabling
address space randomization.
+@item QStartupWithShell:@var{value}
+@cindex startup with shell, remote request
+@cindex @samp{QStartupWithShell} packet
+On UNIX-like targets, it is possible to start the inferior using a
+shell program. This is the default behavior on both @value{GDBN} and
+@command{gdbserver} (@pxref{set startup-with-shell}). This packet is
+used to inform @command{gdbserver} whether it should start the
+inferior using a shell or not.
+
+If @var{value} is @samp{0}, @command{gdbserver} will not use a shell
+to start the inferior. If @var{value} is @samp{1},
+@command{gdbserver} will use a shell to start the inferior. All other
+values are considered an error.
+
+This packet is only available in extended mode (@pxref{extended
+mode}).
+
+Reply:
+@table @samp
+@item OK
+The request succeeded.
+
+@item E @var{nn}
+An error occurred. The error number @var{nn} is given as hex digits.
+@end table
+
+This packet is not probed by default; the remote stub must request it,
+by supplying an appropriate @samp{qSupported} response
+(@pxref{qSupported}). This should only be done on targets that
+actually support starting the inferior using a shell.
+
+Use of this packet is controlled by the @code{set startup-with-shell}
+command; @pxref{set startup-with-shell}.
+
@item qfThreadInfo
@itemx qsThreadInfo
@cindex list active threads, remote request
diff --git a/gdb/doc/guile.texi b/gdb/doc/guile.texi
index 9ae980e..0d41f11 100644
--- a/gdb/doc/guile.texi
+++ b/gdb/doc/guile.texi
@@ -2769,7 +2769,7 @@ This domain contains names of labels (for gotos).
This domain holds a subset of the @code{SYMBOLS_VAR_DOMAIN}; it
contains everything minus functions and types.
-@item SYMBOL_FUNCTION_DOMAIN
+@item SYMBOL_FUNCTIONS_DOMAIN
This domain contains all functions.
@item SYMBOL_TYPES_DOMAIN
diff --git a/gdb/doc/python.texi b/gdb/doc/python.texi
index ee4f7a2..32d7939 100644
--- a/gdb/doc/python.texi
+++ b/gdb/doc/python.texi
@@ -4559,7 +4559,7 @@ This domain holds a subset of the @code{SYMBOLS_VAR_DOMAIN}; it
contains everything minus functions and types.
@vindex SYMBOL_FUNCTIONS_DOMAIN
-@item gdb.SYMBOL_FUNCTION_DOMAIN
+@item gdb.SYMBOL_FUNCTIONS_DOMAIN
This domain contains all functions.
@vindex SYMBOL_TYPES_DOMAIN
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 122f8de..c611b16 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -421,7 +421,8 @@ dtrace_process_dof_probe (struct objfile *objfile,
arg.type_str = xstrdup (p);
/* Use strtab_size as a sentinel. */
- while (*p++ != '\0' && p - strtab < strtab_size);
+ while (*p++ != '\0' && p - strtab < strtab_size)
+ ;
/* Try to parse a type expression from the type string. If
this does not work then we set the type to `long
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 127167d..08b0aa2 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -43,6 +43,7 @@
#include <vector>
#include <unordered_set>
#include "common/underlying.h"
+#include "common/byte-vector.h"
extern int dwarf_always_disassemble;
@@ -1486,9 +1487,6 @@ struct piece_closure
/* The number of pieces used to describe this variable. */
int n_pieces;
- /* The target address size, used only for DWARF_VALUE_STACK. */
- int addr_size;
-
/* The pieces themselves. */
struct dwarf_expr_piece *pieces;
@@ -1503,7 +1501,7 @@ struct piece_closure
static struct piece_closure *
allocate_piece_closure (struct dwarf2_per_cu_data *per_cu,
int n_pieces, struct dwarf_expr_piece *pieces,
- int addr_size, struct frame_info *frame)
+ struct frame_info *frame)
{
struct piece_closure *c = XCNEW (struct piece_closure);
int i;
@@ -1511,7 +1509,6 @@ allocate_piece_closure (struct dwarf2_per_cu_data *per_cu,
c->refc = 1;
c->per_cu = per_cu;
c->n_pieces = n_pieces;
- c->addr_size = addr_size;
c->pieces = XCNEWVEC (struct dwarf_expr_piece, n_pieces);
if (frame == NULL)
c->frame_id = null_frame_id;
@@ -1756,76 +1753,81 @@ copy_bitwise_tests (void)
#endif /* GDB_SELF_TEST */
+/* Return the number of bytes overlapping a contiguous chunk of N_BITS
+ bits whose first bit is located at bit offset START. */
+
+static size_t
+bits_to_bytes (ULONGEST start, ULONGEST n_bits)
+{
+ return (start % 8 + n_bits + 7) / 8;
+}
+
+/* Read or write a pieced value V. If FROM != NULL, operate in "write
+ mode": copy FROM into the pieces comprising V. If FROM == NULL,
+ operate in "read mode": fetch the contents of the (lazy) value V by
+ composing it from its pieces. */
+
static void
-read_pieced_value (struct value *v)
+rw_pieced_value (struct value *v, struct value *from)
{
int i;
- long offset = 0;
+ LONGEST offset = 0, max_offset;
ULONGEST bits_to_skip;
- gdb_byte *contents;
+ gdb_byte *v_contents;
+ const gdb_byte *from_contents;
struct piece_closure *c
= (struct piece_closure *) value_computed_closure (v);
- size_t type_len;
- size_t buffer_size = 0;
- std::vector<gdb_byte> buffer;
+ gdb::byte_vector buffer;
int bits_big_endian
= gdbarch_bits_big_endian (get_type_arch (value_type (v)));
- if (value_type (v) != value_enclosing_type (v))
- internal_error (__FILE__, __LINE__,
- _("Should not be able to create a lazy value with "
- "an enclosing type"));
+ if (from != NULL)
+ {
+ from_contents = value_contents (from);
+ v_contents = NULL;
+ }
+ else
+ {
+ if (value_type (v) != value_enclosing_type (v))
+ internal_error (__FILE__, __LINE__,
+ _("Should not be able to create a lazy value with "
+ "an enclosing type"));
+ v_contents = value_contents_raw (v);
+ from_contents = NULL;
+ }
- contents = value_contents_raw (v);
bits_to_skip = 8 * value_offset (v);
if (value_bitsize (v))
{
- bits_to_skip += value_bitpos (v);
- type_len = value_bitsize (v);
+ bits_to_skip += (8 * value_offset (value_parent (v))
+ + value_bitpos (v));
+ if (from != NULL
+ && (gdbarch_byte_order (get_type_arch (value_type (from)))
+ == BFD_ENDIAN_BIG))
+ {
+ /* Use the least significant bits of FROM. */
+ max_offset = 8 * TYPE_LENGTH (value_type (from));
+ offset = max_offset - value_bitsize (v);
+ }
+ else
+ max_offset = value_bitsize (v);
}
else
- type_len = 8 * TYPE_LENGTH (value_type (v));
+ max_offset = 8 * TYPE_LENGTH (value_type (v));
+
+ /* Advance to the first non-skipped piece. */
+ for (i = 0; i < c->n_pieces && bits_to_skip >= c->pieces[i].size; i++)
+ bits_to_skip -= c->pieces[i].size;
- for (i = 0; i < c->n_pieces && offset < type_len; i++)
+ for (; i < c->n_pieces && offset < max_offset; i++)
{
struct dwarf_expr_piece *p = &c->pieces[i];
- size_t this_size, this_size_bits;
- long dest_offset_bits, source_offset_bits, source_offset;
- const gdb_byte *intermediate_buffer;
-
- /* Compute size, source, and destination offsets for copying, in
- bits. */
- this_size_bits = p->size;
- if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
- {
- bits_to_skip -= this_size_bits;
- continue;
- }
- if (bits_to_skip > 0)
- {
- dest_offset_bits = 0;
- source_offset_bits = bits_to_skip;
- this_size_bits -= bits_to_skip;
- bits_to_skip = 0;
- }
- else
- {
- dest_offset_bits = offset;
- source_offset_bits = 0;
- }
- if (this_size_bits > type_len - offset)
- this_size_bits = type_len - offset;
+ size_t this_size_bits, this_size;
- this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
- source_offset = source_offset_bits / 8;
- if (buffer_size < this_size)
- {
- buffer_size = this_size;
- buffer.reserve (buffer_size);
- }
- intermediate_buffer = buffer.data ();
+ this_size_bits = p->size - bits_to_skip;
+ if (this_size_bits > max_offset - offset)
+ this_size_bits = max_offset - offset;
- /* Copy from the source to DEST_BUFFER. */
switch (p->location)
{
case DWARF_VALUE_REGISTER:
@@ -1833,78 +1835,207 @@ read_pieced_value (struct value *v)
struct frame_info *frame = frame_find_by_id (c->frame_id);
struct gdbarch *arch = get_frame_arch (frame);
int gdb_regnum = dwarf_reg_to_regnum_or_error (arch, p->v.regno);
+ ULONGEST reg_bits = 8 * register_size (arch, gdb_regnum);
int optim, unavail;
- LONGEST reg_offset = source_offset;
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
- && this_size < register_size (arch, gdb_regnum))
+ && p->offset + p->size < reg_bits)
{
/* Big-endian, and we want less than full size. */
- reg_offset = register_size (arch, gdb_regnum) - this_size;
- /* We want the lower-order THIS_SIZE_BITS of the bytes
- we extract from the register. */
- source_offset_bits += 8 * this_size - this_size_bits;
+ bits_to_skip += reg_bits - (p->offset + p->size);
}
+ else
+ bits_to_skip += p->offset;
+
+ this_size = bits_to_bytes (bits_to_skip, this_size_bits);
+ buffer.resize (this_size);
- if (!get_frame_register_bytes (frame, gdb_regnum, reg_offset,
- this_size, buffer.data (),
- &optim, &unavail))
+ if (from == NULL)
{
- /* Just so garbage doesn't ever shine through. */
- memset (buffer.data (), 0, this_size);
+ /* Read mode. */
+ if (!get_frame_register_bytes (frame, gdb_regnum,
+ bits_to_skip / 8,
+ this_size, buffer.data (),
+ &optim, &unavail))
+ {
+ if (optim)
+ mark_value_bits_optimized_out (v, offset,
+ this_size_bits);
+ if (unavail)
+ mark_value_bits_unavailable (v, offset,
+ this_size_bits);
+ break;
+ }
+
+ copy_bitwise (v_contents, offset,
+ buffer.data (), bits_to_skip % 8,
+ this_size_bits, bits_big_endian);
+ }
+ else
+ {
+ /* Write mode. */
+ if (bits_to_skip % 8 != 0 || this_size_bits % 8 != 0)
+ {
+ /* Data is copied non-byte-aligned into the register.
+ Need some bits from original register value. */
+ get_frame_register_bytes (frame, gdb_regnum,
+ bits_to_skip / 8,
+ this_size, buffer.data (),
+ &optim, &unavail);
+ if (optim)
+ throw_error (OPTIMIZED_OUT_ERROR,
+ _("Can't do read-modify-write to "
+ "update bitfield; containing word "
+ "has been optimized out"));
+ if (unavail)
+ throw_error (NOT_AVAILABLE_ERROR,
+ _("Can't do read-modify-write to "
+ "update bitfield; containing word "
+ "is unavailable"));
+ }
- if (optim)
- mark_value_bits_optimized_out (v, offset, this_size_bits);
- if (unavail)
- mark_value_bits_unavailable (v, offset, this_size_bits);
+ copy_bitwise (buffer.data (), bits_to_skip % 8,
+ from_contents, offset,
+ this_size_bits, bits_big_endian);
+ put_frame_register_bytes (frame, gdb_regnum,
+ bits_to_skip / 8,
+ this_size, buffer.data ());
}
}
break;
case DWARF_VALUE_MEMORY:
- read_value_memory (v, offset,
- p->v.mem.in_stack_memory,
- p->v.mem.addr + source_offset,
- buffer.data (), this_size);
- break;
-
- case DWARF_VALUE_STACK:
{
- size_t n = this_size;
+ bits_to_skip += p->offset;
+
+ CORE_ADDR start_addr = p->v.mem.addr + bits_to_skip / 8;
+
+ if (bits_to_skip % 8 == 0 && this_size_bits % 8 == 0
+ && offset % 8 == 0)
+ {
+ /* Everything is byte-aligned; no buffer needed. */
+ if (from != NULL)
+ write_memory_with_notification (start_addr,
+ (from_contents
+ + offset / 8),
+ this_size_bits / 8);
+ else
+ read_value_memory (v, offset,
+ p->v.mem.in_stack_memory,
+ p->v.mem.addr + bits_to_skip / 8,
+ v_contents + offset / 8,
+ this_size_bits / 8);
+ break;
+ }
+
+ this_size = bits_to_bytes (bits_to_skip, this_size_bits);
+ buffer.resize (this_size);
- if (n > c->addr_size - source_offset)
- n = (c->addr_size >= source_offset
- ? c->addr_size - source_offset
- : 0);
- if (n == 0)
+ if (from == NULL)
{
- /* Nothing. */
+ /* Read mode. */
+ read_value_memory (v, offset,
+ p->v.mem.in_stack_memory,
+ p->v.mem.addr + bits_to_skip / 8,
+ buffer.data (), this_size);
+ copy_bitwise (v_contents, offset,
+ buffer.data (), bits_to_skip % 8,
+ this_size_bits, bits_big_endian);
}
else
{
- const gdb_byte *val_bytes = value_contents_all (p->v.value);
+ /* Write mode. */
+ if (bits_to_skip % 8 != 0 || this_size_bits % 8 != 0)
+ {
+ if (this_size <= 8)
+ {
+ /* Perform a single read for small sizes. */
+ read_memory (start_addr, buffer.data (),
+ this_size);
+ }
+ else
+ {
+ /* Only the first and last bytes can possibly have
+ any bits reused. */
+ read_memory (start_addr, buffer.data (), 1);
+ read_memory (start_addr + this_size - 1,
+ &buffer[this_size - 1], 1);
+ }
+ }
- intermediate_buffer = val_bytes + source_offset;
+ copy_bitwise (buffer.data (), bits_to_skip % 8,
+ from_contents, offset,
+ this_size_bits, bits_big_endian);
+ write_memory_with_notification (start_addr,
+ buffer.data (),
+ this_size);
}
}
break;
+ case DWARF_VALUE_STACK:
+ {
+ if (from != NULL)
+ {
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
+ break;
+ }
+
+ struct objfile *objfile = dwarf2_per_cu_objfile (c->per_cu);
+ struct gdbarch *objfile_gdbarch = get_objfile_arch (objfile);
+ ULONGEST stack_value_size_bits
+ = 8 * TYPE_LENGTH (value_type (p->v.value));
+
+ /* Use zeroes if piece reaches beyond stack value. */
+ if (p->offset + p->size > stack_value_size_bits)
+ break;
+
+ /* Piece is anchored at least significant bit end. */
+ if (gdbarch_byte_order (objfile_gdbarch) == BFD_ENDIAN_BIG)
+ bits_to_skip += stack_value_size_bits - p->offset - p->size;
+ else
+ bits_to_skip += p->offset;
+
+ copy_bitwise (v_contents, offset,
+ value_contents_all (p->v.value),
+ bits_to_skip,
+ this_size_bits, bits_big_endian);
+ }
+ break;
+
case DWARF_VALUE_LITERAL:
{
- size_t n = this_size;
-
- if (n > p->v.literal.length - source_offset)
- n = (p->v.literal.length >= source_offset
- ? p->v.literal.length - source_offset
- : 0);
- if (n != 0)
- intermediate_buffer = p->v.literal.data + source_offset;
+ if (from != NULL)
+ {
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
+ break;
+ }
+
+ ULONGEST literal_size_bits = 8 * p->v.literal.length;
+ size_t n = this_size_bits;
+
+ /* Cut off at the end of the implicit value. */
+ bits_to_skip += p->offset;
+ if (bits_to_skip >= literal_size_bits)
+ break;
+ if (n > literal_size_bits - bits_to_skip)
+ n = literal_size_bits - bits_to_skip;
+
+ copy_bitwise (v_contents, offset,
+ p->v.literal.data, bits_to_skip,
+ n, bits_big_endian);
}
break;
- /* These bits show up as zeros -- but do not cause the value
- to be considered optimized-out. */
case DWARF_VALUE_IMPLICIT_POINTER:
+ if (from != NULL)
+ {
+ mark_value_bits_optimized_out (v, offset, this_size_bits);
+ break;
+ }
+
+ /* These bits show up as zeros -- but do not cause the value to
+ be considered optimized-out. */
break;
case DWARF_VALUE_OPTIMIZED_OUT:
@@ -1915,157 +2046,22 @@ read_pieced_value (struct value *v)
internal_error (__FILE__, __LINE__, _("invalid location type"));
}
- if (p->location != DWARF_VALUE_OPTIMIZED_OUT
- && p->location != DWARF_VALUE_IMPLICIT_POINTER)
- copy_bitwise (contents, dest_offset_bits,
- intermediate_buffer, source_offset_bits % 8,
- this_size_bits, bits_big_endian);
-
offset += this_size_bits;
+ bits_to_skip = 0;
}
}
+
static void
-write_pieced_value (struct value *to, struct value *from)
+read_pieced_value (struct value *v)
{
- int i;
- long offset = 0;
- ULONGEST bits_to_skip;
- const gdb_byte *contents;
- struct piece_closure *c
- = (struct piece_closure *) value_computed_closure (to);
- size_t type_len;
- size_t buffer_size = 0;
- std::vector<gdb_byte> buffer;
- int bits_big_endian
- = gdbarch_bits_big_endian (get_type_arch (value_type (to)));
-
- contents = value_contents (from);
- bits_to_skip = 8 * value_offset (to);
- if (value_bitsize (to))
- {
- bits_to_skip += value_bitpos (to);
- type_len = value_bitsize (to);
- }
- else
- type_len = 8 * TYPE_LENGTH (value_type (to));
-
- for (i = 0; i < c->n_pieces && offset < type_len; i++)
- {
- struct dwarf_expr_piece *p = &c->pieces[i];
- size_t this_size_bits, this_size;
- long dest_offset_bits, source_offset_bits, dest_offset, source_offset;
- int need_bitwise;
- const gdb_byte *source_buffer;
-
- this_size_bits = p->size;
- if (bits_to_skip > 0 && bits_to_skip >= this_size_bits)
- {
- bits_to_skip -= this_size_bits;
- continue;
- }
- if (this_size_bits > type_len - offset)
- this_size_bits = type_len - offset;
- if (bits_to_skip > 0)
- {
- dest_offset_bits = bits_to_skip;
- source_offset_bits = 0;
- this_size_bits -= bits_to_skip;
- bits_to_skip = 0;
- }
- else
- {
- dest_offset_bits = 0;
- source_offset_bits = offset;
- }
-
- this_size = (this_size_bits + source_offset_bits % 8 + 7) / 8;
- source_offset = source_offset_bits / 8;
- dest_offset = dest_offset_bits / 8;
- if (dest_offset_bits % 8 == 0 && source_offset_bits % 8 == 0)
- {
- source_buffer = contents + source_offset;
- need_bitwise = 0;
- }
- else
- {
- if (buffer_size < this_size)
- {
- buffer_size = this_size;
- buffer.reserve (buffer_size);
- }
- source_buffer = buffer.data ();
- need_bitwise = 1;
- }
-
- switch (p->location)
- {
- case DWARF_VALUE_REGISTER:
- {
- struct frame_info *frame = frame_find_by_id (c->frame_id);
- struct gdbarch *arch = get_frame_arch (frame);
- int gdb_regnum = dwarf_reg_to_regnum_or_error (arch, p->v.regno);
- int reg_offset = dest_offset;
-
- if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG
- && this_size <= register_size (arch, gdb_regnum))
- {
- /* Big-endian, and we want less than full size. */
- reg_offset = register_size (arch, gdb_regnum) - this_size;
- }
-
- if (need_bitwise)
- {
- int optim, unavail;
-
- if (!get_frame_register_bytes (frame, gdb_regnum, reg_offset,
- this_size, buffer.data (),
- &optim, &unavail))
- {
- if (optim)
- throw_error (OPTIMIZED_OUT_ERROR,
- _("Can't do read-modify-write to "
- "update bitfield; containing word "
- "has been optimized out"));
- if (unavail)
- throw_error (NOT_AVAILABLE_ERROR,
- _("Can't do read-modify-write to update "
- "bitfield; containing word "
- "is unavailable"));
- }
- copy_bitwise (buffer.data (), dest_offset_bits,
- contents, source_offset_bits,
- this_size_bits,
- bits_big_endian);
- }
-
- put_frame_register_bytes (frame, gdb_regnum, reg_offset,
- this_size, source_buffer);
- }
- break;
- case DWARF_VALUE_MEMORY:
- if (need_bitwise)
- {
- /* Only the first and last bytes can possibly have any
- bits reused. */
- read_memory (p->v.mem.addr + dest_offset, buffer.data (), 1);
- read_memory (p->v.mem.addr + dest_offset + this_size - 1,
- &buffer[this_size - 1], 1);
- copy_bitwise (buffer.data (), dest_offset_bits,
- contents, source_offset_bits,
- this_size_bits,
- bits_big_endian);
- }
+ rw_pieced_value (v, NULL);
+}
- write_memory (p->v.mem.addr + dest_offset,
- source_buffer, this_size);
- break;
- default:
- mark_value_bytes_optimized_out (to, 0, TYPE_LENGTH (value_type (to)));
- break;
- }
- offset += this_size_bits;
- }
+static void
+write_pieced_value (struct value *to, struct value *from)
+{
+ rw_pieced_value (to, from);
}
/* An implementation of an lval_funcs method to see whether a value is
@@ -2411,7 +2407,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
invalid_synthetic_pointer ();
c = allocate_piece_closure (per_cu, ctx.num_pieces, ctx.pieces,
- ctx.addr_size, frame);
+ frame);
/* We must clean up the value chain after creating the piece
closure but before allocating the result. */
free_values.free_to_mark ();
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 276ed0d..696c354 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -73,10 +73,13 @@
#include "common/function-view.h"
#include "common/gdb_optional.h"
#include "common/underlying.h"
+#include "common/byte-vector.h"
#include <fcntl.h>
#include <sys/types.h>
#include <algorithm>
+#include <unordered_set>
+#include <unordered_map>
typedef struct symbol *symbolp;
DEF_VEC_P (symbolp);
@@ -2165,7 +2168,7 @@ byte_swap (offset_type value)
#define MAYBE_SWAP(V) byte_swap (V)
#else
-#define MAYBE_SWAP(V) (V)
+#define MAYBE_SWAP(V) static_cast<offset_type> (V)
#endif /* WORDS_BIGENDIAN */
/* Read the given attribute value as an address, taking the attribute's
@@ -23582,69 +23585,58 @@ dwarf2_per_objfile_free (struct objfile *objfile, void *d)
/* The "save gdb-index" command. */
-/* The contents of the hash table we create when building the string
- table. */
-struct strtab_entry
+/* In-memory buffer to prepare data to be written later to a file. */
+class data_buf
{
- offset_type offset;
- const char *str;
-};
-
-/* Hash function for a strtab_entry.
-
- Function is used only during write_hash_table so no index format backward
- compatibility is needed. */
-
-static hashval_t
-hash_strtab_entry (const void *e)
-{
- const struct strtab_entry *entry = (const struct strtab_entry *) e;
- return mapped_index_string_hash (INT_MAX, entry->str);
-}
-
-/* Equality function for a strtab_entry. */
+public:
+ /* Copy DATA to the end of the buffer. */
+ template<typename T>
+ void append_data (const T &data)
+ {
+ std::copy (reinterpret_cast<const gdb_byte *> (&data),
+ reinterpret_cast<const gdb_byte *> (&data + 1),
+ grow (sizeof (data)));
+ }
-static int
-eq_strtab_entry (const void *a, const void *b)
-{
- const struct strtab_entry *ea = (const struct strtab_entry *) a;
- const struct strtab_entry *eb = (const struct strtab_entry *) b;
- return !strcmp (ea->str, eb->str);
-}
+ /* Copy CSTR (a zero-terminated string) to the end of buffer. The
+ terminating zero is appended too. */
+ void append_cstr0 (const char *cstr)
+ {
+ const size_t size = strlen (cstr) + 1;
+ std::copy (cstr, cstr + size, grow (size));
+ }
-/* Create a strtab_entry hash table. */
+ /* Accept a host-format integer in VAL and append it to the buffer
+ as a target-format integer which is LEN bytes long. */
+ void append_uint (size_t len, bfd_endian byte_order, ULONGEST val)
+ {
+ ::store_unsigned_integer (grow (len), len, byte_order, val);
+ }
-static htab_t
-create_strtab (void)
-{
- return htab_create_alloc (100, hash_strtab_entry, eq_strtab_entry,
- xfree, xcalloc, xfree);
-}
+ /* Return the size of the buffer. */
+ size_t size () const
+ {
+ return m_vec.size ();
+ }
-/* Add a string to the constant pool. Return the string's offset in
- host order. */
+ /* Write the buffer to FILE. */
+ void file_write (FILE *file) const
+ {
+ if (::fwrite (m_vec.data (), 1, m_vec.size (), file) != m_vec.size ())
+ error (_("couldn't write data to file"));
+ }
-static offset_type
-add_string (htab_t table, struct obstack *cpool, const char *str)
-{
- void **slot;
- struct strtab_entry entry;
- struct strtab_entry *result;
+private:
+ /* Grow SIZE bytes at the end of the buffer. Returns a pointer to
+ the start of the new block. */
+ gdb_byte *grow (size_t size)
+ {
+ m_vec.resize (m_vec.size () + size);
+ return &*m_vec.end () - size;
+ }
- entry.str = str;
- slot = htab_find_slot (table, &entry, INSERT);
- if (*slot)
- result = (struct strtab_entry *) *slot;
- else
- {
- result = XNEW (struct strtab_entry);
- result->offset = obstack_object_size (cpool);
- result->str = str;
- obstack_grow_str0 (cpool, str);
- *slot = result;
- }
- return result->offset;
-}
+ gdb::byte_vector m_vec;
+};
/* An entry in the symbol table. */
struct symtab_index_entry
@@ -23655,107 +23647,41 @@ struct symtab_index_entry
offset_type index_offset;
/* A sorted vector of the indices of all the CUs that hold an object
of this name. */
- VEC (offset_type) *cu_indices;
+ std::vector<offset_type> cu_indices;
};
/* The symbol table. This is a power-of-2-sized hash table. */
struct mapped_symtab
{
- offset_type n_elements;
- offset_type size;
- struct symtab_index_entry **data;
-};
-
-/* Hash function for a symtab_index_entry. */
-
-static hashval_t
-hash_symtab_entry (const void *e)
-{
- const struct symtab_index_entry *entry
- = (const struct symtab_index_entry *) e;
- return iterative_hash (VEC_address (offset_type, entry->cu_indices),
- sizeof (offset_type) * VEC_length (offset_type,
- entry->cu_indices),
- 0);
-}
-
-/* Equality function for a symtab_index_entry. */
-
-static int
-eq_symtab_entry (const void *a, const void *b)
-{
- const struct symtab_index_entry *ea = (const struct symtab_index_entry *) a;
- const struct symtab_index_entry *eb = (const struct symtab_index_entry *) b;
- int len = VEC_length (offset_type, ea->cu_indices);
- if (len != VEC_length (offset_type, eb->cu_indices))
- return 0;
- return !memcmp (VEC_address (offset_type, ea->cu_indices),
- VEC_address (offset_type, eb->cu_indices),
- sizeof (offset_type) * len);
-}
-
-/* Destroy a symtab_index_entry. */
-
-static void
-delete_symtab_entry (void *p)
-{
- struct symtab_index_entry *entry = (struct symtab_index_entry *) p;
- VEC_free (offset_type, entry->cu_indices);
- xfree (entry);
-}
-
-/* Create a hash table holding symtab_index_entry objects. */
-
-static htab_t
-create_symbol_hash_table (void)
-{
- return htab_create_alloc (100, hash_symtab_entry, eq_symtab_entry,
- delete_symtab_entry, xcalloc, xfree);
-}
-
-/* Create a new mapped symtab object. */
-
-static struct mapped_symtab *
-create_mapped_symtab (void)
-{
- struct mapped_symtab *symtab = XNEW (struct mapped_symtab);
- symtab->n_elements = 0;
- symtab->size = 1024;
- symtab->data = XCNEWVEC (struct symtab_index_entry *, symtab->size);
- return symtab;
-}
-
-/* Destroy a mapped_symtab. */
+ mapped_symtab ()
+ {
+ data.resize (1024);
+ }
-static void
-cleanup_mapped_symtab (void *p)
-{
- struct mapped_symtab *symtab = (struct mapped_symtab *) p;
- /* The contents of the array are freed when the other hash table is
- destroyed. */
- xfree (symtab->data);
- xfree (symtab);
-}
+ offset_type n_elements = 0;
+ std::vector<symtab_index_entry> data;
+};
-/* Find a slot in SYMTAB for the symbol NAME. Returns a pointer to
+/* Find a slot in SYMTAB for the symbol NAME. Returns a reference to
the slot.
Function is used only during write_hash_table so no index format backward
compatibility is needed. */
-static struct symtab_index_entry **
+static symtab_index_entry &
find_slot (struct mapped_symtab *symtab, const char *name)
{
offset_type index, step, hash = mapped_index_string_hash (INT_MAX, name);
- index = hash & (symtab->size - 1);
- step = ((hash * 17) & (symtab->size - 1)) | 1;
+ index = hash & (symtab->data.size () - 1);
+ step = ((hash * 17) & (symtab->data.size () - 1)) | 1;
for (;;)
{
- if (!symtab->data[index] || !strcmp (name, symtab->data[index]->name))
- return &symtab->data[index];
- index = (index + step) & (symtab->size - 1);
+ if (symtab->data[index].name == NULL
+ || strcmp (name, symtab->data[index].name) == 0)
+ return symtab->data[index];
+ index = (index + step) & (symtab->data.size () - 1);
}
}
@@ -23764,24 +23690,17 @@ find_slot (struct mapped_symtab *symtab, const char *name)
static void
hash_expand (struct mapped_symtab *symtab)
{
- offset_type old_size = symtab->size;
- offset_type i;
- struct symtab_index_entry **old_entries = symtab->data;
-
- symtab->size *= 2;
- symtab->data = XCNEWVEC (struct symtab_index_entry *, symtab->size);
+ auto old_entries = std::move (symtab->data);
- for (i = 0; i < old_size; ++i)
- {
- if (old_entries[i])
- {
- struct symtab_index_entry **slot = find_slot (symtab,
- old_entries[i]->name);
- *slot = old_entries[i];
- }
- }
+ symtab->data.clear ();
+ symtab->data.resize (old_entries.size () * 2);
- xfree (old_entries);
+ for (auto &it : old_entries)
+ if (it.name != NULL)
+ {
+ auto &ref = find_slot (symtab, it.name);
+ ref = std::move (it);
+ }
}
/* Add an entry to SYMTAB. NAME is the name of the symbol.
@@ -23793,20 +23712,17 @@ add_index_entry (struct mapped_symtab *symtab, const char *name,
int is_static, gdb_index_symbol_kind kind,
offset_type cu_index)
{
- struct symtab_index_entry **slot;
offset_type cu_index_and_attrs;
++symtab->n_elements;
- if (4 * symtab->n_elements / 3 >= symtab->size)
+ if (4 * symtab->n_elements / 3 >= symtab->data.size ())
hash_expand (symtab);
- slot = find_slot (symtab, name);
- if (!*slot)
+ symtab_index_entry &slot = find_slot (symtab, name);
+ if (slot.name == NULL)
{
- *slot = XNEW (struct symtab_index_entry);
- (*slot)->name = name;
+ slot.name = name;
/* index_offset is set later. */
- (*slot)->cu_indices = NULL;
}
cu_index_and_attrs = 0;
@@ -23821,18 +23737,7 @@ add_index_entry (struct mapped_symtab *symtab, const char *name,
the last entry pushed), but a symbol could have multiple kinds in one CU.
To keep things simple we don't worry about the duplication here and
sort and uniqufy the list after we've processed all symbols. */
- VEC_safe_push (offset_type, (*slot)->cu_indices, cu_index_and_attrs);
-}
-
-/* qsort helper routine for uniquify_cu_indices. */
-
-static int
-offset_type_compare (const void *ap, const void *bp)
-{
- offset_type a = *(offset_type *) ap;
- offset_type b = *(offset_type *) bp;
-
- return (a > b) - (b > a);
+ slot.cu_indices.push_back (cu_index_and_attrs);
}
/* Sort and remove duplicates of all symbols' cu_indices lists. */
@@ -23840,112 +23745,116 @@ offset_type_compare (const void *ap, const void *bp)
static void
uniquify_cu_indices (struct mapped_symtab *symtab)
{
- int i;
-
- for (i = 0; i < symtab->size; ++i)
+ for (auto &entry : symtab->data)
{
- struct symtab_index_entry *entry = symtab->data[i];
-
- if (entry
- && entry->cu_indices != NULL)
+ if (entry.name != NULL && !entry.cu_indices.empty ())
{
- unsigned int next_to_insert, next_to_check;
- offset_type last_value;
-
- qsort (VEC_address (offset_type, entry->cu_indices),
- VEC_length (offset_type, entry->cu_indices),
- sizeof (offset_type), offset_type_compare);
-
- last_value = VEC_index (offset_type, entry->cu_indices, 0);
- next_to_insert = 1;
- for (next_to_check = 1;
- next_to_check < VEC_length (offset_type, entry->cu_indices);
- ++next_to_check)
- {
- if (VEC_index (offset_type, entry->cu_indices, next_to_check)
- != last_value)
- {
- last_value = VEC_index (offset_type, entry->cu_indices,
- next_to_check);
- VEC_replace (offset_type, entry->cu_indices, next_to_insert,
- last_value);
- ++next_to_insert;
- }
- }
- VEC_truncate (offset_type, entry->cu_indices, next_to_insert);
+ auto &cu_indices = entry.cu_indices;
+ std::sort (cu_indices.begin (), cu_indices.end ());
+ auto from = std::unique (cu_indices.begin (), cu_indices.end ());
+ cu_indices.erase (from, cu_indices.end ());
}
}
}
-/* Add a vector of indices to the constant pool. */
-
-static offset_type
-add_indices_to_cpool (htab_t symbol_hash_table, struct obstack *cpool,
- struct symtab_index_entry *entry)
+/* A form of 'const char *' suitable for container keys. Only the
+ pointer is stored. The strings themselves are compared, not the
+ pointers. */
+class c_str_view
{
- void **slot;
+public:
+ c_str_view (const char *cstr)
+ : m_cstr (cstr)
+ {}
- slot = htab_find_slot (symbol_hash_table, entry, INSERT);
- if (!*slot)
- {
- offset_type len = VEC_length (offset_type, entry->cu_indices);
- offset_type val = MAYBE_SWAP (len);
- offset_type iter;
- int i;
+ bool operator== (const c_str_view &other) const
+ {
+ return strcmp (m_cstr, other.m_cstr) == 0;
+ }
- *slot = entry;
- entry->index_offset = obstack_object_size (cpool);
+private:
+ friend class c_str_view_hasher;
+ const char *const m_cstr;
+};
- obstack_grow (cpool, &val, sizeof (val));
- for (i = 0;
- VEC_iterate (offset_type, entry->cu_indices, i, iter);
- ++i)
- {
- val = MAYBE_SWAP (iter);
- obstack_grow (cpool, &val, sizeof (val));
- }
- }
- else
- {
- struct symtab_index_entry *old_entry
- = (struct symtab_index_entry *) *slot;
- entry->index_offset = old_entry->index_offset;
- entry = old_entry;
- }
- return entry->index_offset;
-}
+/* A std::unordered_map::hasher for c_str_view that uses the right
+ hash function for strings in a mapped index. */
+class c_str_view_hasher
+{
+public:
+ size_t operator () (const c_str_view &x) const
+ {
+ return mapped_index_string_hash (INT_MAX, x.m_cstr);
+ }
+};
+
+/* A std::unordered_map::hasher for std::vector<>. */
+template<typename T>
+class vector_hasher
+{
+public:
+ size_t operator () (const std::vector<T> &key) const
+ {
+ return iterative_hash (key.data (),
+ sizeof (key.front ()) * key.size (), 0);
+ }
+};
-/* Write the mapped hash table SYMTAB to the obstack OUTPUT, with
- constant pool entries going into the obstack CPOOL. */
+/* Write the mapped hash table SYMTAB to the data buffer OUTPUT, with
+ constant pool entries going into the data buffer CPOOL. */
static void
-write_hash_table (struct mapped_symtab *symtab,
- struct obstack *output, struct obstack *cpool)
+write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool)
{
- offset_type i;
- htab_t symbol_hash_table;
- htab_t str_table;
-
- symbol_hash_table = create_symbol_hash_table ();
- str_table = create_strtab ();
+ {
+ /* Elements are sorted vectors of the indices of all the CUs that
+ hold an object of this name. */
+ std::unordered_map<std::vector<offset_type>, offset_type,
+ vector_hasher<offset_type>>
+ symbol_hash_table;
+
+ /* We add all the index vectors to the constant pool first, to
+ ensure alignment is ok. */
+ for (symtab_index_entry &entry : symtab->data)
+ {
+ if (entry.name == NULL)
+ continue;
+ gdb_assert (entry.index_offset == 0);
+
+ /* Finding before inserting is faster than always trying to
+ insert, because inserting always allocates a node, does the
+ lookup, and then destroys the new node if another node
+ already had the same key. C++17 try_emplace will avoid
+ this. */
+ const auto found
+ = symbol_hash_table.find (entry.cu_indices);
+ if (found != symbol_hash_table.end ())
+ {
+ entry.index_offset = found->second;
+ continue;
+ }
- /* We add all the index vectors to the constant pool first, to
- ensure alignment is ok. */
- for (i = 0; i < symtab->size; ++i)
- {
- if (symtab->data[i])
- add_indices_to_cpool (symbol_hash_table, cpool, symtab->data[i]);
- }
+ symbol_hash_table.emplace (entry.cu_indices, cpool.size ());
+ entry.index_offset = cpool.size ();
+ cpool.append_data (MAYBE_SWAP (entry.cu_indices.size ()));
+ for (const auto index : entry.cu_indices)
+ cpool.append_data (MAYBE_SWAP (index));
+ }
+ }
/* Now write out the hash table. */
- for (i = 0; i < symtab->size; ++i)
+ std::unordered_map<c_str_view, offset_type, c_str_view_hasher> str_table;
+ for (const auto &entry : symtab->data)
{
offset_type str_off, vec_off;
- if (symtab->data[i])
+ if (entry.name != NULL)
{
- str_off = add_string (str_table, cpool, symtab->data[i]->name);
- vec_off = symtab->data[i]->index_offset;
+ const auto insertpair = str_table.emplace (entry.name, cpool.size ());
+ if (insertpair.second)
+ cpool.append_cstr0 (entry.name);
+ str_off = insertpair.first->second;
+ vec_off = entry.index_offset;
}
else
{
@@ -23955,50 +23864,23 @@ write_hash_table (struct mapped_symtab *symtab,
vec_off = 0;
}
- str_off = MAYBE_SWAP (str_off);
- vec_off = MAYBE_SWAP (vec_off);
-
- obstack_grow (output, &str_off, sizeof (str_off));
- obstack_grow (output, &vec_off, sizeof (vec_off));
+ output.append_data (MAYBE_SWAP (str_off));
+ output.append_data (MAYBE_SWAP (vec_off));
}
-
- htab_delete (str_table);
- htab_delete (symbol_hash_table);
-}
-
-/* Struct to map psymtab to CU index in the index file. */
-struct psymtab_cu_index_map
-{
- struct partial_symtab *psymtab;
- unsigned int cu_index;
-};
-
-static hashval_t
-hash_psymtab_cu_index (const void *item)
-{
- const struct psymtab_cu_index_map *map
- = (const struct psymtab_cu_index_map *) item;
-
- return htab_hash_pointer (map->psymtab);
}
-static int
-eq_psymtab_cu_index (const void *item_lhs, const void *item_rhs)
-{
- const struct psymtab_cu_index_map *lhs
- = (const struct psymtab_cu_index_map *) item_lhs;
- const struct psymtab_cu_index_map *rhs
- = (const struct psymtab_cu_index_map *) item_rhs;
-
- return lhs->psymtab == rhs->psymtab;
-}
+typedef std::unordered_map<partial_symtab *, unsigned int> psym_index_map;
/* Helper struct for building the address table. */
struct addrmap_index_data
{
+ addrmap_index_data (data_buf &addr_vec_, psym_index_map &cu_index_htab_)
+ : addr_vec (addr_vec_), cu_index_htab (cu_index_htab_)
+ {}
+
struct objfile *objfile;
- struct obstack *addr_obstack;
- htab_t cu_index_htab;
+ data_buf &addr_vec;
+ psym_index_map &cu_index_htab;
/* Non-zero if the previous_* fields are valid.
We can't write an entry until we see the next entry (since it is only then
@@ -24010,24 +23892,19 @@ struct addrmap_index_data
CORE_ADDR previous_cu_start;
};
-/* Write an address entry to OBSTACK. */
+/* Write an address entry to ADDR_VEC. */
static void
-add_address_entry (struct objfile *objfile, struct obstack *obstack,
+add_address_entry (struct objfile *objfile, data_buf &addr_vec,
CORE_ADDR start, CORE_ADDR end, unsigned int cu_index)
{
- offset_type cu_index_to_write;
- gdb_byte addr[8];
CORE_ADDR baseaddr;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, start - baseaddr);
- obstack_grow (obstack, addr, 8);
- store_unsigned_integer (addr, 8, BFD_ENDIAN_LITTLE, end - baseaddr);
- obstack_grow (obstack, addr, 8);
- cu_index_to_write = MAYBE_SWAP (cu_index);
- obstack_grow (obstack, &cu_index_to_write, sizeof (offset_type));
+ addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, start - baseaddr);
+ addr_vec.append_uint (8, BFD_ENDIAN_LITTLE, end - baseaddr);
+ addr_vec.append_data (MAYBE_SWAP (cu_index));
}
/* Worker function for traversing an addrmap to build the address table. */
@@ -24039,44 +23916,39 @@ add_address_entry_worker (void *datap, CORE_ADDR start_addr, void *obj)
struct partial_symtab *pst = (struct partial_symtab *) obj;
if (data->previous_valid)
- add_address_entry (data->objfile, data->addr_obstack,
+ add_address_entry (data->objfile, data->addr_vec,
data->previous_cu_start, start_addr,
data->previous_cu_index);
data->previous_cu_start = start_addr;
if (pst != NULL)
{
- struct psymtab_cu_index_map find_map, *map;
- find_map.psymtab = pst;
- map = ((struct psymtab_cu_index_map *)
- htab_find (data->cu_index_htab, &find_map));
- gdb_assert (map != NULL);
- data->previous_cu_index = map->cu_index;
+ const auto it = data->cu_index_htab.find (pst);
+ gdb_assert (it != data->cu_index_htab.cend ());
+ data->previous_cu_index = it->second;
data->previous_valid = 1;
}
else
- data->previous_valid = 0;
+ data->previous_valid = 0;
return 0;
}
-/* Write OBJFILE's address map to OBSTACK.
+/* Write OBJFILE's address map to ADDR_VEC.
CU_INDEX_HTAB is used to map addrmap entries to their CU indices
in the index file. */
static void
-write_address_map (struct objfile *objfile, struct obstack *obstack,
- htab_t cu_index_htab)
+write_address_map (struct objfile *objfile, data_buf &addr_vec,
+ psym_index_map &cu_index_htab)
{
- struct addrmap_index_data addrmap_index_data;
+ struct addrmap_index_data addrmap_index_data (addr_vec, cu_index_htab);
/* When writing the address table, we have to cope with the fact that
the addrmap iterator only provides the start of a region; we have to
wait until the next invocation to get the start of the next region. */
addrmap_index_data.objfile = objfile;
- addrmap_index_data.addr_obstack = obstack;
- addrmap_index_data.cu_index_htab = cu_index_htab;
addrmap_index_data.previous_valid = 0;
addrmap_foreach (objfile->psymtabs_addrmap, add_address_entry_worker,
@@ -24088,7 +23960,7 @@ write_address_map (struct objfile *objfile, struct obstack *obstack,
doesn't work here. To cope we pass 0xff...ff, this is a rare situation
anyway. */
if (addrmap_index_data.previous_valid)
- add_address_entry (objfile, obstack,
+ add_address_entry (objfile, addr_vec,
addrmap_index_data.previous_cu_start, (CORE_ADDR) -1,
addrmap_index_data.previous_cu_index);
}
@@ -24135,7 +24007,7 @@ symbol_kind (struct partial_symbol *psym)
static void
write_psymbols (struct mapped_symtab *symtab,
- htab_t psyms_seen,
+ std::unordered_set<partial_symbol *> &psyms_seen,
struct partial_symbol **psymp,
int count,
offset_type cu_index,
@@ -24144,43 +24016,33 @@ write_psymbols (struct mapped_symtab *symtab,
for (; count-- > 0; ++psymp)
{
struct partial_symbol *psym = *psymp;
- void **slot;
if (SYMBOL_LANGUAGE (psym) == language_ada)
error (_("Ada is not currently supported by the index"));
/* Only add a given psymbol once. */
- slot = htab_find_slot (psyms_seen, psym, INSERT);
- if (!*slot)
+ if (psyms_seen.insert (psym).second)
{
gdb_index_symbol_kind kind = symbol_kind (psym);
- *slot = psym;
add_index_entry (symtab, SYMBOL_SEARCH_NAME (psym),
is_static, kind, cu_index);
}
}
}
-/* Write the contents of an ("unfinished") obstack to FILE. Throw an
- exception if there is an error. */
-
-static void
-write_obstack (FILE *file, struct obstack *obstack)
-{
- if (fwrite (obstack_base (obstack), 1, obstack_object_size (obstack),
- file)
- != obstack_object_size (obstack))
- error (_("couldn't data write to file"));
-}
-
/* A helper struct used when iterating over debug_types. */
struct signatured_type_index_data
{
+ signatured_type_index_data (data_buf &types_list_,
+ std::unordered_set<partial_symbol *> &psyms_seen_)
+ : types_list (types_list_), psyms_seen (psyms_seen_)
+ {}
+
struct objfile *objfile;
struct mapped_symtab *symtab;
- struct obstack *types_list;
- htab_t psyms_seen;
+ data_buf &types_list;
+ std::unordered_set<partial_symbol *> &psyms_seen;
int cu_index;
};
@@ -24194,7 +24056,6 @@ write_one_signatured_type (void **slot, void *d)
= (struct signatured_type_index_data *) d;
struct signatured_type *entry = (struct signatured_type *) *slot;
struct partial_symtab *psymtab = entry->per_cu.v.psymtab;
- gdb_byte val[8];
write_psymbols (info->symtab,
info->psyms_seen,
@@ -24209,20 +24070,33 @@ write_one_signatured_type (void **slot, void *d)
psymtab->n_static_syms, info->cu_index,
1);
- store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE,
- to_underlying (entry->per_cu.sect_off));
- obstack_grow (info->types_list, val, 8);
- store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE,
- to_underlying (entry->type_offset_in_tu));
- obstack_grow (info->types_list, val, 8);
- store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, entry->signature);
- obstack_grow (info->types_list, val, 8);
+ info->types_list.append_uint (8, BFD_ENDIAN_LITTLE,
+ to_underlying (entry->per_cu.sect_off));
+ info->types_list.append_uint (8, BFD_ENDIAN_LITTLE,
+ to_underlying (entry->type_offset_in_tu));
+ info->types_list.append_uint (8, BFD_ENDIAN_LITTLE, entry->signature);
++info->cu_index;
return 1;
}
+/* Recurse into all "included" dependencies and count their symbols as
+ if they appeared in this psymtab. */
+
+static void
+recursively_count_psymbols (struct partial_symtab *psymtab,
+ size_t &psyms_seen)
+{
+ for (int i = 0; i < psymtab->number_of_dependencies; ++i)
+ if (psymtab->dependencies[i]->user != NULL)
+ recursively_count_psymbols (psymtab->dependencies[i],
+ psyms_seen);
+
+ psyms_seen += psymtab->n_global_syms;
+ psyms_seen += psymtab->n_static_syms;
+}
+
/* Recurse into all "included" dependencies and write their symbols as
if they appeared in this psymtab. */
@@ -24230,7 +24104,7 @@ static void
recursively_write_psymbols (struct objfile *objfile,
struct partial_symtab *psymtab,
struct mapped_symtab *symtab,
- htab_t psyms_seen,
+ std::unordered_set<partial_symbol *> &psyms_seen,
offset_type cu_index)
{
int i;
@@ -24252,22 +24126,25 @@ recursively_write_psymbols (struct objfile *objfile,
1);
}
+/* Closes FILE on scope exit. */
+struct file_closer
+{
+ explicit file_closer (FILE *file)
+ : m_file (file)
+ {}
+
+ ~file_closer ()
+ { fclose (m_file); }
+
+private:
+ FILE *m_file;
+};
+
/* Create an index file for OBJFILE in the directory DIR. */
static void
write_psymtabs_to_index (struct objfile *objfile, const char *dir)
{
- struct cleanup *cleanup;
- char *filename;
- struct obstack contents, addr_obstack, constant_pool, symtab_obstack;
- struct obstack cu_list, types_cu_list;
- int i;
- FILE *out_file;
- struct mapped_symtab *symtab;
- offset_type val, size_of_contents, total_len;
- struct stat st;
- struct psymtab_cu_index_map *psymtab_cu_index_map;
-
if (dwarf2_per_objfile->using_index)
error (_("Cannot use an index to create the index"));
@@ -24277,58 +24154,61 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
if (!objfile->psymtabs || !objfile->psymtabs_addrmap)
return;
+ struct stat st;
if (stat (objfile_name (objfile), &st) < 0)
perror_with_name (objfile_name (objfile));
- filename = concat (dir, SLASH_STRING, lbasename (objfile_name (objfile)),
- INDEX_SUFFIX, (char *) NULL);
- cleanup = make_cleanup (xfree, filename);
+ std::string filename (std::string (dir) + SLASH_STRING
+ + lbasename (objfile_name (objfile)) + INDEX_SUFFIX);
- out_file = gdb_fopen_cloexec (filename, "wb");
+ FILE *out_file = gdb_fopen_cloexec (filename.c_str (), "wb");
if (!out_file)
- error (_("Can't open `%s' for writing"), filename);
-
- gdb::unlinker unlink_file (filename);
-
- symtab = create_mapped_symtab ();
- make_cleanup (cleanup_mapped_symtab, symtab);
+ error (_("Can't open `%s' for writing"), filename.c_str ());
- obstack_init (&addr_obstack);
- make_cleanup_obstack_free (&addr_obstack);
+ /* Order matters here; we want FILE to be closed before FILENAME is
+ unlinked, because on MS-Windows one cannot delete a file that is
+ still open. (Don't call anything here that might throw until
+ file_closer is created.) */
+ gdb::unlinker unlink_file (filename.c_str ());
+ file_closer close_out_file (out_file);
- obstack_init (&cu_list);
- make_cleanup_obstack_free (&cu_list);
-
- obstack_init (&types_cu_list);
- make_cleanup_obstack_free (&types_cu_list);
-
- htab_up psyms_seen (htab_create_alloc (100, htab_hash_pointer,
- htab_eq_pointer,
- NULL, xcalloc, xfree));
+ mapped_symtab symtab;
+ data_buf cu_list;
/* While we're scanning CU's create a table that maps a psymtab pointer
(which is what addrmap records) to its index (which is what is recorded
in the index file). This will later be needed to write the address
table. */
- htab_up cu_index_htab (htab_create_alloc (100,
- hash_psymtab_cu_index,
- eq_psymtab_cu_index,
- NULL, xcalloc, xfree));
- psymtab_cu_index_map = XNEWVEC (struct psymtab_cu_index_map,
- dwarf2_per_objfile->n_comp_units);
- make_cleanup (xfree, psymtab_cu_index_map);
+ psym_index_map cu_index_htab;
+ cu_index_htab.reserve (dwarf2_per_objfile->n_comp_units);
/* The CU list is already sorted, so we don't need to do additional
work here. Also, the debug_types entries do not appear in
all_comp_units, but only in their own hash table. */
- for (i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
+
+ /* The psyms_seen set is potentially going to be largish (~40k
+ elements when indexing a -g3 build of GDB itself). Estimate the
+ number of elements in order to avoid too many rehashes, which
+ require rebuilding buckets and thus many trips to
+ malloc/free. */
+ size_t psyms_count = 0;
+ for (int i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
+ {
+ struct dwarf2_per_cu_data *per_cu
+ = dwarf2_per_objfile->all_comp_units[i];
+ struct partial_symtab *psymtab = per_cu->v.psymtab;
+
+ if (psymtab != NULL && psymtab->user == NULL)
+ recursively_count_psymbols (psymtab, psyms_count);
+ }
+ /* Generating an index for gdb itself shows a ratio of
+ TOTAL_SEEN_SYMS/UNIQUE_SYMS or ~5. 4 seems like a good bet. */
+ std::unordered_set<partial_symbol *> psyms_seen (psyms_count / 4);
+ for (int i = 0; i < dwarf2_per_objfile->n_comp_units; ++i)
{
struct dwarf2_per_cu_data *per_cu
= dwarf2_per_objfile->all_comp_units[i];
struct partial_symtab *psymtab = per_cu->v.psymtab;
- gdb_byte val[8];
- struct psymtab_cu_index_map *map;
- void **slot;
/* CU of a shared file from 'dwz -m' may be unused by this main file.
It may be referenced from a local scope but in such case it does not
@@ -24337,36 +24217,30 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
continue;
if (psymtab->user == NULL)
- recursively_write_psymbols (objfile, psymtab, symtab,
- psyms_seen.get (), i);
+ recursively_write_psymbols (objfile, psymtab, &symtab,
+ psyms_seen, i);
- map = &psymtab_cu_index_map[i];
- map->psymtab = psymtab;
- map->cu_index = i;
- slot = htab_find_slot (cu_index_htab.get (), map, INSERT);
- gdb_assert (slot != NULL);
- gdb_assert (*slot == NULL);
- *slot = map;
+ const auto insertpair = cu_index_htab.emplace (psymtab, i);
+ gdb_assert (insertpair.second);
- store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE,
- to_underlying (per_cu->sect_off));
- obstack_grow (&cu_list, val, 8);
- store_unsigned_integer (val, 8, BFD_ENDIAN_LITTLE, per_cu->length);
- obstack_grow (&cu_list, val, 8);
+ cu_list.append_uint (8, BFD_ENDIAN_LITTLE,
+ to_underlying (per_cu->sect_off));
+ cu_list.append_uint (8, BFD_ENDIAN_LITTLE, per_cu->length);
}
/* Dump the address map. */
- write_address_map (objfile, &addr_obstack, cu_index_htab.get ());
+ data_buf addr_vec;
+ write_address_map (objfile, addr_vec, cu_index_htab);
/* Write out the .debug_type entries, if any. */
+ data_buf types_cu_list;
if (dwarf2_per_objfile->signatured_types)
{
- struct signatured_type_index_data sig_data;
+ signatured_type_index_data sig_data (types_cu_list,
+ psyms_seen);
sig_data.objfile = objfile;
- sig_data.symtab = symtab;
- sig_data.types_list = &types_cu_list;
- sig_data.psyms_seen = psyms_seen.get ();
+ sig_data.symtab = &symtab;
sig_data.cu_index = dwarf2_per_objfile->n_comp_units;
htab_traverse_noresize (dwarf2_per_objfile->signatured_types,
write_one_signatured_type, &sig_data);
@@ -24374,63 +24248,49 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
/* Now that we've processed all symbols we can shrink their cu_indices
lists. */
- uniquify_cu_indices (symtab);
+ uniquify_cu_indices (&symtab);
- obstack_init (&constant_pool);
- make_cleanup_obstack_free (&constant_pool);
- obstack_init (&symtab_obstack);
- make_cleanup_obstack_free (&symtab_obstack);
- write_hash_table (symtab, &symtab_obstack, &constant_pool);
+ data_buf symtab_vec, constant_pool;
+ write_hash_table (&symtab, symtab_vec, constant_pool);
- obstack_init (&contents);
- make_cleanup_obstack_free (&contents);
- size_of_contents = 6 * sizeof (offset_type);
- total_len = size_of_contents;
+ data_buf contents;
+ const offset_type size_of_contents = 6 * sizeof (offset_type);
+ offset_type total_len = size_of_contents;
/* The version number. */
- val = MAYBE_SWAP (8);
- obstack_grow (&contents, &val, sizeof (val));
+ contents.append_data (MAYBE_SWAP (8));
/* The offset of the CU list from the start of the file. */
- val = MAYBE_SWAP (total_len);
- obstack_grow (&contents, &val, sizeof (val));
- total_len += obstack_object_size (&cu_list);
+ contents.append_data (MAYBE_SWAP (total_len));
+ total_len += cu_list.size ();
/* The offset of the types CU list from the start of the file. */
- val = MAYBE_SWAP (total_len);
- obstack_grow (&contents, &val, sizeof (val));
- total_len += obstack_object_size (&types_cu_list);
+ contents.append_data (MAYBE_SWAP (total_len));
+ total_len += types_cu_list.size ();
/* The offset of the address table from the start of the file. */
- val = MAYBE_SWAP (total_len);
- obstack_grow (&contents, &val, sizeof (val));
- total_len += obstack_object_size (&addr_obstack);
+ contents.append_data (MAYBE_SWAP (total_len));
+ total_len += addr_vec.size ();
/* The offset of the symbol table from the start of the file. */
- val = MAYBE_SWAP (total_len);
- obstack_grow (&contents, &val, sizeof (val));
- total_len += obstack_object_size (&symtab_obstack);
+ contents.append_data (MAYBE_SWAP (total_len));
+ total_len += symtab_vec.size ();
/* The offset of the constant pool from the start of the file. */
- val = MAYBE_SWAP (total_len);
- obstack_grow (&contents, &val, sizeof (val));
- total_len += obstack_object_size (&constant_pool);
+ contents.append_data (MAYBE_SWAP (total_len));
+ total_len += constant_pool.size ();
- gdb_assert (obstack_object_size (&contents) == size_of_contents);
+ gdb_assert (contents.size () == size_of_contents);
- write_obstack (out_file, &contents);
- write_obstack (out_file, &cu_list);
- write_obstack (out_file, &types_cu_list);
- write_obstack (out_file, &addr_obstack);
- write_obstack (out_file, &symtab_obstack);
- write_obstack (out_file, &constant_pool);
-
- fclose (out_file);
+ contents.file_write (out_file);
+ cu_list.file_write (out_file);
+ types_cu_list.file_write (out_file);
+ addr_vec.file_write (out_file);
+ symtab_vec.file_write (out_file);
+ constant_pool.file_write (out_file);
/* We want to keep the file. */
unlink_file.keep ();
-
- do_cleanups (cleanup);
}
/* Implementation of the `save gdb-index' command.
diff --git a/gdb/event-loop.c b/gdb/event-loop.c
index 4b3ddb8..7304ca7 100644
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -1270,7 +1270,7 @@ poll_timers (void)
/* Delete the timer before calling the callback, not after, in
case the callback itself decides to try deleting the timer
too. */
- xfree (timer_ptr);
+ delete timer_ptr;
/* Call the procedure associated with that timer. */
(proc) (client_data);
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index a517406..4234447 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -311,7 +311,8 @@ f_val_print (struct type *type, int embedded_offset,
}
else
{
- val_print_type_code_int (type, valaddr + embedded_offset, stream);
+ val_print_scalar_formatted (type, embedded_offset,
+ original_value, options, 0, stream);
/* C and C++ has no single byte int type, char is used instead.
Since we don't know whether the value is really intended to
be used as an integer or a character, print the character
diff --git a/gdb/features/i386/i386-linux.c b/gdb/features/i386/i386-linux.c
index 42c406b..c7796c3 100644
--- a/gdb/features/i386/i386-linux.c
+++ b/gdb/features/i386/i386-linux.c
@@ -71,9 +71,6 @@ initialize_tdesc_i386_linux (void)
tdesc_create_reg (feature, "fooff", 30, 1, "float", 32, "int");
tdesc_create_reg (feature, "fop", 31, 1, "float", 32, "int");
- feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux");
- tdesc_create_reg (feature, "orig_eax", 41, 1, NULL, 32, "int");
-
feature = tdesc_create_feature (result, "org.gnu.gdb.i386.sse");
field_type = tdesc_named_type (feature, "ieee_single");
tdesc_create_vector (feature, "v4f", field_type, 4);
@@ -135,5 +132,8 @@ initialize_tdesc_i386_linux (void)
tdesc_create_reg (feature, "xmm7", 39, 1, NULL, 128, "vec128");
tdesc_create_reg (feature, "mxcsr", 40, 1, "vector", 32, "i386_mxcsr");
+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.linux");
+ tdesc_create_reg (feature, "orig_eax", 41, 1, NULL, 32, "int");
+
tdesc_i386_linux = result;
}
diff --git a/gdb/features/i386/i386-linux.xml b/gdb/features/i386/i386-linux.xml
index f9aa311..17f9a1a 100644
--- a/gdb/features/i386/i386-linux.xml
+++ b/gdb/features/i386/i386-linux.xml
@@ -12,6 +12,6 @@
<architecture>i386</architecture>
<osabi>GNU/Linux</osabi>
<xi:include href="32bit-core.xml"/>
- <xi:include href="32bit-linux.xml"/>
<xi:include href="32bit-sse.xml"/>
+ <xi:include href="32bit-linux.xml"/>
</target>
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 6c18e25..beb127e 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -47,70 +47,54 @@
you lose
#endif
-LONGEST
-extract_signed_integer (const gdb_byte *addr, int len,
- enum bfd_endian byte_order)
+template<typename T, typename>
+T
+extract_integer (const gdb_byte *addr, int len, enum bfd_endian byte_order)
{
- LONGEST retval;
+ T retval = 0;
const unsigned char *p;
const unsigned char *startaddr = addr;
const unsigned char *endaddr = startaddr + len;
- if (len > (int) sizeof (LONGEST))
+ if (len > (int) sizeof (T))
error (_("\
That operation is not available on integers of more than %d bytes."),
- (int) sizeof (LONGEST));
+ (int) sizeof (T));
/* Start at the most significant end of the integer, and work towards
the least significant. */
if (byte_order == BFD_ENDIAN_BIG)
{
p = startaddr;
- /* Do the sign extension once at the start. */
- retval = ((LONGEST) * p ^ 0x80) - 0x80;
- for (++p; p < endaddr; ++p)
+ if (std::is_signed<T>::value)
+ {
+ /* Do the sign extension once at the start. */
+ retval = ((LONGEST) * p ^ 0x80) - 0x80;
+ ++p;
+ }
+ for (; p < endaddr; ++p)
retval = (retval << 8) | *p;
}
else
{
p = endaddr - 1;
- /* Do the sign extension once at the start. */
- retval = ((LONGEST) * p ^ 0x80) - 0x80;
- for (--p; p >= startaddr; --p)
+ if (std::is_signed<T>::value)
+ {
+ /* Do the sign extension once at the start. */
+ retval = ((LONGEST) * p ^ 0x80) - 0x80;
+ --p;
+ }
+ for (; p >= startaddr; --p)
retval = (retval << 8) | *p;
}
return retval;
}
-ULONGEST
-extract_unsigned_integer (const gdb_byte *addr, int len,
- enum bfd_endian byte_order)
-{
- ULONGEST retval;
- const unsigned char *p;
- const unsigned char *startaddr = addr;
- const unsigned char *endaddr = startaddr + len;
-
- if (len > (int) sizeof (ULONGEST))
- error (_("\
-That operation is not available on integers of more than %d bytes."),
- (int) sizeof (ULONGEST));
-
- /* Start at the most significant end of the integer, and work towards
- the least significant. */
- retval = 0;
- if (byte_order == BFD_ENDIAN_BIG)
- {
- for (p = startaddr; p < endaddr; ++p)
- retval = (retval << 8) | *p;
- }
- else
- {
- for (p = endaddr - 1; p >= startaddr; --p)
- retval = (retval << 8) | *p;
- }
- return retval;
-}
+/* Explicit instantiations. */
+template LONGEST extract_integer<LONGEST> (const gdb_byte *addr, int len,
+ enum bfd_endian byte_order);
+template ULONGEST extract_integer<ULONGEST> (const gdb_byte *addr, int len,
+ enum bfd_endian byte_order);
/* Sometimes a long long unsigned integer can be extracted as a
LONGEST value. This is done so that we can print these values
@@ -180,10 +164,10 @@ extract_typed_address (const gdb_byte *buf, struct type *type)
/* All 'store' functions accept a host-format integer and store a
target-format integer at ADDR which is LEN bytes long. */
-
+template<typename T, typename>
void
-store_signed_integer (gdb_byte *addr, int len,
- enum bfd_endian byte_order, LONGEST val)
+store_integer (gdb_byte *addr, int len, enum bfd_endian byte_order,
+ T val)
{
gdb_byte *p;
gdb_byte *startaddr = addr;
@@ -209,33 +193,14 @@ store_signed_integer (gdb_byte *addr, int len,
}
}
-void
-store_unsigned_integer (gdb_byte *addr, int len,
- enum bfd_endian byte_order, ULONGEST val)
-{
- unsigned char *p;
- unsigned char *startaddr = (unsigned char *) addr;
- unsigned char *endaddr = startaddr + len;
+/* Explicit instantiations. */
+template void store_integer (gdb_byte *addr, int len,
+ enum bfd_endian byte_order,
+ LONGEST val);
- /* Start at the least significant end of the integer, and work towards
- the most significant. */
- if (byte_order == BFD_ENDIAN_BIG)
- {
- for (p = endaddr - 1; p >= startaddr; --p)
- {
- *p = val & 0xff;
- val >>= 8;
- }
- }
- else
- {
- for (p = startaddr; p < endaddr; ++p)
- {
- *p = val & 0xff;
- val >>= 8;
- }
- }
-}
+template void store_integer (gdb_byte *addr, int len,
+ enum bfd_endian byte_order,
+ ULONGEST val);
/* Store the address ADDR as a pointer of type TYPE at BUF, in target
form. */
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 11ffee9..60985d8 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -21,470 +21,64 @@
#include "defs.h"
#include "inferior.h"
+#include "gdbcmd.h"
#include "terminal.h"
-#include "target.h"
-#include "gdb_wait.h"
-#include "gdb_vfork.h"
-#include "gdbcore.h"
#include "gdbthread.h"
-#include "command.h" /* for dont_repeat () */
-#include "gdbcmd.h"
-#include "solib.h"
-#include "filestuff.h"
#include "top.h"
-#include "signals-state-save-restore.h"
-#include <signal.h>
-#include <vector>
-
-/* This just gets used as a default if we can't find SHELL. */
-#define SHELL_FILE "/bin/sh"
-
-extern char **environ;
-
-static char *exec_wrapper;
-
-/* Build the argument vector for execv(3). */
-
-class execv_argv
-{
-public:
- /* EXEC_FILE is the file to run. ALLARGS is a string containing the
- arguments to the program. If starting with a shell, SHELL_FILE
- is the shell to run. Otherwise, SHELL_FILE is NULL. */
- execv_argv (const char *exec_file, const std::string &allargs,
- const char *shell_file);
-
- /* Return a pointer to the built argv, in the type expected by
- execv. The result is (only) valid for as long as this execv_argv
- object is live. We return a "char **" because that's the type
- that the execv functions expect. Note that it is guaranteed that
- the execv functions do not modify the argv[] array nor the
- strings to which the array point. */
- char **argv ()
- {
- return const_cast<char **> (&m_argv[0]);
- }
-
-private:
- /* Disable copying. */
- execv_argv (const execv_argv &) = delete;
- void operator= (const execv_argv &) = delete;
-
- /* Helper methods for constructing the argument vector. */
-
- /* Used when building an argv for a straight execv call, without
- going via the shell. */
- void init_for_no_shell (const char *exec_file,
- const std::string &allargs);
-
- /* Used when building an argv for execing a shell that execs the
- child program. */
- void init_for_shell (const char *exec_file,
- const std::string &allargs,
- const char *shell_file);
-
- /* The argument vector built. Holds non-owning pointers. Elements
- either point to the strings passed to the execv_argv ctor, or
- inside M_STORAGE. */
- std::vector<const char *> m_argv;
-
- /* Storage. In the no-shell case, this contains a copy of the
- arguments passed to the ctor, split by '\0'. In the shell case,
- this contains the quoted shell command. I.e., SHELL_COMMAND in
- {"$SHELL" "-c", SHELL_COMMAND, NULL}. */
- std::string m_storage;
-};
-
-/* Create argument vector for straight call to execvp. Breaks up
- ALLARGS into an argument vector suitable for passing to execvp and
- stores it in M_ARGV. E.g., on "run a b c d" this routine would get
- as input the string "a b c d", and as output it would fill in
- M_ARGV with the four arguments "a", "b", "c", "d". Each argument
- in M_ARGV points to a substring of a copy of ALLARGS stored in
- M_STORAGE. */
-
-void
-execv_argv::init_for_no_shell (const char *exec_file,
- const std::string &allargs)
-{
-
- /* Save/work with a copy stored in our storage. The pointers pushed
- to M_ARGV point directly into M_STORAGE, which is modified in
- place with the necessary NULL terminators. This avoids N heap
- allocations and string dups when 1 is sufficient. */
- std::string &args_copy = m_storage = allargs;
-
- m_argv.push_back (exec_file);
-
- for (size_t cur_pos = 0; cur_pos < args_copy.size ();)
- {
- /* Skip whitespace-like chars. */
- std::size_t pos = args_copy.find_first_not_of (" \t\n", cur_pos);
-
- if (pos != std::string::npos)
- cur_pos = pos;
-
- /* Find the position of the next separator. */
- std::size_t next_sep = args_copy.find_first_of (" \t\n", cur_pos);
-
- if (next_sep == std::string::npos)
- {
- /* No separator found, which means this is the last
- argument. */
- next_sep = args_copy.size ();
- }
- else
- {
- /* Replace the separator with a terminator. */
- args_copy[next_sep++] = '\0';
- }
-
- m_argv.push_back (&args_copy[cur_pos]);
-
- cur_pos = next_sep;
- }
-
- /* NULL-terminate the vector. */
- m_argv.push_back (NULL);
-}
-
-/* When executing a command under the given shell, return true if the
- '!' character should be escaped when embedded in a quoted
- command-line argument. */
-
-static bool
-escape_bang_in_quoted_argument (const char *shell_file)
-{
- size_t shell_file_len = strlen (shell_file);
-
- /* Bang should be escaped only in C Shells. For now, simply check
- that the shell name ends with 'csh', which covers at least csh
- and tcsh. This should be good enough for now. */
-
- if (shell_file_len < 3)
- return false;
+#include "job-control.h"
+#include "filestuff.h"
+#include "nat/fork-inferior.h"
+#include "common/common-inferior.h"
- if (shell_file[shell_file_len - 3] == 'c'
- && shell_file[shell_file_len - 2] == 's'
- && shell_file[shell_file_len - 1] == 'h')
- return true;
+/* The exec-wrapper, if any, that will be used when starting the
+ inferior. */
- return false;
-}
+static char *exec_wrapper = NULL;
-/* See declaration. */
+/* See common/common-inferior.h. */
-execv_argv::execv_argv (const char *exec_file,
- const std::string &allargs,
- const char *shell_file)
+const char *
+get_exec_wrapper ()
{
- if (shell_file == NULL)
- init_for_no_shell (exec_file, allargs);
- else
- init_for_shell (exec_file, allargs, shell_file);
+ return exec_wrapper;
}
-/* See declaration. */
+/* See nat/fork-inferior.h. */
void
-execv_argv::init_for_shell (const char *exec_file,
- const std::string &allargs,
- const char *shell_file)
+gdb_flush_out_err ()
{
- /* We're going to call a shell. */
- bool escape_bang = escape_bang_in_quoted_argument (shell_file);
-
- /* We need to build a new shell command string, and make argv point
- to it. So build it in the storage. */
- std::string &shell_command = m_storage;
-
- shell_command = "exec ";
-
- /* Add any exec wrapper. That may be a program name with arguments,
- so the user must handle quoting. */
- if (exec_wrapper)
- {
- shell_command += exec_wrapper;
- shell_command += ' ';
- }
-
- /* Now add exec_file, quoting as necessary. */
-
- /* Quoting in this style is said to work with all shells. But csh
- on IRIX 4.0.1 can't deal with it. So we only quote it if we need
- to. */
- bool need_to_quote;
- const char *p = exec_file;
- while (1)
- {
- switch (*p)
- {
- case '\'':
- case '!':
- case '"':
- case '(':
- case ')':
- case '$':
- case '&':
- case ';':
- case '<':
- case '>':
- case ' ':
- case '\n':
- case '\t':
- need_to_quote = true;
- goto end_scan;
-
- case '\0':
- need_to_quote = false;
- goto end_scan;
-
- default:
- break;
- }
- ++p;
- }
- end_scan:
- if (need_to_quote)
- {
- shell_command += '\'';
- for (p = exec_file; *p != '\0'; ++p)
- {
- if (*p == '\'')
- shell_command += "'\\''";
- else if (*p == '!' && escape_bang)
- shell_command += "\\!";
- else
- shell_command += *p;
- }
- shell_command += '\'';
- }
- else
- shell_command += exec_file;
-
- shell_command += ' ' + allargs;
-
- /* If we decided above to start up with a shell, we exec the shell.
- "-c" says to interpret the next arg as a shell command to
- execute, and this command is "exec <target-program> <args>". */
- m_argv.reserve (4);
- m_argv.push_back (shell_file);
- m_argv.push_back ("-c");
- m_argv.push_back (shell_command.c_str ());
- m_argv.push_back (NULL);
+ gdb_flush (main_ui->m_gdb_stdout);
+ gdb_flush (main_ui->m_gdb_stderr);
}
-/* See inferior.h. */
-
-void
-trace_start_error (const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
- fprintf_unfiltered (gdb_stderr, "Could not trace the inferior "
- "process.\nError: ");
- vfprintf_unfiltered (gdb_stderr, fmt, ap);
- va_end (ap);
+/* The ui structure that will be saved on 'prefork_hook' and
+ restored on 'postfork_hook'. */
+static struct ui *saved_ui = NULL;
- gdb_flush (gdb_stderr);
- _exit (0177);
-}
-
-/* See inferior.h. */
+/* See nat/fork-inferior.h. */
void
-trace_start_error_with_name (const char *string)
+prefork_hook (const char *args)
{
- trace_start_error ("%s: %s", string, safe_strerror (errno));
-}
-
-/* Start an inferior Unix child process and sets inferior_ptid to its
- pid. EXEC_FILE is the file to run. ALLARGS is a string containing
- the arguments to the program. ENV is the environment vector to
- pass. SHELL_FILE is the shell file, or NULL if we should pick
- one. EXEC_FUN is the exec(2) function to use, or NULL for the default
- one. */
-
-/* This function is NOT reentrant. Some of the variables have been
- made static to ensure that they survive the vfork call. */
-
-int
-fork_inferior (const char *exec_file_arg, const std::string &allargs,
- char **env, void (*traceme_fun) (void),
- void (*init_trace_fun) (int), void (*pre_trace_fun) (void),
- char *shell_file_arg,
- void (*exec_fun)(const char *file, char * const *argv,
- char * const *env))
-{
- int pid;
- static char default_shell_file[] = SHELL_FILE;
- /* Set debug_fork then attach to the child while it sleeps, to debug. */
- static int debug_fork = 0;
- /* This is set to the result of setpgrp, which if vforked, will be visible
- to you in the parent process. It's only used by humans for debugging. */
- static int debug_setpgrp = 657473;
- static char *shell_file;
- static const char *exec_file;
- char **save_our_env;
const char *inferior_io_terminal = get_inferior_io_terminal ();
- struct inferior *inf;
- int i;
- int save_errno;
- struct ui *save_ui;
-
- /* If no exec file handed to us, get it from the exec-file command
- -- with a good, common error message if none is specified. */
- if (exec_file_arg == NULL)
- exec_file = get_exec_file (1);
- else
- exec_file = exec_file_arg;
-
- /* 'startup_with_shell' is declared in inferior.h and bound to the
- "set startup-with-shell" option. If 0, we'll just do a
- fork/exec, no shell, so don't bother figuring out what shell. */
- if (startup_with_shell)
- {
- shell_file = shell_file_arg;
- /* Figure out what shell to start up the user program under. */
- if (shell_file == NULL)
- shell_file = getenv ("SHELL");
- if (shell_file == NULL)
- shell_file = default_shell_file;
- }
- else
- shell_file = NULL;
- /* Build the argument vector. */
- execv_argv child_argv (exec_file, allargs, shell_file);
-
- /* Retain a copy of our environment variables, since the child will
- replace the value of environ and if we're vforked, we have to
- restore it. */
- save_our_env = environ;
-
- /* Likewise the current UI. */
- save_ui = current_ui;
+ gdb_assert (saved_ui == NULL);
+ /* Retain a copy of our UI, since the child will replace this value
+ and if we're vforked, we have to restore it. */
+ saved_ui = current_ui;
/* Tell the terminal handling subsystem what tty we plan to run on;
it will just record the information for later. */
new_tty_prefork (inferior_io_terminal);
+}
- /* It is generally good practice to flush any possible pending stdio
- output prior to doing a fork, to avoid the possibility of both
- the parent and child flushing the same data after the fork. */
- gdb_flush (main_ui->m_gdb_stdout);
- gdb_flush (main_ui->m_gdb_stderr);
-
- /* If there's any initialization of the target layers that must
- happen to prepare to handle the child we're about fork, do it
- now... */
- if (pre_trace_fun != NULL)
- (*pre_trace_fun) ();
-
- /* Create the child process. Since the child process is going to
- exec(3) shortly afterwards, try to reduce the overhead by
- calling vfork(2). However, if PRE_TRACE_FUN is non-null, it's
- likely that this optimization won't work since there's too much
- work to do between the vfork(2) and the exec(3). This is known
- to be the case on ttrace(2)-based HP-UX, where some handshaking
- between parent and child needs to happen between fork(2) and
- exec(2). However, since the parent is suspended in the vforked
- state, this doesn't work. Also note that the vfork(2) call might
- actually be a call to fork(2) due to the fact that autoconf will
- ``#define vfork fork'' on certain platforms. */
- if (pre_trace_fun || debug_fork)
- pid = fork ();
- else
- pid = vfork ();
-
- if (pid < 0)
- perror_with_name (("vfork"));
-
- if (pid == 0)
- {
- /* Switch to the main UI, so that gdb_std{in/out/err} in the
- child are mapped to std{in/out/err}. This makes it possible
- to use fprintf_unfiltered/warning/error/etc. in the child
- from here on. */
- current_ui = main_ui;
-
- /* Close all file descriptors except those that gdb inherited
- (usually 0/1/2), so they don't leak to the inferior. Note
- that this closes the file descriptors of all secondary
- UIs. */
- close_most_fds ();
-
- if (debug_fork)
- sleep (debug_fork);
-
- /* Create a new session for the inferior process, if necessary.
- It will also place the inferior in a separate process group. */
- if (create_tty_session () <= 0)
- {
- /* No session was created, but we still want to run the inferior
- in a separate process group. */
- debug_setpgrp = gdb_setpgid ();
- if (debug_setpgrp == -1)
- perror (_("setpgrp failed in child"));
- }
-
- /* Ask the tty subsystem to switch to the one we specified
- earlier (or to share the current terminal, if none was
- specified). */
- new_tty ();
-
- /* Changing the signal handlers for the inferior after
- a vfork can also change them for the superior, so we don't mess
- with signals here. See comments in
- initialize_signals for how we get the right signal handlers
- for the inferior. */
-
- /* "Trace me, Dr. Memory!" */
- (*traceme_fun) ();
-
- /* The call above set this process (the "child") as debuggable
- by the original gdb process (the "parent"). Since processes
- (unlike people) can have only one parent, if you are debugging
- gdb itself (and your debugger is thus _already_ the
- controller/parent for this child), code from here on out is
- undebuggable. Indeed, you probably got an error message
- saying "not parent". Sorry; you'll have to use print
- statements! */
-
- restore_original_signals_state ();
-
- /* There is no execlpe call, so we have to set the environment
- for our child in the global variable. If we've vforked, this
- clobbers the parent, but environ is restored a few lines down
- in the parent. By the way, yes we do need to look down the
- path to find $SHELL. Rich Pixley says so, and I agree. */
- environ = env;
-
- char **argv = child_argv.argv ();
-
- if (exec_fun != NULL)
- (*exec_fun) (argv[0], &argv[0], env);
- else
- execvp (argv[0], &argv[0]);
-
- /* If we get here, it's an error. */
- save_errno = errno;
- fprintf_unfiltered (gdb_stderr, "Cannot exec %s", argv[0]);
- for (i = 1; argv[i] != NULL; i++)
- fprintf_unfiltered (gdb_stderr, " %s", argv[i]);
- fprintf_unfiltered (gdb_stderr, ".\n");
- fprintf_unfiltered (gdb_stderr, "Error: %s\n",
- safe_strerror (save_errno));
- gdb_flush (gdb_stderr);
- _exit (0177);
- }
-
- /* Restore our environment in case a vforked child clob'd it. */
- environ = save_our_env;
+/* See nat/fork-inferior.h. */
- /* Likewise the current UI. */
- current_ui = save_ui;
+void
+postfork_hook (pid_t pid)
+{
+ struct inferior *inf;
if (!have_inferiors ())
init_thread_list ();
@@ -493,147 +87,58 @@ fork_inferior (const char *exec_file_arg, const std::string &allargs,
inferior_appeared (inf, pid);
- /* Needed for wait_for_inferior stuff below. */
+ /* Needed for wait_for_inferior stuff. */
inferior_ptid = pid_to_ptid (pid);
- new_tty_postfork ();
+ gdb_assert (saved_ui != NULL);
+ current_ui = saved_ui;
+ saved_ui = NULL;
- /* We have something that executes now. We'll be running through
- the shell at this point, but the pid shouldn't change. Targets
- supporting MT should fill this task's ptid with more data as soon
- as they can. */
- add_thread_silent (inferior_ptid);
-
- /* Now that we have a child process, make it our target, and
- initialize anything target-vector-specific that needs
- initializing. */
- if (init_trace_fun)
- (*init_trace_fun) (pid);
-
- /* We are now in the child process of interest, having exec'd the
- correct program, and are poised at the first instruction of the
- new program. */
- return pid;
+ new_tty_postfork ();
}
-/* Accept NTRAPS traps from the inferior. */
+/* See nat/fork-inferior.h. */
void
-startup_inferior (int ntraps)
+postfork_child_hook ()
{
- int pending_execs = ntraps;
- int terminal_initted = 0;
- ptid_t resume_ptid;
+ /* This is set to the result of setpgrp, which if vforked, will be
+ visible to you in the parent process. It's only used by humans
+ for debugging. */
+ static int debug_setpgrp = 657473;
+
+ /* Make sure we switch to main_ui here in order to be able to
+ use the fprintf_unfiltered/warning/error functions. */
+ current_ui = main_ui;
- if (startup_with_shell)
+ /* Create a new session for the inferior process, if necessary.
+ It will also place the inferior in a separate process group. */
+ if (create_tty_session () <= 0)
{
- /* One trap extra for exec'ing the shell. */
- pending_execs++;
+ /* No session was created, but we still want to run the inferior
+ in a separate process group. */
+ debug_setpgrp = gdb_setpgid ();
+ if (debug_setpgrp == -1)
+ perror (_("setpgrp failed in child"));
}
- if (target_supports_multi_process ())
- resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
- else
- resume_ptid = minus_one_ptid;
-
- /* The process was started by the fork that created it, but it will
- have stopped one instruction after execing the shell. Here we
- must get it up to actual execution of the real program. */
+ /* Ask the tty subsystem to switch to the one we specified
+ earlier (or to share the current terminal, if none was
+ specified). */
+ new_tty ();
+}
- if (exec_wrapper)
- pending_execs++;
+/* See inferior.h. */
- while (1)
- {
- enum gdb_signal resume_signal = GDB_SIGNAL_0;
- ptid_t event_ptid;
-
- struct target_waitstatus ws;
- memset (&ws, 0, sizeof (ws));
- event_ptid = target_wait (resume_ptid, &ws, 0);
-
- if (ws.kind == TARGET_WAITKIND_IGNORE)
- /* The inferior didn't really stop, keep waiting. */
- continue;
-
- switch (ws.kind)
- {
- case TARGET_WAITKIND_SPURIOUS:
- case TARGET_WAITKIND_LOADED:
- case TARGET_WAITKIND_FORKED:
- case TARGET_WAITKIND_VFORKED:
- case TARGET_WAITKIND_SYSCALL_ENTRY:
- case TARGET_WAITKIND_SYSCALL_RETURN:
- /* Ignore gracefully during startup of the inferior. */
- switch_to_thread (event_ptid);
- break;
-
- case TARGET_WAITKIND_SIGNALLED:
- target_terminal_ours ();
- target_mourn_inferior (event_ptid);
- error (_("During startup program terminated with signal %s, %s."),
- gdb_signal_to_name (ws.value.sig),
- gdb_signal_to_string (ws.value.sig));
- return;
-
- case TARGET_WAITKIND_EXITED:
- target_terminal_ours ();
- target_mourn_inferior (event_ptid);
- if (ws.value.integer)
- error (_("During startup program exited with code %d."),
- ws.value.integer);
- else
- error (_("During startup program exited normally."));
- return;
-
- case TARGET_WAITKIND_EXECD:
- /* Handle EXEC signals as if they were SIGTRAP signals. */
- xfree (ws.value.execd_pathname);
- resume_signal = GDB_SIGNAL_TRAP;
- switch_to_thread (event_ptid);
- break;
-
- case TARGET_WAITKIND_STOPPED:
- resume_signal = ws.value.sig;
- switch_to_thread (event_ptid);
- break;
- }
-
- if (resume_signal != GDB_SIGNAL_TRAP)
- {
- /* Let shell child handle its own signals in its own way. */
- target_continue (resume_ptid, resume_signal);
- }
- else
- {
- /* We handle SIGTRAP, however; it means child did an exec. */
- if (!terminal_initted)
- {
- /* Now that the child has exec'd we know it has already
- set its process group. On POSIX systems, tcsetpgrp
- will fail with EPERM if we try it before the child's
- setpgid. */
-
- /* Set up the "saved terminal modes" of the inferior
- based on what modes we are starting it with. */
- target_terminal_init ();
-
- /* Install inferior's terminal modes. */
- target_terminal_inferior ();
-
- terminal_initted = 1;
- }
-
- if (--pending_execs == 0)
- break;
-
- /* Just make it go on. */
- target_continue_no_signal (resume_ptid);
- }
- }
+ptid_t
+gdb_startup_inferior (pid_t pid, int num_traps)
+{
+ ptid_t ptid = startup_inferior (pid, num_traps, NULL, NULL);
/* Mark all threads non-executing. */
- set_executing (resume_ptid, 0);
+ set_executing (ptid, 0);
+
+ return ptid;
}
/* Implement the "unset exec-wrapper" command. */
diff --git a/gdb/frame.c b/gdb/frame.c
index efe5a20..30e4aea 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -1252,10 +1252,27 @@ frame_unwind_register_signed (struct frame_info *frame, int regnum)
struct gdbarch *gdbarch = frame_unwind_arch (frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int size = register_size (gdbarch, regnum);
- gdb_byte buf[MAX_REGISTER_SIZE];
+ struct value *value = frame_unwind_register_value (frame, regnum);
+
+ gdb_assert (value != NULL);
+
+ if (value_optimized_out (value))
+ {
+ throw_error (OPTIMIZED_OUT_ERROR,
+ _("Register %d was not saved"), regnum);
+ }
+ if (!value_entirely_available (value))
+ {
+ throw_error (NOT_AVAILABLE_ERROR,
+ _("Register %d is not available"), regnum);
+ }
- frame_unwind_register (frame, regnum, buf);
- return extract_signed_integer (buf, size, byte_order);
+ LONGEST r = extract_signed_integer (value_contents_all (value), size,
+ byte_order);
+
+ release_value (value);
+ value_free (value);
+ return r;
}
LONGEST
diff --git a/gdb/gdb_regex.c b/gdb/gdb_regex.c
new file mode 100644
index 0000000..55c3980
--- /dev/null
+++ b/gdb/gdb_regex.c
@@ -0,0 +1,57 @@
+/* Copyright (C) 2011-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "gdb_regex.h"
+#include "common/def-vector.h"
+
+compiled_regex::compiled_regex (const char *regex, int cflags,
+ const char *message)
+{
+ gdb_assert (regex != NULL);
+ gdb_assert (message != NULL);
+
+ int code = regcomp (&m_pattern, regex, cflags);
+ if (code != 0)
+ {
+ size_t length = regerror (code, &m_pattern, NULL, 0);
+ gdb::def_vector<char> err (length);
+
+ regerror (code, &m_pattern, err.data (), length);
+ error (("%s: %s"), message, err.data ());
+ }
+}
+
+compiled_regex::~compiled_regex ()
+{
+ regfree (&m_pattern);
+}
+
+int
+compiled_regex::exec (const char *string, size_t nmatch,
+ regmatch_t pmatch[], int eflags) const
+{
+ return regexec (&m_pattern, string, nmatch, pmatch, eflags);
+}
+
+int
+compiled_regex::search (const char *string,
+ int length, int start, int range,
+ struct re_registers *regs)
+{
+ return re_search (&m_pattern, string, length, start, range, regs);
+}
diff --git a/gdb/gdb_regex.h b/gdb/gdb_regex.h
index 0be26ef..f62f81d 100644
--- a/gdb/gdb_regex.h
+++ b/gdb/gdb_regex.h
@@ -27,10 +27,39 @@
# include <regex.h>
#endif
-/* From utils.c. */
-struct cleanup *make_regfree_cleanup (regex_t *);
-char *get_regcomp_error (int, regex_t *);
-struct cleanup *compile_rx_or_error (regex_t *pattern, const char *rx,
- const char *message);
+/* A compiled regex. This is mainly a wrapper around regex_t. The
+ the constructor throws on regcomp error and the destructor is
+ responsible for calling regfree. The former means that it's not
+ possible to create an instance of compiled_regex that isn't
+ compiled, hence the name. */
+class compiled_regex
+{
+public:
+ /* Compile a regexp and throw an exception on error, including
+ MESSAGE. REGEX and MESSAGE must not be NULL. */
+ compiled_regex (const char *regex, int cflags,
+ const char *message)
+ ATTRIBUTE_NONNULL (2) ATTRIBUTE_NONNULL (4);
+
+ ~compiled_regex ();
+
+ /* Disable copy. */
+ compiled_regex (const compiled_regex&) = delete;
+ void operator= (const compiled_regex&) = delete;
+
+ /* Wrapper around ::regexec. */
+ int exec (const char *string,
+ size_t nmatch, regmatch_t pmatch[],
+ int eflags) const;
+
+ /* Wrapper around ::re_search. (Not const because re_search's
+ regex_t parameter isn't either.) */
+ int search (const char *string, int size, int startpos,
+ int range, struct re_registers *regs);
+
+private:
+ /* The compiled pattern. */
+ regex_t m_pattern;
+};
#endif /* not GDB_REGEX_H */
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 257c39f..e5efdfb 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -295,7 +295,6 @@ struct gdbarch
gdbarch_displaced_step_copy_insn_ftype *displaced_step_copy_insn;
gdbarch_displaced_step_hw_singlestep_ftype *displaced_step_hw_singlestep;
gdbarch_displaced_step_fixup_ftype *displaced_step_fixup;
- gdbarch_displaced_step_free_closure_ftype *displaced_step_free_closure;
gdbarch_displaced_step_location_ftype *displaced_step_location;
gdbarch_relocate_instruction_ftype *relocate_instruction;
gdbarch_overlay_update_ftype *overlay_update;
@@ -443,7 +442,6 @@ gdbarch_alloc (const struct gdbarch_info *info,
gdbarch->skip_permanent_breakpoint = default_skip_permanent_breakpoint;
gdbarch->displaced_step_hw_singlestep = default_displaced_step_hw_singlestep;
gdbarch->displaced_step_fixup = NULL;
- gdbarch->displaced_step_free_closure = NULL;
gdbarch->displaced_step_location = NULL;
gdbarch->relocate_instruction = NULL;
gdbarch->has_shared_address_space = default_has_shared_address_space;
@@ -656,8 +654,6 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of displaced_step_copy_insn, has predicate. */
/* Skip verify of displaced_step_hw_singlestep, invalid_p == 0 */
/* Skip verify of displaced_step_fixup, has predicate. */
- if ((! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn))
- log.puts ("\n\tdisplaced_step_free_closure");
if ((! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn))
log.puts ("\n\tdisplaced_step_location");
/* Skip verify of relocate_instruction, has predicate. */
@@ -912,9 +908,6 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: displaced_step_fixup = <%s>\n",
host_address_to_string (gdbarch->displaced_step_fixup));
fprintf_unfiltered (file,
- "gdbarch_dump: displaced_step_free_closure = <%s>\n",
- host_address_to_string (gdbarch->displaced_step_free_closure));
- fprintf_unfiltered (file,
"gdbarch_dump: displaced_step_hw_singlestep = <%s>\n",
host_address_to_string (gdbarch->displaced_step_hw_singlestep));
fprintf_unfiltered (file,
@@ -3970,23 +3963,6 @@ set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch,
gdbarch->displaced_step_fixup = displaced_step_fixup;
}
-void
-gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, struct displaced_step_closure *closure)
-{
- gdb_assert (gdbarch != NULL);
- gdb_assert (gdbarch->displaced_step_free_closure != NULL);
- if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_displaced_step_free_closure called\n");
- gdbarch->displaced_step_free_closure (gdbarch, closure);
-}
-
-void
-set_gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch,
- gdbarch_displaced_step_free_closure_ftype displaced_step_free_closure)
-{
- gdbarch->displaced_step_free_closure = displaced_step_free_closure;
-}
-
CORE_ADDR
gdbarch_displaced_step_location (struct gdbarch *gdbarch)
{
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index 15a8141..ab7561f 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -1039,21 +1039,6 @@ typedef void (gdbarch_displaced_step_fixup_ftype) (struct gdbarch *gdbarch, stru
extern void gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs);
extern void set_gdbarch_displaced_step_fixup (struct gdbarch *gdbarch, gdbarch_displaced_step_fixup_ftype *displaced_step_fixup);
-/* Free a closure returned by gdbarch_displaced_step_copy_insn.
-
- If you provide gdbarch_displaced_step_copy_insn, you must provide
- this function as well.
-
- If your architecture uses closures that don't need to be freed, then
- you can use simple_displaced_step_free_closure here.
-
- For a general explanation of displaced stepping and how GDB uses it,
- see the comments in infrun.c. */
-
-typedef void (gdbarch_displaced_step_free_closure_ftype) (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
-extern void gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, struct displaced_step_closure *closure);
-extern void set_gdbarch_displaced_step_free_closure (struct gdbarch *gdbarch, gdbarch_displaced_step_free_closure_ftype *displaced_step_free_closure);
-
/* Return the address of an appropriate place to put displaced
instructions while we step over them. There need only be one such
place, since we're only stepping one thread over a breakpoint at a
diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh
index 7992cbe..22f5715 100755
--- a/gdb/gdbarch.sh
+++ b/gdb/gdbarch.sh
@@ -833,18 +833,6 @@ m;int;displaced_step_hw_singlestep;struct displaced_step_closure *closure;closur
# see the comments in infrun.c.
M;void;displaced_step_fixup;struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs;closure, from, to, regs;;NULL
-# Free a closure returned by gdbarch_displaced_step_copy_insn.
-#
-# If you provide gdbarch_displaced_step_copy_insn, you must provide
-# this function as well.
-#
-# If your architecture uses closures that don't need to be freed, then
-# you can use simple_displaced_step_free_closure here.
-#
-# For a general explanation of displaced stepping and how GDB uses it,
-# see the comments in infrun.c.
-m;void;displaced_step_free_closure;struct displaced_step_closure *closure;closure;;NULL;;(! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn)
-
# Return the address of an appropriate place to put displaced
# instructions while we step over them. There need only be one such
# place, since we're only stepping one thread over a breakpoint at a
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 40ae37c..e3eed03 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -29,12 +29,6 @@ struct regcache;
#include "exec.h"
#include "target.h"
-/* Return the name of the executable file as a string.
- ERR nonzero means get error if there is none specified;
- otherwise return 0 in that case. */
-
-extern char *get_exec_file (int err);
-
/* Nonzero if there is a core file. */
extern int have_core_file_p (void);
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index d223553..63b54f6 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,130 @@
+2017-06-20 Simon Marchi <simon.marchi@ericsson.com>
+
+ * Makefile.in (IPA_OBJS): Sort and format one item per line.
+
+2017-06-20 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * linux-low.c (linux_create_inferior): Adjust code to access the
+ environment information via 'gdb_environ' class.
+ * lynx-low.c (lynx_create_inferior): Likewise.
+ * server.c (our_environ): Make it an instance of 'gdb_environ'.
+ (get_environ): Return a pointer to 'our_environ'.
+ (captured_main): Initialize 'our_environ'.
+ * server.h (get_environ): Adjust prototype.
+ * spu-low.c (spu_create_inferior): Adjust code to access the
+ environment information via 'gdb_environ' class.
+
+2017-06-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * linux-low.c (linux_read_memory, linux_write_memory): Remove
+ usage of "register" keyword.
+
+2017-06-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * configure: Re-generate.
+
+2017-06-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * configure: Re-generate.
+
+2017-06-17 Simon Marchi <simon.marchi@ericsson.com>
+
+ * Makefile.in (COMPILE.pre): Add "-x c++".
+
+2017-06-09 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * fork-child.c: Conditionally include <signal.h>.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * server.c (handle_general_set): Handle new packet
+ "QStartupWithShell".
+ (handle_query): Add "QStartupWithShell" to the list of supported
+ packets.
+ (gdbserver_usage): Add help text explaining the
+ new "--startup-with-shell" and "--no-startup-with-shell" CLI
+ options.
+ (captured_main): Recognize and act upon the presence of the new
+ CLI options.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+ Pedro Alves <palves@redhat.com>
+
+ * Makefile.in (SFILES): Add "nat/fork-inferior.o".
+ * configure: Regenerate.
+ * configure.srv (srv_linux_obj): Add "fork-child.o" and
+ "fork-inferior.o".
+ (i[34567]86-*-lynxos*): Likewise.
+ (spu*-*-*): Likewise.
+ * fork-child.c: New file.
+ * linux-low.c: Include "common-inferior.h", "nat/fork-inferior.h"
+ and "environ.h".
+ (linux_ptrace_fun): New function.
+ (linux_create_inferior): Adjust function prototype to reflect
+ change on "target.h". Adjust function code to use
+ "fork_inferior".
+ (linux_request_interrupt): Delete "signal_pid".
+ * lynx-low.c: Include "common-inferior.h" and "nat/fork-inferior.h".
+ (lynx_ptrace_fun): New function.
+ (lynx_create_inferior): Adjust function prototype to reflect
+ change on "target.h". Adjust function code to use
+ "fork_inferior".
+ * nto-low.c (nto_create_inferior): Adjust function prototype and
+ code to reflect change on "target.h". Update comments.
+ * server.c: Include "common-inferior.h", "nat/fork-inferior.h",
+ "common-terminal.h" and "environ.h".
+ (terminal_fd): Moved to fork-child.c.
+ (old_foreground_pgrp): Likewise.
+ (restore_old_foreground_pgrp): Likewise.
+ (last_status): Make it global.
+ (last_ptid): Likewise.
+ (our_environ): New variable.
+ (startup_with_shell): Likewise.
+ (program_name): Likewise.
+ (program_argv): Rename to...
+ (program_args): ...this.
+ (wrapper_argv): New variable.
+ (start_inferior): Delete function.
+ (get_exec_wrapper): New function.
+ (get_exec_file): Likewise.
+ (get_environ): Likewise.
+ (prefork_hook): Likewise.
+ (post_fork_inferior): Likewise.
+ (postfork_hook): Likewise.
+ (postfork_child_hook): Likewise.
+ (handle_v_run): Update code to deal with arguments coming from the
+ remote host. Update calls from "start_inferior" to
+ "create_inferior".
+ (captured_main): Likewise. Initialize environment variable. Call
+ "have_job_control".
+ * server.h (post_fork_inferior): New prototype.
+ (get_environ): Likewise.
+ (last_status): Declare.
+ (last_ptid): Likewise.
+ (signal_pid): Likewise.
+ * spu-low.c: Include "common-inferior.h" and "nat/fork-inferior.h".
+ (spu_ptrace_fun): New function.
+ (spu_create_inferior): Adjust function prototype to reflect change
+ on "target.h". Adjust function code to use "fork_inferior".
+ * target.c (target_terminal_init): New function.
+ (target_terminal_inferior): Likewise.
+ (target_terminal_ours): Likewise.
+ * target.h: Include <vector>.
+ (struct target_ops) <create_inferior>: Update prototype.
+ (create_inferior): Update macro.
+ * utils.c (gdb_flush_out_err): New function.
+ * win32-low.c (win32_create_inferior): Adjust function prototype
+ and code to reflect change on "target.h".
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * inferiors.c (switch_to_thread): New function.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * Makefile.in (SFILE): Add "common/job-control.c".
+ (OBS): Add "job-control.o".
+
2017-05-06 Sergio Durigan Junior <sergiodj@redhat.com>
* Makefile: Remove "@host_makefile_frag@".
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 01dfdc0..4e0080e 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -65,7 +65,7 @@ depcomp = $(SHELL) $(srcdir)/../depcomp
# Note that these are overridden by GNU make-specific code below if
# GNU make is used. The overrides implement dependency tracking.
-COMPILE.pre = $(CXX) $(CXX_DIALECT)
+COMPILE.pre = $(CXX) -x c++ $(CXX_DIALECT)
COMPILE.post = -c -o $@
COMPILE = $(COMPILE.pre) $(INTERNAL_CFLAGS) $(COMPILE.post)
POSTCOMPILE = @true
@@ -204,6 +204,7 @@ SFILES = \
$(srcdir)/common/environ.c \
$(srcdir)/common/fileio.c \
$(srcdir)/common/filestuff.c \
+ $(srcdir)/common/job-control.c \
$(srcdir)/common/gdb_vecs.c \
$(srcdir)/common/new-op.c \
$(srcdir)/common/print-utils.c \
@@ -217,6 +218,7 @@ SFILES = \
$(srcdir)/nat/linux-personality.c \
$(srcdir)/nat/mips-linux-watch.c \
$(srcdir)/nat/ppc-linux.c \
+ $(srcdir)/nat/fork-inferior.c \
$(srcdir)/target/waitstatus.c
DEPFILES = @GDBSERVER_DEPFILES@
@@ -234,6 +236,7 @@ OBS = \
cleanups.o \
common-debug.o \
common-exceptions.o \
+ job-control.o \
common-regcache.o \
common-utils.o \
debug.o \
@@ -384,9 +387,18 @@ gdbreplay$(EXEEXT): $(GDBREPLAY_OBS) $(LIBGNU) $(LIBIBERTY)
$(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) -o gdbreplay$(EXEEXT) $(GDBREPLAY_OBS) \
$(XM_CLIBS) $(LIBGNU) $(LIBIBERTY)
-IPA_OBJS = ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o \
- regcache-ipa.o remote-utils-ipa.o common-utils-ipa.o \
- tdesc-ipa.o print-utils-ipa.o rsp-low-ipa.o errors-ipa.o \
+IPA_OBJS = \
+ ax-ipa.o \
+ common-utils-ipa.o \
+ errors-ipa.o \
+ format-ipa.o \
+ print-utils-ipa.o \
+ regcache-ipa.o \
+ remote-utils-ipa.o \
+ rsp-low-ipa.o \
+ tdesc-ipa.o \
+ tracepoint-ipa.o \
+ utils-ipa.o \
${IPA_DEPFILES}
IPA_LIB = libinproctrace.so
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index b314c41..35aeabc 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -7148,7 +7148,8 @@ build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
--Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized"
+-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \
+-Wno-mismatched-tags"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
@@ -7219,9 +7220,9 @@ $as_echo_n "checking compiler warning flags... " >&6; }
*)
# Check whether GCC accepts it.
saved_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $wtest"
+ CFLAGS="$CFLAGS -Werror $wtest"
saved_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $wtest"
+ CXXFLAGS="$CXXFLAGS -Werror $wtest"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -7498,9 +7499,9 @@ _ACEOF
fi
-# See if <sys/user.h> supports the %fs_base and %gs_base amd64 segment
-# registers. Older amd64 Linux's don't have the fs_base and gs_base
-# members of `struct user_regs_struct'.
+# See if <sys/user.h> supports the %fs_base and %gs_bas amd64 segment registers.
+# Older amd64 Linux's don't have the fs_base and gs_base members of
+# `struct user_regs_struct'.
ac_fn_c_check_member "$LINENO" "struct user_regs_struct" "fs_base" "ac_cv_member_struct_user_regs_struct_fs_base" "#include <sys/user.h>
"
if test "x$ac_cv_member_struct_user_regs_struct_fs_base" = x""yes; then :
diff --git a/gdb/gdbserver/configure.srv b/gdb/gdbserver/configure.srv
index d00d9e2..43f90c9 100644
--- a/gdb/gdbserver/configure.srv
+++ b/gdb/gdbserver/configure.srv
@@ -43,7 +43,7 @@ srv_amd64_linux_xmlfiles="i386/amd64-linux.xml i386/amd64-avx-linux.xml i386/amd
# Linux object files. This is so we don't have to repeat
# these files over and over again.
-srv_linux_obj="linux-low.o linux-osdata.o linux-procfs.o linux-ptrace.o linux-waitpid.o linux-personality.o linux-namespaces.o"
+srv_linux_obj="linux-low.o linux-osdata.o linux-procfs.o linux-ptrace.o linux-waitpid.o linux-personality.o linux-namespaces.o fork-child.o fork-inferior.o"
# Input is taken from the "${target}" variable.
@@ -131,7 +131,7 @@ case "${target}" in
ipa_obj="${ipa_i386_linux_regobj} linux-i386-ipa.o"
;;
i[34567]86-*-lynxos*) srv_regobj="i386.o"
- srv_tgtobj="lynx-low.o lynx-i386-low.o"
+ srv_tgtobj="lynx-low.o lynx-i386-low.o fork-child.o fork-inferior.o"
srv_xmlfiles="i386/i386.xml"
srv_xmlfiles="${srv_xmlfiles} i386/32bit-core.xml"
srv_xmlfiles="${srv_xmlfiles} i386/32bit-sse.xml"
@@ -338,7 +338,7 @@ case "${target}" in
srv_linux_thread_db=yes
;;
spu*-*-*) srv_regobj=reg-spu.o
- srv_tgtobj="spu-low.o"
+ srv_tgtobj="spu-low.o fork-child.o fork-inferior.o"
;;
tic6x-*-uclinux) srv_regobj="tic6x-c64xp-linux.o"
srv_regobj="${srv_regobj} tic6x-c64x-linux.o"
diff --git a/gdb/gdbserver/fork-child.c b/gdb/gdbserver/fork-child.c
new file mode 100644
index 0000000..1002620
--- /dev/null
+++ b/gdb/gdbserver/fork-child.c
@@ -0,0 +1,116 @@
+/* Fork a Unix child process, and set up to debug it, for GDBserver.
+ Copyright (C) 1989-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "server.h"
+#include "job-control.h"
+#include "nat/fork-inferior.h"
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#ifdef SIGTTOU
+/* A file descriptor for the controlling terminal. */
+static int terminal_fd;
+
+/* TERMINAL_FD's original foreground group. */
+static pid_t old_foreground_pgrp;
+
+/* Hand back terminal ownership to the original foreground group. */
+
+static void
+restore_old_foreground_pgrp (void)
+{
+ tcsetpgrp (terminal_fd, old_foreground_pgrp);
+}
+#endif
+
+/* See nat/fork-inferior.h. */
+
+void
+prefork_hook (const char *args)
+{
+ if (debug_threads)
+ {
+ debug_printf ("args: %s\n", args);
+ debug_flush ();
+ }
+
+#ifdef SIGTTOU
+ signal (SIGTTOU, SIG_DFL);
+ signal (SIGTTIN, SIG_DFL);
+#endif
+
+ /* Clear this so the backend doesn't get confused, thinking
+ CONT_THREAD died, and it needs to resume all threads. */
+ cont_thread = null_ptid;
+}
+
+/* See nat/fork-inferior.h. */
+
+void
+postfork_hook (pid_t pid)
+{
+}
+
+/* See nat/fork-inferior.h. */
+
+void
+postfork_child_hook ()
+{
+ /* This is set to the result of setpgrp, which if vforked, will be
+ visible to you in the parent process. It's only used by humans
+ for debugging. */
+ static int debug_setpgrp = 657473;
+
+ debug_setpgrp = gdb_setpgid ();
+ if (debug_setpgrp == -1)
+ perror (_("setpgrp failed in child"));
+}
+
+/* See nat/fork-inferior.h. */
+
+void
+gdb_flush_out_err ()
+{
+ fflush (stdout);
+ fflush (stderr);
+}
+
+/* See server.h. */
+
+void
+post_fork_inferior (int pid, const char *program)
+{
+#ifdef SIGTTOU
+ signal (SIGTTOU, SIG_IGN);
+ signal (SIGTTIN, SIG_IGN);
+ terminal_fd = fileno (stderr);
+ old_foreground_pgrp = tcgetpgrp (terminal_fd);
+ tcsetpgrp (terminal_fd, pid);
+ atexit (restore_old_foreground_pgrp);
+#endif
+
+ startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED,
+ &last_status, &last_ptid);
+ current_thread->last_resume_kind = resume_stop;
+ current_thread->last_status = last_status;
+ signal_pid = pid;
+ target_post_create_inferior ();
+ fprintf (stderr, "Process %s created; pid = %d\n", program, pid);
+ fflush (stderr);
+}
diff --git a/gdb/gdbserver/inferiors.c b/gdb/gdbserver/inferiors.c
index b65a726..5a4a0d1 100644
--- a/gdb/gdbserver/inferiors.c
+++ b/gdb/gdbserver/inferiors.c
@@ -468,3 +468,12 @@ make_cleanup_restore_current_thread (void)
{
return make_cleanup (do_restore_current_thread_cleanup, current_thread);
}
+
+/* See common/common-gdbthread.h. */
+
+void
+switch_to_thread (ptid_t ptid)
+{
+ if (!ptid_equal (ptid, minus_one_ptid))
+ current_thread = find_thread_ptid (ptid);
+}
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index ea3c81b..3d7cfe3 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -47,6 +47,9 @@
#include "tracepoint.h"
#include "hostio.h"
#include <inttypes.h>
+#include "common-inferior.h"
+#include "nat/fork-inferior.h"
+#include "environ.h"
#ifndef ELFMAG0
/* Don't include <linux/elf.h> here. If it got included by gdb_proc_service.h
then ELFMAG0 will have been defined. If it didn't get included by
@@ -946,59 +949,57 @@ add_lwp (ptid_t ptid)
return lwp;
}
+/* Callback to be used when calling fork_inferior, responsible for
+ actually initiating the tracing of the inferior. */
+
+static void
+linux_ptrace_fun ()
+{
+ if (ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0,
+ (PTRACE_TYPE_ARG4) 0) < 0)
+ trace_start_error_with_name ("ptrace");
+
+ if (setpgid (0, 0) < 0)
+ trace_start_error_with_name ("setpgid");
+
+ /* If GDBserver is connected to gdb via stdio, redirect the inferior's
+ stdout to stderr so that inferior i/o doesn't corrupt the connection.
+ Also, redirect stdin to /dev/null. */
+ if (remote_connection_is_stdio ())
+ {
+ if (close (0) < 0)
+ trace_start_error_with_name ("close");
+ if (open ("/dev/null", O_RDONLY) < 0)
+ trace_start_error_with_name ("open");
+ if (dup2 (2, 1) < 0)
+ trace_start_error_with_name ("dup2");
+ if (write (2, "stdin/stdout redirected\n",
+ sizeof ("stdin/stdout redirected\n") - 1) < 0)
+ {
+ /* Errors ignored. */;
+ }
+ }
+}
+
/* Start an inferior process and returns its pid.
- ALLARGS is a vector of program-name and args. */
+ PROGRAM is the name of the program to be started, and PROGRAM_ARGS
+ are its arguments. */
static int
-linux_create_inferior (char *program, char **allargs)
+linux_create_inferior (const char *program,
+ const std::vector<char *> &program_args)
{
struct lwp_info *new_lwp;
int pid;
ptid_t ptid;
struct cleanup *restore_personality
= maybe_disable_address_space_randomization (disable_randomization);
+ std::string str_program_args = stringify_argv (program_args);
-#if defined(__UCLIBC__) && defined(HAS_NOMMU)
- pid = vfork ();
-#else
- pid = fork ();
-#endif
- if (pid < 0)
- perror_with_name ("fork");
-
- if (pid == 0)
- {
- close_most_fds ();
- ptrace (PTRACE_TRACEME, 0, (PTRACE_TYPE_ARG3) 0, (PTRACE_TYPE_ARG4) 0);
-
- setpgid (0, 0);
-
- /* If gdbserver is connected to gdb via stdio, redirect the inferior's
- stdout to stderr so that inferior i/o doesn't corrupt the connection.
- Also, redirect stdin to /dev/null. */
- if (remote_connection_is_stdio ())
- {
- close (0);
- open ("/dev/null", O_RDONLY);
- dup2 (2, 1);
- if (write (2, "stdin/stdout redirected\n",
- sizeof ("stdin/stdout redirected\n") - 1) < 0)
- {
- /* Errors ignored. */;
- }
- }
-
- restore_original_signals_state ();
-
- execv (program, allargs);
- if (errno == ENOENT)
- execvp (program, allargs);
-
- fprintf (stderr, "Cannot exec %s: %s.\n", program,
- strerror (errno));
- fflush (stderr);
- _exit (0177);
- }
+ pid = fork_inferior (program,
+ str_program_args.c_str (),
+ get_environ ()->envp (), linux_ptrace_fun,
+ NULL, NULL, NULL, NULL);
do_cleanups (restore_personality);
@@ -1008,6 +1009,8 @@ linux_create_inferior (char *program, char **allargs)
new_lwp = add_lwp (ptid);
new_lwp->must_set_ptrace_flags = 1;
+ post_fork_inferior (pid, program);
+
return pid;
}
@@ -5867,11 +5870,11 @@ static int
linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
{
int pid = lwpid_of (current_thread);
- register PTRACE_XFER_TYPE *buffer;
- register CORE_ADDR addr;
- register int count;
+ PTRACE_XFER_TYPE *buffer;
+ CORE_ADDR addr;
+ int count;
char filename[64];
- register int i;
+ int i;
int ret;
int fd;
@@ -5955,16 +5958,16 @@ linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
static int
linux_write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, int len)
{
- register int i;
+ int i;
/* Round starting address down to longword boundary. */
- register CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
+ CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_XFER_TYPE);
/* Round ending address up; get number of longwords that makes. */
- register int count
+ int count
= (((memaddr + len) - addr) + sizeof (PTRACE_XFER_TYPE) - 1)
/ sizeof (PTRACE_XFER_TYPE);
/* Allocate buffer of that many longwords. */
- register PTRACE_XFER_TYPE *buffer = XALLOCAVEC (PTRACE_XFER_TYPE, count);
+ PTRACE_XFER_TYPE *buffer = XALLOCAVEC (PTRACE_XFER_TYPE, count);
int pid = lwpid_of (current_thread);
@@ -6055,8 +6058,6 @@ linux_look_up_symbols (void)
static void
linux_request_interrupt (void)
{
- extern unsigned long signal_pid;
-
/* Send a SIGINT to the process group. This acts just like the user
typed a ^C on the controlling terminal. */
kill (-signal_pid, SIGINT);
diff --git a/gdb/gdbserver/lynx-low.c b/gdb/gdbserver/lynx-low.c
index d300aae..77f570e 100644
--- a/gdb/gdbserver/lynx-low.c
+++ b/gdb/gdbserver/lynx-low.c
@@ -28,6 +28,8 @@
#include "gdb_wait.h"
#include <signal.h>
#include "filestuff.h"
+#include "common-inferior.h"
+#include "nat/fork-inferior.h"
int using_threads = 1;
@@ -224,36 +226,43 @@ lynx_add_process (int pid, int attached)
return proc;
}
+/* Callback used by fork_inferior to start tracing the inferior. */
+
+static void
+lynx_ptrace_fun ()
+{
+ int pgrp;
+
+ /* Switch child to its own process group so that signals won't
+ directly affect GDBserver. */
+ pgrp = getpid();
+ if (pgrp < 0)
+ trace_start_error_with_name ("pgrp");
+ if (setpgid (0, pgrp) < 0)
+ trace_start_error_with_name ("setpgid");
+ if (ioctl (0, TIOCSPGRP, &pgrp) < 0)
+ trace_start_error_with_name ("ioctl");
+ if (lynx_ptrace (PTRACE_TRACEME, null_ptid, 0, 0, 0) < 0)
+ trace_start_error_with_name ("lynx_ptrace");
+}
+
/* Implement the create_inferior method of the target_ops vector. */
static int
-lynx_create_inferior (char *program, char **allargs)
+lynx_create_inferior (const char *program,
+ const std::vector<char *> &program_args)
{
int pid;
+ std::string str_program_args = stringify_argv (program_args);
lynx_debug ("lynx_create_inferior ()");
- pid = fork ();
- if (pid < 0)
- perror_with_name ("fork");
+ pid = fork_inferior (program,
+ str_program_args.c_str (),
+ get_environ ()->envp (), lynx_ptrace_fun,
+ NULL, NULL, NULL, NULL);
- if (pid == 0)
- {
- int pgrp;
-
- close_most_fds ();
-
- /* Switch child to its own process group so that signals won't
- directly affect gdbserver. */
- pgrp = getpid();
- setpgid (0, pgrp);
- ioctl (0, TIOCSPGRP, &pgrp);
- lynx_ptrace (PTRACE_TRACEME, null_ptid, 0, 0, 0);
- execv (program, allargs);
- fprintf (stderr, "Cannot exec %s: %s.\n", program, strerror (errno));
- fflush (stderr);
- _exit (0177);
- }
+ post_fork_inferior (pid, program);
lynx_add_process (pid, 0);
/* Do not add the process thread just yet, as we do not know its tid.
diff --git a/gdb/gdbserver/nto-low.c b/gdb/gdbserver/nto-low.c
index 6229b4c..a5f1543 100644
--- a/gdb/gdbserver/nto-low.c
+++ b/gdb/gdbserver/nto-low.c
@@ -347,14 +347,17 @@ nto_read_auxv_from_initial_stack (CORE_ADDR initial_stack,
return len_read;
}
-/* Start inferior specified by PROGRAM passing arguments ALLARGS. */
+/* Start inferior specified by PROGRAM, using PROGRAM_ARGS as its
+ arguments. */
static int
-nto_create_inferior (char *program, char **allargs)
+nto_create_inferior (const char *program,
+ const std::vector<char *> &program_args)
{
struct inheritance inherit;
pid_t pid;
sigset_t set;
+ std::string str_program_args = stringify_argv (program_args);
TRACE ("%s %s\n", __func__, program);
/* Clear any pending SIGUSR1's but keep the behavior the same. */
@@ -367,7 +370,8 @@ nto_create_inferior (char *program, char **allargs)
memset (&inherit, 0, sizeof (inherit));
inherit.flags |= SPAWN_SETGROUP | SPAWN_HOLD;
inherit.pgroup = SPAWN_NEWPGROUP;
- pid = spawnp (program, 0, NULL, &inherit, allargs, 0);
+ pid = spawnp (program, 0, NULL, &inherit,
+ (char *) str_program_args.c_str (), 0);
sigprocmask (SIG_BLOCK, &set, NULL);
if (pid == -1)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 69fcab1..3838351 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -36,6 +36,19 @@
#include "dll.h"
#include "hostio.h"
#include <vector>
+#include "common-inferior.h"
+#include "job-control.h"
+#include "environ.h"
+
+/* The environment to pass to the inferior when creating it. */
+
+static gdb_environ our_environ;
+
+/* Start the inferior using a shell. */
+
+/* We always try to start the inferior using a shell. */
+
+int startup_with_shell = 1;
/* The thread set with an `Hc' packet. `Hc' is deprecated in favor of
`vCont'. Note the multi-process extensions made `vCont' a
@@ -79,8 +92,9 @@ static int vCont_supported;
space randomization feature before starting an inferior. */
int disable_randomization = 1;
-static std::vector<char *> program_argv;
-static std::vector<char *> wrapper_argv;
+static char *program_name = NULL;
+static std::vector<char *> program_args;
+static std::string wrapper_argv;
int pass_signals[GDB_SIGNAL_LAST];
int program_signals[GDB_SIGNAL_LAST];
@@ -93,22 +107,6 @@ int program_signals_p;
unsigned long signal_pid;
-#ifdef SIGTTOU
-/* A file descriptor for the controlling terminal. */
-int terminal_fd;
-
-/* TERMINAL_FD's original foreground group. */
-pid_t old_foreground_pgrp;
-
-/* Hand back terminal ownership to the original foreground group. */
-
-static void
-restore_old_foreground_pgrp (void)
-{
- tcsetpgrp (terminal_fd, old_foreground_pgrp);
-}
-#endif
-
/* Set if you want to disable optional thread related packets support
in gdbserver, for the sake of testing GDB against stubs that don't
support them. */
@@ -118,8 +116,8 @@ int disable_packet_qC;
int disable_packet_qfThreadInfo;
/* Last status reported to GDB. */
-static struct target_waitstatus last_status;
-static ptid_t last_ptid;
+struct target_waitstatus last_status;
+ptid_t last_ptid;
char *own_buf;
static unsigned char *mem_buf;
@@ -238,94 +236,31 @@ target_running (void)
return get_first_thread () != NULL;
}
-static int
-start_inferior (char **argv)
-{
- std::vector<char *> new_argv;
-
- if (!wrapper_argv.empty ())
- new_argv.insert (new_argv.begin (),
- wrapper_argv.begin (),
- wrapper_argv.end ());
-
- for (int i = 0; argv[i] != NULL; ++i)
- new_argv.push_back (argv[i]);
-
- new_argv.push_back (NULL);
-
- if (debug_threads)
- {
- for (int i = 0; i < new_argv.size (); ++i)
- debug_printf ("new_argv[%d] = \"%s\"\n", i, new_argv[i]);
- debug_flush ();
- }
+/* See common/common-inferior.h. */
-#ifdef SIGTTOU
- signal (SIGTTOU, SIG_DFL);
- signal (SIGTTIN, SIG_DFL);
-#endif
-
- signal_pid = create_inferior (new_argv[0], &new_argv[0]);
-
- /* FIXME: we don't actually know at this point that the create
- actually succeeded. We won't know that until we wait. */
- fprintf (stderr, "Process %s created; pid = %ld\n", argv[0],
- signal_pid);
- fflush (stderr);
-
-#ifdef SIGTTOU
- signal (SIGTTOU, SIG_IGN);
- signal (SIGTTIN, SIG_IGN);
- terminal_fd = fileno (stderr);
- old_foreground_pgrp = tcgetpgrp (terminal_fd);
- tcsetpgrp (terminal_fd, signal_pid);
- atexit (restore_old_foreground_pgrp);
-#endif
-
- if (!wrapper_argv.empty ())
- {
- ptid_t ptid = pid_to_ptid (signal_pid);
-
- last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
-
- if (last_status.kind == TARGET_WAITKIND_STOPPED)
- {
- do
- {
- target_continue_no_signal (ptid);
+const char *
+get_exec_wrapper ()
+{
+ return !wrapper_argv.empty () ? wrapper_argv.c_str () : NULL;
+}
- last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
- if (last_status.kind != TARGET_WAITKIND_STOPPED)
- break;
+/* See common/common-inferior.h. */
- current_thread->last_resume_kind = resume_stop;
- current_thread->last_status = last_status;
- }
- while (last_status.value.sig != GDB_SIGNAL_TRAP);
- }
- target_post_create_inferior ();
- return signal_pid;
- }
+char *
+get_exec_file (int err)
+{
+ if (err && program_name == NULL)
+ error (_("No executable file specified."));
- /* Wait till we are at 1st instruction in program, return new pid
- (assuming success). */
- last_ptid = mywait (pid_to_ptid (signal_pid), &last_status, 0, 0);
+ return program_name;
+}
- /* At this point, the target process, if it exits, is stopped. Do not call
- the function target_post_create_inferior if the process has already
- exited, as the target implementation of the routine may rely on the
- process being live. */
- if (last_status.kind != TARGET_WAITKIND_EXITED
- && last_status.kind != TARGET_WAITKIND_SIGNALLED)
- {
- target_post_create_inferior ();
- current_thread->last_resume_kind = resume_stop;
- current_thread->last_status = last_status;
- }
- else
- target_mourn_inferior (last_ptid);
+/* See server.h. */
- return signal_pid;
+gdb_environ *
+get_environ ()
+{
+ return &our_environ;
}
static int
@@ -832,6 +767,31 @@ handle_general_set (char *own_buf)
return;
}
+ if (startswith (own_buf, "QStartupWithShell:"))
+ {
+ const char *value = own_buf + strlen ("QStartupWithShell:");
+
+ if (strcmp (value, "1") == 0)
+ startup_with_shell = true;
+ else if (strcmp (value, "0") == 0)
+ startup_with_shell = false;
+ else
+ {
+ /* Unknown value. */
+ fprintf (stderr, "Unknown value to startup-with-shell: %s\n",
+ own_buf);
+ write_enn (own_buf);
+ return;
+ }
+
+ if (remote_debug)
+ debug_printf (_("[Inferior will %s started with shell]"),
+ startup_with_shell ? "be" : "not be");
+
+ write_ok (own_buf);
+ return;
+ }
+
/* Otherwise we didn't know what packet it was. Say we didn't
understand it. */
own_buf[0] = 0;
@@ -2268,7 +2228,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
}
sprintf (own_buf,
- "PacketSize=%x;QPassSignals+;QProgramSignals+",
+ "PacketSize=%x;QPassSignals+;QProgramSignals+;QStartupWithShell+",
PBUFSIZ - 1);
if (target_supports_catch_syscall ())
@@ -2848,6 +2808,7 @@ handle_v_run (char *own_buf)
{
char *p, *next_p;
std::vector<char *> new_argv;
+ char *new_program_name = NULL;
int i, new_argc;
new_argc = 0;
@@ -2866,42 +2827,94 @@ handle_v_run (char *own_buf)
if (i == 0 && p == next_p)
{
/* No program specified. */
- new_argv.push_back (NULL);
+ new_program_name = NULL;
+ }
+ else if (p == next_p)
+ {
+ /* Empty argument. */
+ new_argv.push_back (xstrdup ("''"));
}
else
{
size_t len = (next_p - p) / 2;
+ /* ARG is the unquoted argument received via the RSP. */
char *arg = (char *) xmalloc (len + 1);
+ /* FULL_ARGS will contain the quoted version of ARG. */
+ char *full_arg = (char *) xmalloc ((len + 1) * 2);
+ /* These are pointers used to navigate the strings above. */
+ char *tmp_arg = arg;
+ char *tmp_full_arg = full_arg;
+ int need_quote = 0;
hex2bin (p, (gdb_byte *) arg, len);
arg[len] = '\0';
- new_argv.push_back (arg);
- }
+ while (*tmp_arg != '\0')
+ {
+ switch (*tmp_arg)
+ {
+ case '\n':
+ /* Quote \n. */
+ *tmp_full_arg = '\'';
+ ++tmp_full_arg;
+ need_quote = 1;
+ break;
+
+ case '\'':
+ /* Quote single quote. */
+ *tmp_full_arg = '\\';
+ ++tmp_full_arg;
+ break;
+
+ default:
+ break;
+ }
+
+ *tmp_full_arg = *tmp_arg;
+ ++tmp_full_arg;
+ ++tmp_arg;
+ }
+
+ if (need_quote)
+ *tmp_full_arg++ = '\'';
+
+ /* Finish FULL_ARG and push it into the vector containing
+ the argv. */
+ *tmp_full_arg = '\0';
+ if (i == 0)
+ new_program_name = full_arg;
+ else
+ new_argv.push_back (full_arg);
+ xfree (arg);
+ }
if (*next_p)
next_p++;
}
new_argv.push_back (NULL);
- if (new_argv[0] == NULL)
+ if (new_program_name == NULL)
{
/* GDB didn't specify a program to run. Use the program from the
last run with the new argument list. */
- if (program_argv.empty ())
+ if (program_name == NULL)
{
write_enn (own_buf);
free_vector_argv (new_argv);
return 0;
}
-
- new_argv.push_back (xstrdup (program_argv[0]));
+ }
+ else
+ {
+ xfree (program_name);
+ program_name = new_program_name;
}
/* Free the old argv and install the new one. */
- free_vector_argv (program_argv);
- program_argv = new_argv;
+ free_vector_argv (program_args);
+ program_args = new_argv;
+
+ create_inferior (program_name, program_args);
- start_inferior (&program_argv[0]);
if (last_status.kind == TARGET_WAITKIND_STOPPED)
{
prepare_resume_reply (own_buf, last_ptid, &last_status);
@@ -3321,6 +3334,13 @@ gdbserver_usage (FILE *stream)
" --no-disable-randomization\n"
" Don't disable address space randomization when\n"
" starting PROG.\n"
+ " --startup-with-shell\n"
+ " Start PROG using a shell. I.e., execs a shell that\n"
+ " then execs PROG. (default)\n"
+ " --no-startup-with-shell\n"
+ " Exec PROG directly instead of using a shell.\n"
+ " Disables argument globbing and variable substitution\n"
+ " on UNIX-like systems.\n"
"\n"
"Debug options:\n"
"\n"
@@ -3527,10 +3547,17 @@ captured_main (int argc, char *argv[])
tmp = next_arg;
while (*next_arg != NULL && strcmp (*next_arg, "--") != 0)
{
- wrapper_argv.push_back (*next_arg);
+ wrapper_argv += *next_arg;
+ wrapper_argv += ' ';
next_arg++;
}
+ if (!wrapper_argv.empty ())
+ {
+ /* Erase the last whitespace. */
+ wrapper_argv.erase (wrapper_argv.end () - 1);
+ }
+
if (next_arg == tmp || *next_arg == NULL)
{
gdbserver_usage (stderr);
@@ -3606,6 +3633,10 @@ captured_main (int argc, char *argv[])
disable_randomization = 1;
else if (strcmp (*next_arg, "--no-disable-randomization") == 0)
disable_randomization = 0;
+ else if (strcmp (*next_arg, "--startup-with-shell") == 0)
+ startup_with_shell = true;
+ else if (strcmp (*next_arg, "--no-startup-with-shell") == 0)
+ startup_with_shell = false;
else if (strcmp (*next_arg, "--once") == 0)
run_once = 1;
else
@@ -3666,8 +3697,12 @@ captured_main (int argc, char *argv[])
exit (1);
}
+ /* Gather information about the environment. */
+ our_environ = gdb_environ::from_host_environ ();
+
initialize_async_io ();
initialize_low ();
+ have_job_control ();
initialize_event_loop ();
if (target_supports_tracepoints ())
initialize_tracepoint ();
@@ -3681,12 +3716,13 @@ captured_main (int argc, char *argv[])
int i, n;
n = argc - (next_arg - argv);
- for (i = 0; i < n; i++)
- program_argv.push_back (xstrdup (next_arg[i]));
- program_argv.push_back (NULL);
+ program_name = xstrdup (next_arg[0]);
+ for (i = 1; i < n; i++)
+ program_args.push_back (xstrdup (next_arg[i]));
+ program_args.push_back (NULL);
/* Wait till we are at first instruction in program. */
- start_inferior (&program_argv[0]);
+ create_inferior (program_name, program_args);
/* We are now (hopefully) stopped at the first instruction of
the target process. This assumes that the target process was
@@ -4301,9 +4337,10 @@ process_serial_event (void)
fprintf (stderr, "GDBserver restarting\n");
/* Wait till we are at 1st instruction in prog. */
- if (!program_argv.empty ())
+ if (program_name != NULL)
{
- start_inferior (&program_argv[0]);
+ create_inferior (program_name, program_args);
+
if (last_status.kind == TARGET_WAITKIND_STOPPED)
{
/* Stopped at the first instruction of the target
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index d5fee38..46b614c 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -62,6 +62,7 @@ int vsnprintf(char *str, size_t size, const char *format, va_list ap);
#include "mem-break.h"
#include "gdbthread.h"
#include "inferiors.h"
+#include "environ.h"
/* Target-specific functions */
@@ -148,4 +149,17 @@ extern int in_queued_stop_replies (ptid_t ptid);
/* Definition for any syscall, used for unfiltered syscall reporting. */
#define ANY_SYSCALL (-2)
+/* After fork_inferior has been called, we need to adjust a few
+ signals and call startup_inferior to start the inferior and consume
+ its first events. This is done here. PID is the pid of the new
+ inferior and PROGRAM is its name. */
+extern void post_fork_inferior (int pid, const char *program);
+
+/* Get the gdb_environ being used in the current session. */
+extern gdb_environ *get_environ ();
+
+extern target_waitstatus last_status;
+extern ptid_t last_ptid;
+extern unsigned long signal_pid;
+
#endif /* SERVER_H */
diff --git a/gdb/gdbserver/spu-low.c b/gdb/gdbserver/spu-low.c
index 117b871..6362502 100644
--- a/gdb/gdbserver/spu-low.c
+++ b/gdb/gdbserver/spu-low.c
@@ -27,6 +27,7 @@
#include <sys/syscall.h>
#include "filestuff.h"
#include "hostio.h"
+#include "nat/fork-inferior.h"
/* Some older glibc versions do not define this. */
#ifndef __WNOTHREAD
@@ -261,36 +262,37 @@ spu_proc_xfer_spu (const char *annex, unsigned char *readbuf,
return ret;
}
+/* Callback to be used when calling fork_inferior, responsible for
+ actually initiating the tracing of the inferior. */
+
+static void
+spu_ptrace_fun ()
+{
+ if (ptrace (PTRACE_TRACEME, 0, 0, 0) < 0)
+ trace_start_error_with_name ("ptrace");
+ if (setpgid (0, 0) < 0)
+ trace_start_error_with_name ("setpgid");
+}
/* Start an inferior process and returns its pid.
- ALLARGS is a vector of program-name and args. */
+ PROGRAM is the name of the program to be started, and PROGRAM_ARGS
+ are its arguments. */
+
static int
-spu_create_inferior (char *program, char **allargs)
+spu_create_inferior (const char *program,
+ const std::vector<char *> &program_argv)
{
int pid;
ptid_t ptid;
struct process_info *proc;
+ std::string str_program_args = stringify_argv (program_args);
- pid = fork ();
- if (pid < 0)
- perror_with_name ("fork");
-
- if (pid == 0)
- {
- close_most_fds ();
- ptrace (PTRACE_TRACEME, 0, 0, 0);
-
- setpgid (0, 0);
-
- execv (program, allargs);
- if (errno == ENOENT)
- execvp (program, allargs);
+ pid = fork_inferior (program,
+ str_program_args.c_str (),
+ get_environ ()->envp (), spu_ptrace_fun,
+ NULL, NULL, NULL, NULL);
- fprintf (stderr, "Cannot exec %s: %s.\n", program,
- strerror (errno));
- fflush (stderr);
- _exit (0177);
- }
+ post_fork_inferior (pid, program);
proc = add_process (pid, 0);
proc->tdesc = tdesc_spu;
diff --git a/gdb/gdbserver/target.c b/gdb/gdbserver/target.c
index fda72e8..7526463 100644
--- a/gdb/gdbserver/target.c
+++ b/gdb/gdbserver/target.c
@@ -387,3 +387,30 @@ default_breakpoint_kind_from_pc (CORE_ADDR *pcptr)
(*the_target->sw_breakpoint_from_kind) (0, &size);
return size;
}
+
+/* See target/target.h. */
+
+void
+target_terminal_init ()
+{
+ /* Placeholder needed because of fork_inferior. Not necessary on
+ GDBserver. */
+}
+
+/* See target/target.h. */
+
+void
+target_terminal_inferior ()
+{
+ /* Placeholder needed because of fork_inferior. Not necessary on
+ GDBserver. */
+}
+
+/* See target/target.h. */
+
+void
+target_terminal_ours ()
+{
+ /* Placeholder needed because of fork_inferior. Not necessary on
+ GDBserver. */
+}
diff --git a/gdb/gdbserver/target.h b/gdb/gdbserver/target.h
index 3cc2bc4..be89258 100644
--- a/gdb/gdbserver/target.h
+++ b/gdb/gdbserver/target.h
@@ -28,6 +28,7 @@
#include "target/waitstatus.h"
#include "mem-break.h"
#include "btrace-common.h"
+#include <vector>
struct emit_ops;
struct buffer;
@@ -67,13 +68,13 @@ struct target_ops
/* Start a new process.
PROGRAM is a path to the program to execute.
- ARGS is a standard NULL-terminated array of arguments,
- to be passed to the inferior as ``argv''.
+ PROGRAM_ARGS is a standard NULL-terminated array of arguments,
+ to be passed to the inferior as ``argv'' (along with PROGRAM).
Returns the new PID on success, -1 on failure. Registers the new
process with the process list. */
-
- int (*create_inferior) (char *program, char **args);
+ int (*create_inferior) (const char *program,
+ const std::vector<char *> &program_args);
/* Do additional setup after a new process is created, including
exec-wrapper completion. */
@@ -480,8 +481,8 @@ extern struct target_ops *the_target;
void set_target_ops (struct target_ops *);
-#define create_inferior(program, args) \
- (*the_target->create_inferior) (program, args)
+#define create_inferior(program, program_args) \
+ (*the_target->create_inferior) (program, program_args)
#define target_post_create_inferior() \
do \
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index 7b09f4b..88f6911 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -608,13 +608,13 @@ create_process (const char *program, char *args,
}
/* Start a new process.
- PROGRAM is a path to the program to execute.
- ARGS is a standard NULL-terminated array of arguments,
- to be passed to the inferior as ``argv''.
+ PROGRAM is the program name.
+ PROGRAM_ARGS is the vector containing the inferior's args.
Returns the new PID on success, -1 on failure. Registers the new
process with the process list. */
static int
-win32_create_inferior (char *program, char **program_args)
+win32_create_inferior (const char *program,
+ const std::vector<char *> &program_args)
{
#ifndef USE_WIN32API
char real_path[PATH_MAX];
@@ -622,11 +622,12 @@ win32_create_inferior (char *program, char **program_args)
#endif
BOOL ret;
DWORD flags;
- char *args;
int argslen;
int argc;
PROCESS_INFORMATION pi;
DWORD err;
+ std::string str_program_args = stringify_argv (program_args);
+ char *args = (char *) str_program_args.c_str ();
/* win32_wait needs to know we're not attaching. */
attaching = 0;
@@ -652,18 +653,6 @@ win32_create_inferior (char *program, char **program_args)
program = real_path;
#endif
- argslen = 1;
- for (argc = 1; program_args[argc]; argc++)
- argslen += strlen (program_args[argc]) + 1;
- args = (char *) alloca (argslen);
- args[0] = '\0';
- for (argc = 1; program_args[argc]; argc++)
- {
- /* FIXME: Can we do better about quoting? How does Cygwin
- handle this? */
- strcat (args, " ");
- strcat (args, program_args[argc]);
- }
OUTMSG2 (("Command line is \"%s\"\n", args));
#ifdef CREATE_NEW_PROCESS_GROUP
diff --git a/gdb/gdbthread.h b/gdb/gdbthread.h
index 7bf2070..046bf95 100644
--- a/gdb/gdbthread.h
+++ b/gdb/gdbthread.h
@@ -32,6 +32,7 @@ struct symtab;
#include "target/waitstatus.h"
#include "cli/cli-utils.h"
#include "common/refcounted-object.h"
+#include "common-gdbthread.h"
/* Frontend view of the thread state. Possible extensions: stepping,
finishing, until(ling),... */
@@ -493,10 +494,6 @@ extern struct thread_info *iterate_over_threads (thread_callback_func, void *);
extern int thread_count (void);
-/* Switch from one thread to another. Also sets the STOP_PC
- global. */
-extern void switch_to_thread (ptid_t ptid);
-
/* Switch from one thread to another. Does not read registers and
sets STOP_PC to -1. */
extern void switch_to_thread_no_regs (struct thread_info *thread);
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 6298103..d5e3841 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2143,6 +2143,11 @@ gnu_create_inferior (struct target_ops *ops,
pid = fork_inferior (exec_file, allargs, env, gnu_ptrace_me,
NULL, NULL, NULL, NULL);
+ /* We have something that executes now. We'll be running through
+ the shell at this point (if startup-with-shell is true), but the
+ pid shouldn't change. */
+ add_thread_silent (pid_to_ptid (pid));
+
/* Attach to the now stopped child, which is actually a shell... */
inf_debug (inf, "attaching to child: %d", pid);
@@ -2162,7 +2167,8 @@ gnu_create_inferior (struct target_ops *ops,
thread_change_ptid (inferior_ptid,
ptid_build (inf->pid, inf_pick_first_thread (), 0));
- startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
+ gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
+
inf->pending_execs = 0;
/* Get rid of the old shell threads. */
prune_threads ();
diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c
index 1909d61..d381e41 100644
--- a/gdb/i386-linux-tdep.c
+++ b/gdb/i386-linux-tdep.c
@@ -1059,8 +1059,6 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_displaced_step_copy_insn (gdbarch,
i386_linux_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, i386_displaced_step_fixup);
- set_gdbarch_displaced_step_free_closure (gdbarch,
- simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch,
linux_displaced_step_location);
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index fe68486..bd728f0 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -4011,7 +4011,7 @@ i386_print_insn (bfd_vma pc, struct disassemble_info *info)
info->disassembler_options = disassembly_flavor;
- return print_insn_i386 (pc, info);
+ return default_print_insn (pc, info);
}
diff --git a/gdb/ia64-libunwind-tdep.c b/gdb/ia64-libunwind-tdep.c
index 4b716c4..025c870 100644
--- a/gdb/ia64-libunwind-tdep.c
+++ b/gdb/ia64-libunwind-tdep.c
@@ -36,6 +36,7 @@
#include "ia64-libunwind-tdep.h"
#include "complaints.h"
+#include "common/preprocessor.h"
/* IA-64 is the only target that currently uses ia64-libunwind-tdep.
Note how UNW_TARGET, UNW_OBJ, etc. are compile time constants below.
@@ -99,8 +100,6 @@ struct libunwind_frame_cache
/* We need to qualify the function names with a platform-specific prefix
to match the names used by the libunwind library. The UNW_OBJ macro is
provided by the libunwind.h header file. */
-#define STRINGIFY2(name) #name
-#define STRINGIFY(name) STRINGIFY2(name)
#ifndef LIBUNWIND_SO
/* Use the stable ABI major version number. `libunwind-ia64.so' is a link time
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 7282acb..5a16db1 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -125,6 +125,9 @@ static CORE_ADDR ia64_find_global_pointer (struct gdbarch *gdbarch,
#define NUM_IA64_RAW_REGS 462
+/* Big enough to hold a FP register in bytes. */
+#define IA64_FP_REGISTER_SIZE 16
+
static int sp_regnum = IA64_GR12_REGNUM;
/* NOTE: we treat the register stack registers r32-r127 as
@@ -1228,7 +1231,7 @@ ia64_register_to_value (struct frame_info *frame, int regnum,
int *optimizedp, int *unavailablep)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte in[MAX_REGISTER_SIZE];
+ gdb_byte in[IA64_FP_REGISTER_SIZE];
/* Convert to TYPE. */
if (!get_frame_register_bytes (frame, regnum, 0,
@@ -1246,7 +1249,7 @@ ia64_value_to_register (struct frame_info *frame, int regnum,
struct type *valtype, const gdb_byte *in)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
- gdb_byte out[MAX_REGISTER_SIZE];
+ gdb_byte out[IA64_FP_REGISTER_SIZE];
convert_typed_floating (in, valtype, out, ia64_ext_type (gdbarch));
put_frame_register (frame, regnum, out);
}
@@ -3209,7 +3212,7 @@ ia64_extract_return_value (struct type *type, struct regcache *regcache,
float_elt_type = is_float_or_hfa_type (type);
if (float_elt_type != NULL)
{
- gdb_byte from[MAX_REGISTER_SIZE];
+ gdb_byte from[IA64_FP_REGISTER_SIZE];
int offset = 0;
int regnum = IA64_FR8_REGNUM;
int n = TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type);
@@ -3274,7 +3277,7 @@ ia64_store_return_value (struct type *type, struct regcache *regcache,
float_elt_type = is_float_or_hfa_type (type);
if (float_elt_type != NULL)
{
- gdb_byte to[MAX_REGISTER_SIZE];
+ gdb_byte to[IA64_FP_REGISTER_SIZE];
int offset = 0;
int regnum = IA64_FR8_REGNUM;
int n = TYPE_LENGTH (type) / TYPE_LENGTH (float_elt_type);
@@ -3836,7 +3839,7 @@ ia64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
len = TYPE_LENGTH (type);
while (len > 0 && floatreg < IA64_FR16_REGNUM)
{
- gdb_byte to[MAX_REGISTER_SIZE];
+ gdb_byte to[IA64_FP_REGISTER_SIZE];
convert_typed_floating (value_contents (arg) + argoffset,
float_elt_type, to,
ia64_ext_type (gdbarch));
@@ -3923,7 +3926,7 @@ static int
ia64_print_insn (bfd_vma memaddr, struct disassemble_info *info)
{
info->bytes_per_line = SLOT_MULTIPLIER;
- return print_insn_ia64 (memaddr, info);
+ return default_print_insn (memaddr, info);
}
/* The default "size_of_register_frame" gdbarch_tdep routine for ia64. */
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index b19aaf9..af181f0 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -31,6 +31,8 @@
#include "inf-ptrace.h"
#include "inf-child.h"
#include "gdbthread.h"
+#include "nat/fork-inferior.h"
+#include "utils.h"
@@ -93,7 +95,8 @@ inf_ptrace_create_inferior (struct target_ops *ops,
const char *exec_file, const std::string &allargs,
char **env, int from_tty)
{
- int pid;
+ pid_t pid;
+ ptid_t ptid;
/* Do not change either targets above or the same target if already present.
The reason is the target stack is shared across multiple inferiors. */
@@ -110,13 +113,19 @@ inf_ptrace_create_inferior (struct target_ops *ops,
pid = fork_inferior (exec_file, allargs, env, inf_ptrace_me, NULL,
NULL, NULL, NULL);
+ ptid = pid_to_ptid (pid);
+ /* We have something that executes now. We'll be running through
+ the shell at this point (if startup-with-shell is true), but the
+ pid shouldn't change. */
+ add_thread_silent (ptid);
+
discard_cleanups (back_to);
- startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
+ gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
/* On some targets, there must be some explicit actions taken after
the inferior has been started up. */
- target_post_startup_inferior (pid_to_ptid (pid));
+ target_post_startup_inferior (ptid);
}
#ifdef PT_GET_PROCESS_STATE
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 09060b5..defa7b0 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -610,7 +610,7 @@ run_command_1 (char *args, int from_tty, int tbreak_at_main)
the value now. */
run_target->to_create_inferior (run_target, exec_file,
std::string (get_inferior_args ()),
- environ_vector (current_inferior ()->environment),
+ current_inferior ()->environment.envp (),
from_tty);
/* to_create_inferior should push the target, so after this point we
shouldn't refer to run_target again. */
@@ -2131,7 +2131,7 @@ environment_info (char *var, int from_tty)
{
if (var)
{
- char *val = get_in_environ (current_inferior ()->environment, var);
+ const char *val = current_inferior ()->environment.get (var);
if (val)
{
@@ -2149,11 +2149,11 @@ environment_info (char *var, int from_tty)
}
else
{
- char **vector = environ_vector (current_inferior ()->environment);
+ char **envp = current_inferior ()->environment.envp ();
- while (*vector)
+ for (int idx = 0; envp[idx] != NULL; ++idx)
{
- puts_filtered (*vector++);
+ puts_filtered (envp[idx]);
puts_filtered ("\n");
}
}
@@ -2215,10 +2215,10 @@ set_environment_command (char *arg, int from_tty)
printf_filtered (_("Setting environment variable "
"\"%s\" to null value.\n"),
var);
- set_in_environ (current_inferior ()->environment, var, "");
+ current_inferior ()->environment.set (var, "");
}
else
- set_in_environ (current_inferior ()->environment, var, val);
+ current_inferior ()->environment.set (var, val);
xfree (var);
}
@@ -2230,13 +2230,10 @@ unset_environment_command (char *var, int from_tty)
/* If there is no argument, delete all environment variables.
Ask for confirmation if reading from the terminal. */
if (!from_tty || query (_("Delete all environment variables? ")))
- {
- free_environ (current_inferior ()->environment);
- current_inferior ()->environment = make_environ ();
- }
+ current_inferior ()->environment = gdb_environ::from_host_environ ();
}
else
- unset_in_environ (current_inferior ()->environment, var);
+ current_inferior ()->environment.unset (var);
}
/* Handle the execution path (PATH variable). */
@@ -2247,8 +2244,7 @@ static void
path_info (char *args, int from_tty)
{
puts_filtered ("Executable and object file path: ");
- puts_filtered (get_in_environ (current_inferior ()->environment,
- path_var_name));
+ puts_filtered (current_inferior ()->environment.get (path_var_name));
puts_filtered ("\n");
}
@@ -2261,13 +2257,13 @@ path_command (char *dirname, int from_tty)
const char *env;
dont_repeat ();
- env = get_in_environ (current_inferior ()->environment, path_var_name);
+ env = current_inferior ()->environment.get (path_var_name);
/* Can be null if path is not set. */
if (!env)
env = "";
exec_path = xstrdup (env);
mod_path (dirname, &exec_path);
- set_in_environ (current_inferior ()->environment, path_var_name, exec_path);
+ current_inferior ()->environment.set (path_var_name, exec_path);
xfree (exec_path);
if (from_tty)
path_info ((char *) NULL, from_tty);
@@ -2310,7 +2306,8 @@ default_print_one_register_info (struct ui_file *file,
if (print_raw_format)
{
fprintf_filtered (file, "\t(raw ");
- print_hex_chars (file, valaddr, TYPE_LENGTH (regtype), byte_order);
+ print_hex_chars (file, valaddr, TYPE_LENGTH (regtype), byte_order,
+ true);
fprintf_filtered (file, ")");
}
}
@@ -3399,13 +3396,16 @@ Specifying -a and an ignore count simultaneously is an error."));
c = add_com ("run", class_run, run_command, _("\
Start debugged program. You may specify arguments to give it.\n\
-Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\
-Input and output redirection with \">\", \"<\", or \">>\" are also \
-allowed.\n\n\
+Args may include \"*\", or \"[...]\"; they are expanded using the\n\
+shell that will start the program (specified by the \"$SHELL\"\
+environment\nvariable). Input and output redirection with \">\",\
+\"<\", or \">>\"\nare also allowed.\n\n\
With no arguments, uses arguments last specified (with \"run\" \
or \"set args\").\n\
To cancel previous arguments and run with no arguments,\n\
-use \"set args\" without arguments."));
+use \"set args\" without arguments.\n\
+To start the inferior without using a shell, use \"set \
+startup-with-shell off\"."));
set_cmd_completer (c, filename_completer);
add_com_alias ("r", "run", class_run, 1);
diff --git a/gdb/inferior.c b/gdb/inferior.c
index 0b655f4..9fa2dad 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -81,7 +81,6 @@ inferior::~inferior ()
inferior_free_data (inf);
xfree (inf->args);
xfree (inf->terminal);
- free_environ (inf->environment);
target_desc_info_free (inf->tdesc_info);
xfree (inf->priv);
}
@@ -89,10 +88,9 @@ inferior::~inferior ()
inferior::inferior (int pid_)
: num (++highest_inferior_num),
pid (pid_),
- environment (make_environ ()),
+ environment (gdb_environ::from_host_environ ()),
registry_data ()
{
- init_environ (this->environment);
inferior_alloc_data (this);
}
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 7ee92ed..8ada4f8 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -30,7 +30,6 @@ struct regcache;
struct ui_out;
struct terminal_info;
struct target_desc_info;
-struct gdb_environ;
struct continuation;
struct inferior;
@@ -43,12 +42,17 @@ struct inferior;
/* For struct frame_id. */
#include "frame.h"
+/* For gdb_environ. */
+#include "environ.h"
+
#include "progspace.h"
#include "registry.h"
#include "symfile-add-flags.h"
#include "common/refcounted-object.h"
+#include "common-inferior.h"
+
struct infcall_suspend_state;
struct infcall_control_state;
@@ -136,28 +140,10 @@ extern void child_terminal_init_with_pgrp (int pgrp);
/* From fork-child.c */
-/* Report an error that happened when starting to trace the inferior
- (i.e., when the "traceme_fun" callback is called on fork_inferior)
- and bail out. This function does not return. */
-
-extern void trace_start_error (const char *fmt, ...)
- ATTRIBUTE_NORETURN;
-
-/* Like "trace_start_error", but the error message is constructed by
- combining STRING with the system error message for errno. This
- function does not return. */
-
-extern void trace_start_error_with_name (const char *string)
- ATTRIBUTE_NORETURN;
-
-extern int fork_inferior (const char *, const std::string &, char **,
- void (*)(void),
- void (*)(int), void (*)(void), char *,
- void (*)(const char *,
- char * const *, char * const *));
-
-
-extern void startup_inferior (int);
+/* Helper function to call STARTUP_INFERIOR with PID and NUM_TRAPS.
+ This function already calls set_executing. Return the ptid_t from
+ STARTUP_INFERIOR. */
+extern ptid_t gdb_startup_inferior (pid_t pid, int num_traps);
extern char *construct_inferior_arguments (int, char **);
@@ -282,12 +268,6 @@ enum stop_kind
#define ON_STACK 1
#define AT_ENTRY_POINT 4
-/* Number of traps that happen between exec'ing the shell to run an
- inferior and when we finally get to the inferior code, not counting
- the exec for the shell. This is 1 on all supported
- implementations. */
-#define START_INFERIOR_TRAPS_EXPECTED 1
-
struct private_inferior;
/* Inferior process specific part of `struct infcall_control_state'.
@@ -385,7 +365,7 @@ public:
/* Environment to use for running inferior,
in format described in environ.h. */
- gdb_environ *environment = NULL;
+ gdb_environ environment;
/* True if this child process was attached rather than forked. */
bool attach_flag = false;
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 23dcc4d..01851f4 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -32,6 +32,7 @@
#include "inflow.h"
#include "gdbcmd.h"
#include "gdb_termios.h"
+#include "job-control.h"
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
@@ -804,43 +805,6 @@ create_tty_session (void)
#endif /* HAVE_SETSID */
}
-/* This is here because this is where we figure out whether we (probably)
- have job control. Just using job_control only does part of it because
- setpgid or setpgrp might not exist on a system without job control.
- It might be considered misplaced (on the other hand, process groups and
- job control are closely related to ttys).
-
- For a more clean implementation, in libiberty, put a setpgid which merely
- calls setpgrp and a setpgrp which does nothing (any system with job control
- will have one or the other). */
-int
-gdb_setpgid (void)
-{
- int retval = 0;
-
- if (job_control)
- {
-#if defined (HAVE_TERMIOS) || defined (TIOCGPGRP)
-#ifdef HAVE_SETPGID
- /* The call setpgid (0, 0) is supposed to work and mean the same
- thing as this, but on Ultrix 4.2A it fails with EPERM (and
- setpgid (getpid (), getpid ()) succeeds). */
- retval = setpgid (getpid (), getpid ());
-#else
-#ifdef HAVE_SETPGRP
-#ifdef SETPGRP_VOID
- retval = setpgrp ();
-#else
- retval = setpgrp (getpid (), getpid ());
-#endif
-#endif /* HAVE_SETPGRP */
-#endif /* HAVE_SETPGID */
-#endif /* defined (HAVE_TERMIOS) || defined (TIOCGPGRP) */
- }
-
- return retval;
-}
-
/* Get all the current tty settings (including whether we have a
tty at all!). We can't do this in _initialize_inflow because
serial_fdopen() won't work until the serial_ops_list is
@@ -861,30 +825,8 @@ _initialize_inflow (void)
terminal_is_ours = 1;
- /* OK, figure out whether we have job control. If neither termios nor
- sgtty (i.e. termio or go32), leave job_control 0. */
-
-#if defined (HAVE_TERMIOS)
- /* Do all systems with termios have the POSIX way of identifying job
- control? I hope so. */
-#ifdef _POSIX_JOB_CONTROL
- job_control = 1;
-#else
-#ifdef _SC_JOB_CONTROL
- job_control = sysconf (_SC_JOB_CONTROL);
-#else
- job_control = 0; /* Have to assume the worst. */
-#endif /* _SC_JOB_CONTROL */
-#endif /* _POSIX_JOB_CONTROL */
-#endif /* HAVE_TERMIOS */
-
-#ifdef HAVE_SGTTY
-#ifdef TIOCGPGRP
- job_control = 1;
-#else
- job_control = 0;
-#endif /* TIOCGPGRP */
-#endif /* sgtty */
+ /* OK, figure out whether we have job control. */
+ have_job_control ();
observer_attach_inferior_exit (inflow_inferior_exit);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d0504de..5e4cd51 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1710,12 +1710,8 @@ displaced_step_clear (struct displaced_step_inferior_state *displaced)
/* Indicate that there is no cleanup pending. */
displaced->step_ptid = null_ptid;
- if (displaced->step_closure)
- {
- gdbarch_displaced_step_free_closure (displaced->step_gdbarch,
- displaced->step_closure);
- displaced->step_closure = NULL;
- }
+ xfree (displaced->step_closure);
+ displaced->step_closure = NULL;
}
static void
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index b008df0..8b29245 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1045,7 +1045,7 @@ exit_lwp (struct lwp_info *lp)
Returns a wait status for that LWP, to cache. */
static int
-linux_nat_post_attach_wait (ptid_t ptid, int first, int *signalled)
+linux_nat_post_attach_wait (ptid_t ptid, int *signalled)
{
pid_t new_pid, pid = ptid_get_lwp (ptid);
int status;
@@ -1245,7 +1245,7 @@ linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
/* Add the initial process as the first LWP to the list. */
lp = add_initial_lwp (ptid);
- status = linux_nat_post_attach_wait (lp->ptid, 1, &lp->signalled);
+ status = linux_nat_post_attach_wait (lp->ptid, &lp->signalled);
if (!WIFSTOPPED (status))
{
if (WIFEXITED (status))
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 016aadf..1afa8d7 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -38,6 +38,7 @@
#include "gdbcmd.h"
#include "gdb_regex.h"
#include "common/enum-flags.h"
+#include "common/gdb_optional.h"
#include <ctype.h>
@@ -493,6 +494,44 @@ decode_vmflags (char *p, struct smaps_vmflags *v)
}
}
+/* Regexes used by mapping_is_anonymous_p. Put in a structure because
+ they're initialized lazily. */
+
+struct mapping_regexes
+{
+ /* Matches "/dev/zero" filenames (with or without the "(deleted)"
+ string in the end). We know for sure, based on the Linux kernel
+ code, that memory mappings whose associated filename is
+ "/dev/zero" are guaranteed to be MAP_ANONYMOUS. */
+ compiled_regex dev_zero
+ {"^/dev/zero\\( (deleted)\\)\\?$", REG_NOSUB,
+ _("Could not compile regex to match /dev/zero filename")};
+
+ /* Matches "/SYSV%08x" filenames (with or without the "(deleted)"
+ string in the end). These filenames refer to shared memory
+ (shmem), and memory mappings associated with them are
+ MAP_ANONYMOUS as well. */
+ compiled_regex shmem_file
+ {"^/\\?SYSV[0-9a-fA-F]\\{8\\}\\( (deleted)\\)\\?$", REG_NOSUB,
+ _("Could not compile regex to match shmem filenames")};
+
+ /* A heuristic we use to try to mimic the Linux kernel's 'n_link ==
+ 0' code, which is responsible to decide if it is dealing with a
+ 'MAP_SHARED | MAP_ANONYMOUS' mapping. In other words, if
+ FILE_DELETED matches, it does not necessarily mean that we are
+ dealing with an anonymous shared mapping. However, there is no
+ easy way to detect this currently, so this is the best
+ approximation we have.
+
+ As a result, GDB will dump readonly pages of deleted executables
+ when using the default value of coredump_filter (0x33), while the
+ Linux kernel will not dump those pages. But we can live with
+ that. */
+ compiled_regex file_deleted
+ {" (deleted)$", REG_NOSUB,
+ _("Could not compile regex to match '<file> (deleted)'")};
+};
+
/* Return 1 if the memory mapping is anonymous, 0 otherwise.
FILENAME is the name of the file present in the first line of the
@@ -506,52 +545,16 @@ decode_vmflags (char *p, struct smaps_vmflags *v)
static int
mapping_is_anonymous_p (const char *filename)
{
- static regex_t dev_zero_regex, shmem_file_regex, file_deleted_regex;
+ static gdb::optional<mapping_regexes> regexes;
static int init_regex_p = 0;
if (!init_regex_p)
{
- struct cleanup *c = make_cleanup (null_cleanup, NULL);
-
/* Let's be pessimistic and assume there will be an error while
compiling the regex'es. */
init_regex_p = -1;
- /* DEV_ZERO_REGEX matches "/dev/zero" filenames (with or
- without the "(deleted)" string in the end). We know for
- sure, based on the Linux kernel code, that memory mappings
- whose associated filename is "/dev/zero" are guaranteed to be
- MAP_ANONYMOUS. */
- compile_rx_or_error (&dev_zero_regex, "^/dev/zero\\( (deleted)\\)\\?$",
- _("Could not compile regex to match /dev/zero "
- "filename"));
- /* SHMEM_FILE_REGEX matches "/SYSV%08x" filenames (with or
- without the "(deleted)" string in the end). These filenames
- refer to shared memory (shmem), and memory mappings
- associated with them are MAP_ANONYMOUS as well. */
- compile_rx_or_error (&shmem_file_regex,
- "^/\\?SYSV[0-9a-fA-F]\\{8\\}\\( (deleted)\\)\\?$",
- _("Could not compile regex to match shmem "
- "filenames"));
- /* FILE_DELETED_REGEX is a heuristic we use to try to mimic the
- Linux kernel's 'n_link == 0' code, which is responsible to
- decide if it is dealing with a 'MAP_SHARED | MAP_ANONYMOUS'
- mapping. In other words, if FILE_DELETED_REGEX matches, it
- does not necessarily mean that we are dealing with an
- anonymous shared mapping. However, there is no easy way to
- detect this currently, so this is the best approximation we
- have.
-
- As a result, GDB will dump readonly pages of deleted
- executables when using the default value of coredump_filter
- (0x33), while the Linux kernel will not dump those pages.
- But we can live with that. */
- compile_rx_or_error (&file_deleted_regex, " (deleted)$",
- _("Could not compile regex to match "
- "'<file> (deleted)'"));
- /* We will never release these regexes, so just discard the
- cleanups. */
- discard_cleanups (c);
+ regexes.emplace ();
/* If we reached this point, then everything succeeded. */
init_regex_p = 1;
@@ -573,9 +576,9 @@ mapping_is_anonymous_p (const char *filename)
}
if (*filename == '\0'
- || regexec (&dev_zero_regex, filename, 0, NULL, 0) == 0
- || regexec (&shmem_file_regex, filename, 0, NULL, 0) == 0
- || regexec (&file_deleted_regex, filename, 0, NULL, 0) == 0)
+ || regexes->dev_zero.exec (filename, 0, NULL, 0) == 0
+ || regexes->shmem_file.exec (filename, 0, NULL, 0) == 0
+ || regexes->file_deleted.exec (filename, 0, NULL, 0) == 0)
return 1;
return 0;
diff --git a/gdb/main.c b/gdb/main.c
index df4b111..9813041 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -224,7 +224,7 @@ get_init_files (const char **system_gdbinit,
{
/* Append the part of SYSTEM_GDBINIT that follows GDB_DATADIR
to gdb_datadir. */
- char *tmp_sys_gdbinit = xstrdup (SYSTEM_GDBINIT + datadir_len);
+ char *tmp_sys_gdbinit = xstrdup (&SYSTEM_GDBINIT[datadir_len]);
char *p;
for (p = tmp_sys_gdbinit; IS_DIR_SEPARATOR (*p); ++p)
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index cfe2d34..9412af8 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -398,7 +398,7 @@ mi_cmd_break_passcount (const char *command, char **argv, int argc)
if (t)
{
t->pass_count = p;
- observer_notify_breakpoint_modified (&t->base);
+ observer_notify_breakpoint_modified (t);
}
else
{
diff --git a/gdb/mi/mi-cmd-env.c b/gdb/mi/mi-cmd-env.c
index 4093178..bf4578c 100644
--- a/gdb/mi/mi-cmd-env.c
+++ b/gdb/mi/mi-cmd-env.c
@@ -167,7 +167,7 @@ mi_cmd_env_path (const char *command, char **argv, int argc)
else
{
/* Otherwise, get current path to modify. */
- env = get_in_environ (current_inferior ()->environment, path_var_name);
+ env = current_inferior ()->environment.get (path_var_name);
/* Can be null if path is not set. */
if (!env)
@@ -178,9 +178,9 @@ mi_cmd_env_path (const char *command, char **argv, int argc)
for (i = argc - 1; i >= 0; --i)
env_mod_path (argv[i], &exec_path);
- set_in_environ (current_inferior ()->environment, path_var_name, exec_path);
+ current_inferior ()->environment.set (path_var_name, exec_path);
xfree (exec_path);
- env = get_in_environ (current_inferior ()->environment, path_var_name);
+ env = current_inferior ()->environment.get (path_var_name);
uiout->field_string ("path", env);
}
@@ -270,21 +270,17 @@ mi_cmd_inferior_tty_show (const char *command, char **argv, int argc)
void
_initialize_mi_cmd_env (void)
{
- struct gdb_environ *environment;
const char *env;
/* We want original execution path to reset to, if desired later.
At this point, current inferior is not created, so cannot use
- current_inferior ()->environment. Also, there's no obvious
- place where this code can be moved such that it surely run
- before any code possibly mangles original PATH. */
- environment = make_environ ();
- init_environ (environment);
- env = get_in_environ (environment, path_var_name);
+ current_inferior ()->environment. We use getenv here because it
+ is not necessary to create a whole new gdb_environ just for one
+ variable. */
+ env = getenv (path_var_name);
/* Can be null if path is not set. */
if (!env)
env = "";
orig_path = xstrdup (env);
- free_environ (environment);
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index bdc5dda..53289bb 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -55,6 +55,7 @@
#include "gdbcmd.h"
#include "observer.h"
#include "common/gdb_optional.h"
+#include "common/byte-vector.h"
#include <ctype.h>
#include "run-time-clock.h"
@@ -1111,10 +1112,8 @@ register_changed_p (int regnum, struct regcache *prev_regs,
struct regcache *this_regs)
{
struct gdbarch *gdbarch = get_regcache_arch (this_regs);
- gdb_byte prev_buffer[MAX_REGISTER_SIZE];
- gdb_byte this_buffer[MAX_REGISTER_SIZE];
- enum register_status prev_status;
- enum register_status this_status;
+ struct value *prev_value, *this_value;
+ int ret;
/* First time through or after gdbarch change consider all registers
as changed. */
@@ -1122,16 +1121,19 @@ register_changed_p (int regnum, struct regcache *prev_regs,
return 1;
/* Get register contents and compare. */
- prev_status = regcache_cooked_read (prev_regs, regnum, prev_buffer);
- this_status = regcache_cooked_read (this_regs, regnum, this_buffer);
+ prev_value = prev_regs->cooked_read_value (regnum);
+ this_value = this_regs->cooked_read_value (regnum);
+ gdb_assert (prev_value != NULL);
+ gdb_assert (this_value != NULL);
- if (this_status != prev_status)
- return 1;
- else if (this_status == REG_VALID)
- return memcmp (prev_buffer, this_buffer,
- register_size (gdbarch, regnum)) != 0;
- else
- return 0;
+ ret = value_contents_eq (prev_value, 0, this_value, 0,
+ register_size (gdbarch, regnum)) == 0;
+
+ release_value (prev_value);
+ release_value (this_value);
+ value_free (prev_value);
+ value_free (this_value);
+ return ret;
}
/* Return a list of register number and value pairs. The valid
@@ -1465,12 +1467,12 @@ mi_cmd_data_read_memory (const char *command, char **argv, int argc)
/* Create a buffer and read it in. */
total_bytes = word_size * nr_rows * nr_cols;
- std::unique_ptr<gdb_byte[]> mbuf (new gdb_byte[total_bytes]);
+ gdb::byte_vector mbuf (total_bytes);
/* Dispatch memory reads to the topmost target, not the flattened
current_target. */
nr_bytes = target_read (current_target.beneath,
- TARGET_OBJECT_MEMORY, NULL, mbuf.get (),
+ TARGET_OBJECT_MEMORY, NULL, mbuf.data (),
addr, total_bytes);
if (nr_bytes <= 0)
error (_("Unable to read memory."));
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 8041d84..1fd3365 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -38,11 +38,6 @@
#include "nat/mips-linux-watch.h"
-#include "features/mips-linux.c"
-#include "features/mips-dsp-linux.c"
-#include "features/mips64-linux.c"
-#include "features/mips64-dsp-linux.c"
-
#ifndef PTRACE_GET_THREAD_AREA
#define PTRACE_GET_THREAD_AREA 25
#endif
@@ -803,10 +798,4 @@ triggers a breakpoint or watchpoint."),
linux_nat_add_target (t);
linux_nat_set_new_thread (t, mips_linux_new_thread);
-
- /* Initialize the standard target descriptions. */
- initialize_tdesc_mips_linux ();
- initialize_tdesc_mips_dsp_linux ();
- initialize_tdesc_mips64_linux ();
- initialize_tdesc_mips64_dsp_linux ();
}
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index ccfdcdf..f144a2e 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -40,6 +40,11 @@
#include "xml-syscall.h"
#include "gdb_signals.h"
+#include "features/mips-linux.c"
+#include "features/mips-dsp-linux.c"
+#include "features/mips64-linux.c"
+#include "features/mips64-dsp-linux.c"
+
static struct target_so_ops mips_svr4_so_ops;
/* This enum represents the signals' numbers on the MIPS
@@ -1739,4 +1744,10 @@ _initialize_mips_linux_tdep (void)
GDB_OSABI_LINUX,
mips_linux_init_abi);
}
+
+ /* Initialize the standard target descriptions. */
+ initialize_tdesc_mips_linux ();
+ initialize_tdesc_mips_dsp_linux ();
+ initialize_tdesc_mips64_linux ();
+ initialize_tdesc_mips64_dsp_linux ();
}
diff --git a/gdb/mips-linux-tdep.h b/gdb/mips-linux-tdep.h
index 407b577..cca4798 100644
--- a/gdb/mips-linux-tdep.h
+++ b/gdb/mips-linux-tdep.h
@@ -105,3 +105,9 @@ enum {
/* Return 1 if MIPS_RESTART_REGNUM is usable. */
int mips_linux_restart_reg_p (struct gdbarch *gdbarch);
+
+/* Target descriptions. */
+extern struct target_desc *tdesc_mips_linux;
+extern struct target_desc *tdesc_mips64_linux;
+extern struct target_desc *tdesc_mips_dsp_linux;
+extern struct target_desc *tdesc_mips64_dsp_linux;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 82f91ba..c1800e4 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -271,6 +271,9 @@ mips_isa_regsize (struct gdbarch *gdbarch)
/ gdbarch_bfd_arch_info (gdbarch)->bits_per_byte);
}
+/* Max saved register size. */
+#define MAX_MIPS_ABI_REGSIZE 8
+
/* Return the currently configured (or set) saved register size. */
unsigned int
@@ -4476,7 +4479,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
int stack_offset = 0;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
CORE_ADDR func_addr = find_function_addr (function, NULL);
- int regsize = mips_abi_regsize (gdbarch);
+ int abi_regsize = mips_abi_regsize (gdbarch);
/* For shared libraries, "t9" needs to point at the function
address. */
@@ -4499,7 +4502,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
than necessary for EABI, because the first few arguments are
passed in registers, but that's OK. */
for (argnum = 0; argnum < nargs; argnum++)
- len += align_up (TYPE_LENGTH (value_type (args[argnum])), regsize);
+ len += align_up (TYPE_LENGTH (value_type (args[argnum])), abi_regsize);
sp -= align_up (len, 16);
if (mips_debug)
@@ -4528,7 +4531,9 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
for (argnum = 0; argnum < nargs; argnum++)
{
const gdb_byte *val;
- gdb_byte valbuf[MAX_REGISTER_SIZE];
+ /* This holds the address of structures that are passed by
+ reference. */
+ gdb_byte ref_valbuf[MAX_MIPS_ABI_REGSIZE];
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
@@ -4541,14 +4546,15 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* The EABI passes structures that do not fit in a register by
reference. */
- if (len > regsize
+ if (len > abi_regsize
&& (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION))
{
- store_unsigned_integer (valbuf, regsize, byte_order,
+ gdb_assert (abi_regsize <= ARRAY_SIZE (ref_valbuf));
+ store_unsigned_integer (ref_valbuf, abi_regsize, byte_order,
value_address (arg));
typecode = TYPE_CODE_PTR;
- len = regsize;
- val = valbuf;
+ len = abi_regsize;
+ val = ref_valbuf;
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " push");
}
@@ -4560,7 +4566,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
up before the check to see if there are any FP registers
left. Non MIPS_EABI targets also pass the FP in the integer
registers so also round up normal registers. */
- if (regsize < 8 && fp_register_arg_p (gdbarch, typecode, arg_type))
+ if (abi_regsize < 8 && fp_register_arg_p (gdbarch, typecode, arg_type))
{
if ((float_argreg & 1))
float_argreg++;
@@ -4626,12 +4632,12 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* Copy the argument to general registers or the stack in
register-sized pieces. Large arguments are split between
registers and stack. */
- /* Note: structs whose size is not a multiple of regsize
+ /* Note: structs whose size is not a multiple of abi_regsize
are treated specially: Irix cc passes
them in registers where gcc sometimes puts them on the
stack. For maximum compatibility, we will put them in
both places. */
- int odd_sized_struct = (len > regsize && len % regsize != 0);
+ int odd_sized_struct = (len > abi_regsize && len % abi_regsize != 0);
/* Note: Floating-point values that didn't fit into an FP
register are only written to memory. */
@@ -4639,7 +4645,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
{
/* Remember if the argument was written to the stack. */
int stack_used_p = 0;
- int partial_len = (len < regsize ? len : regsize);
+ int partial_len = (len < abi_regsize ? len : abi_regsize);
if (mips_debug)
fprintf_unfiltered (gdb_stdlog, " -- partial=%d",
@@ -4657,15 +4663,15 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
stack_used_p = 1;
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
{
- if (regsize == 8
+ if (abi_regsize == 8
&& (typecode == TYPE_CODE_INT
|| typecode == TYPE_CODE_PTR
|| typecode == TYPE_CODE_FLT) && len <= 4)
- longword_offset = regsize - len;
+ longword_offset = abi_regsize - len;
else if ((typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION)
- && TYPE_LENGTH (arg_type) < regsize)
- longword_offset = regsize - len;
+ && TYPE_LENGTH (arg_type) < abi_regsize)
+ longword_offset = abi_regsize - len;
}
if (mips_debug)
@@ -4706,7 +4712,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
if (mips_debug)
fprintf_filtered (gdb_stdlog, " - reg=%d val=%s",
argreg,
- phex (regval, regsize));
+ phex (regval, abi_regsize));
regcache_cooked_write_signed (regcache, argreg, regval);
argreg++;
}
@@ -4721,7 +4727,7 @@ mips_eabi_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
only needs to be adjusted when it has been used. */
if (stack_used_p)
- stack_offset += align_up (partial_len, regsize);
+ stack_offset += align_up (partial_len, abi_regsize);
}
}
if (mips_debug)
@@ -6536,8 +6542,14 @@ print_gp_register_row (struct ui_file *file, struct frame_info *frame,
value = get_frame_register_value (frame, regnum);
if (value_optimized_out (value)
|| !value_entirely_available (value))
- error (_("can't read register %d (%s)"),
- regnum, gdbarch_register_name (gdbarch, regnum));
+ {
+ fprintf_filtered (file, "%*s ",
+ (int) mips_abi_regsize (gdbarch) * 2,
+ (mips_abi_regsize (gdbarch) == 4 ? "<unavl>"
+ : "<unavailable>"));
+ col++;
+ continue;
+ }
raw_buffer = value_contents_all (value);
/* pad small registers */
for (byte = 0;
@@ -7013,11 +7025,7 @@ gdb_print_insn_mips (bfd_vma memaddr, struct disassemble_info *info)
register naming conventions specified by the user. */
info->disassembler_options = "gpr-names=32";
- /* Call the appropriate disassembler based on the target endian-ness. */
- if (info->endian == BFD_ENDIAN_BIG)
- return print_insn_big_mips (memaddr, info);
- else
- return print_insn_little_mips (memaddr, info);
+ return default_print_insn (memaddr, info);
}
static int
diff --git a/gdb/mn10300-tdep.c b/gdb/mn10300-tdep.c
index f8dd762..669bfa1 100644
--- a/gdb/mn10300-tdep.c
+++ b/gdb/mn10300-tdep.c
@@ -40,6 +40,9 @@
/* The am33-2 has 64 registers. */
#define MN10300_MAX_NUM_REGS 64
+/* Big enough to hold the size of the largest register in bytes. */
+#define MN10300_MAX_REGISTER_SIZE 64
+
/* This structure holds the results of a prologue analysis. */
struct mn10300_prologue
{
@@ -196,7 +199,7 @@ static void
mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
struct regcache *regcache, void *valbuf)
{
- gdb_byte buf[MAX_REGISTER_SIZE];
+ gdb_byte buf[MN10300_MAX_REGISTER_SIZE];
int len = TYPE_LENGTH (type);
int reg, regsz;
@@ -206,6 +209,7 @@ mn10300_extract_return_value (struct gdbarch *gdbarch, struct type *type,
reg = 0;
regsz = register_size (gdbarch, reg);
+ gdb_assert (regsz <= MN10300_MAX_REGISTER_SIZE);
if (len <= regsz)
{
regcache_raw_read (regcache, reg, buf);
@@ -1224,7 +1228,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
int stack_offset = 0;
int argnum;
const gdb_byte *val;
- gdb_byte valbuf[MAX_REGISTER_SIZE];
+ gdb_byte valbuf[MN10300_MAX_REGISTER_SIZE];
/* This should be a nop, but align the stack just in case something
went wrong. Stacks are four byte aligned on the mn10300. */
@@ -1266,6 +1270,7 @@ mn10300_push_dummy_call (struct gdbarch *gdbarch,
{
/* Change to pointer-to-type. */
arg_len = push_size;
+ gdb_assert (push_size <= MN10300_MAX_REGISTER_SIZE);
store_unsigned_integer (valbuf, push_size, byte_order,
value_address (*args));
val = &valbuf[0];
diff --git a/gdb/nat/fork-inferior.c b/gdb/nat/fork-inferior.c
new file mode 100644
index 0000000..0913409
--- /dev/null
+++ b/gdb/nat/fork-inferior.c
@@ -0,0 +1,595 @@
+/* Fork a Unix child process, and set up to debug it, for GDB and GDBserver.
+
+ Copyright (C) 1990-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "common-defs.h"
+#include "fork-inferior.h"
+#include "target/waitstatus.h"
+#include "filestuff.h"
+#include "target/target.h"
+#include "common-inferior.h"
+#include "common-gdbthread.h"
+#include "signals-state-save-restore.h"
+#include <vector>
+
+extern char **environ;
+
+/* Default shell file to be used if 'startup-with-shell' is set but
+ $SHELL is not. */
+#define SHELL_FILE "/bin/sh"
+
+/* Build the argument vector for execv(3). */
+
+class execv_argv
+{
+public:
+ /* EXEC_FILE is the file to run. ALLARGS is a string containing the
+ arguments to the program. If starting with a shell, SHELL_FILE
+ is the shell to run. Otherwise, SHELL_FILE is NULL. */
+ execv_argv (const char *exec_file, const std::string &allargs,
+ const char *shell_file);
+
+ /* Return a pointer to the built argv, in the type expected by
+ execv. The result is (only) valid for as long as this execv_argv
+ object is live. We return a "char **" because that's the type
+ that the execv functions expect. Note that it is guaranteed that
+ the execv functions do not modify the argv[] array nor the
+ strings to which the array point. */
+ char **argv ()
+ {
+ return const_cast<char **> (&m_argv[0]);
+ }
+
+private:
+ /* Disable copying. */
+ execv_argv (const execv_argv &) = delete;
+ void operator= (const execv_argv &) = delete;
+
+ /* Helper methods for constructing the argument vector. */
+
+ /* Used when building an argv for a straight execv call, without
+ going via the shell. */
+ void init_for_no_shell (const char *exec_file,
+ const std::string &allargs);
+
+ /* Used when building an argv for execing a shell that execs the
+ child program. */
+ void init_for_shell (const char *exec_file,
+ const std::string &allargs,
+ const char *shell_file);
+
+ /* The argument vector built. Holds non-owning pointers. Elements
+ either point to the strings passed to the execv_argv ctor, or
+ inside M_STORAGE. */
+ std::vector<const char *> m_argv;
+
+ /* Storage. In the no-shell case, this contains a copy of the
+ arguments passed to the ctor, split by '\0'. In the shell case,
+ this contains the quoted shell command. I.e., SHELL_COMMAND in
+ {"$SHELL" "-c", SHELL_COMMAND, NULL}. */
+ std::string m_storage;
+};
+
+/* Create argument vector for straight call to execvp. Breaks up
+ ALLARGS into an argument vector suitable for passing to execvp and
+ stores it in M_ARGV. E.g., on "run a b c d" this routine would get
+ as input the string "a b c d", and as output it would fill in
+ M_ARGV with the four arguments "a", "b", "c", "d". Each argument
+ in M_ARGV points to a substring of a copy of ALLARGS stored in
+ M_STORAGE. */
+
+void
+execv_argv::init_for_no_shell (const char *exec_file,
+ const std::string &allargs)
+{
+
+ /* Save/work with a copy stored in our storage. The pointers pushed
+ to M_ARGV point directly into M_STORAGE, which is modified in
+ place with the necessary NULL terminators. This avoids N heap
+ allocations and string dups when 1 is sufficient. */
+ std::string &args_copy = m_storage = allargs;
+
+ m_argv.push_back (exec_file);
+
+ for (size_t cur_pos = 0; cur_pos < args_copy.size ();)
+ {
+ /* Skip whitespace-like chars. */
+ std::size_t pos = args_copy.find_first_not_of (" \t\n", cur_pos);
+
+ if (pos != std::string::npos)
+ cur_pos = pos;
+
+ /* Find the position of the next separator. */
+ std::size_t next_sep = args_copy.find_first_of (" \t\n", cur_pos);
+
+ if (next_sep == std::string::npos)
+ {
+ /* No separator found, which means this is the last
+ argument. */
+ next_sep = args_copy.size ();
+ }
+ else
+ {
+ /* Replace the separator with a terminator. */
+ args_copy[next_sep++] = '\0';
+ }
+
+ m_argv.push_back (&args_copy[cur_pos]);
+
+ cur_pos = next_sep;
+ }
+
+ /* NULL-terminate the vector. */
+ m_argv.push_back (NULL);
+}
+
+/* When executing a command under the given shell, return true if the
+ '!' character should be escaped when embedded in a quoted
+ command-line argument. */
+
+static bool
+escape_bang_in_quoted_argument (const char *shell_file)
+{
+ size_t shell_file_len = strlen (shell_file);
+
+ /* Bang should be escaped only in C Shells. For now, simply check
+ that the shell name ends with 'csh', which covers at least csh
+ and tcsh. This should be good enough for now. */
+
+ if (shell_file_len < 3)
+ return false;
+
+ if (shell_file[shell_file_len - 3] == 'c'
+ && shell_file[shell_file_len - 2] == 's'
+ && shell_file[shell_file_len - 1] == 'h')
+ return true;
+
+ return false;
+}
+
+/* See declaration. */
+
+execv_argv::execv_argv (const char *exec_file,
+ const std::string &allargs,
+ const char *shell_file)
+{
+ if (shell_file == NULL)
+ init_for_no_shell (exec_file, allargs);
+ else
+ init_for_shell (exec_file, allargs, shell_file);
+}
+
+/* See declaration. */
+
+void
+execv_argv::init_for_shell (const char *exec_file,
+ const std::string &allargs,
+ const char *shell_file)
+{
+ const char *exec_wrapper = get_exec_wrapper ();
+
+ /* We're going to call a shell. */
+ bool escape_bang = escape_bang_in_quoted_argument (shell_file);
+
+ /* We need to build a new shell command string, and make argv point
+ to it. So build it in the storage. */
+ std::string &shell_command = m_storage;
+
+ shell_command = "exec ";
+
+ /* Add any exec wrapper. That may be a program name with arguments,
+ so the user must handle quoting. */
+ if (exec_wrapper != NULL)
+ {
+ shell_command += exec_wrapper;
+ shell_command += ' ';
+ }
+
+ /* Now add exec_file, quoting as necessary. */
+
+ /* Quoting in this style is said to work with all shells. But csh
+ on IRIX 4.0.1 can't deal with it. So we only quote it if we need
+ to. */
+ bool need_to_quote;
+ const char *p = exec_file;
+ while (1)
+ {
+ switch (*p)
+ {
+ case '\'':
+ case '!':
+ case '"':
+ case '(':
+ case ')':
+ case '$':
+ case '&':
+ case ';':
+ case '<':
+ case '>':
+ case ' ':
+ case '\n':
+ case '\t':
+ need_to_quote = true;
+ goto end_scan;
+
+ case '\0':
+ need_to_quote = false;
+ goto end_scan;
+
+ default:
+ break;
+ }
+ ++p;
+ }
+ end_scan:
+ if (need_to_quote)
+ {
+ shell_command += '\'';
+ for (p = exec_file; *p != '\0'; ++p)
+ {
+ if (*p == '\'')
+ shell_command += "'\\''";
+ else if (*p == '!' && escape_bang)
+ shell_command += "\\!";
+ else
+ shell_command += *p;
+ }
+ shell_command += '\'';
+ }
+ else
+ shell_command += exec_file;
+
+ shell_command += ' ' + allargs;
+
+ /* If we decided above to start up with a shell, we exec the shell.
+ "-c" says to interpret the next arg as a shell command to
+ execute, and this command is "exec <target-program> <args>". */
+ m_argv.reserve (4);
+ m_argv.push_back (shell_file);
+ m_argv.push_back ("-c");
+ m_argv.push_back (shell_command.c_str ());
+ m_argv.push_back (NULL);
+}
+
+/* Return the shell that must be used to startup the inferior. The
+ first attempt is the environment variable SHELL; if it is not set,
+ then we default to SHELL_FILE. */
+
+static const char *
+get_startup_shell ()
+{
+ static const char *ret;
+
+ ret = getenv ("SHELL");
+ if (ret == NULL)
+ ret = SHELL_FILE;
+
+ return ret;
+}
+
+/* See nat/fork-inferior.h. */
+
+pid_t
+fork_inferior (const char *exec_file_arg, const std::string &allargs,
+ char **env, void (*traceme_fun) (),
+ void (*init_trace_fun) (int), void (*pre_trace_fun) (),
+ const char *shell_file_arg,
+ void (*exec_fun)(const char *file, char * const *argv,
+ char * const *env))
+{
+ pid_t pid;
+ /* Set debug_fork then attach to the child while it sleeps, to debug. */
+ int debug_fork = 0;
+ const char *shell_file;
+ const char *exec_file;
+ char **save_our_env;
+ int i;
+ int save_errno;
+
+ /* If no exec file handed to us, get it from the exec-file command
+ -- with a good, common error message if none is specified. */
+ if (exec_file_arg == NULL)
+ exec_file = get_exec_file (1);
+ else
+ exec_file = exec_file_arg;
+
+ /* 'startup_with_shell' is declared in inferior.h and bound to the
+ "set startup-with-shell" option. If 0, we'll just do a
+ fork/exec, no shell, so don't bother figuring out what shell. */
+ if (startup_with_shell)
+ {
+ shell_file = shell_file_arg;
+
+ /* Figure out what shell to start up the user program under. */
+ if (shell_file == NULL)
+ shell_file = get_startup_shell ();
+
+ gdb_assert (shell_file != NULL);
+ }
+ else
+ shell_file = NULL;
+
+ /* Build the argument vector. */
+ execv_argv child_argv (exec_file, allargs, shell_file);
+
+ /* Retain a copy of our environment variables, since the child will
+ replace the value of environ and if we're vforked, we have to
+ restore it. */
+ save_our_env = environ;
+
+ /* Perform any necessary actions regarding to TTY before the
+ fork/vfork call. */
+ prefork_hook (allargs.c_str ());
+
+ /* It is generally good practice to flush any possible pending stdio
+ output prior to doing a fork, to avoid the possibility of both
+ the parent and child flushing the same data after the fork. */
+ gdb_flush_out_err ();
+
+ /* If there's any initialization of the target layers that must
+ happen to prepare to handle the child we're about fork, do it
+ now... */
+ if (pre_trace_fun != NULL)
+ (*pre_trace_fun) ();
+
+ /* Create the child process. Since the child process is going to
+ exec(3) shortly afterwards, try to reduce the overhead by
+ calling vfork(2). However, if PRE_TRACE_FUN is non-null, it's
+ likely that this optimization won't work since there's too much
+ work to do between the vfork(2) and the exec(3). This is known
+ to be the case on ttrace(2)-based HP-UX, where some handshaking
+ between parent and child needs to happen between fork(2) and
+ exec(2). However, since the parent is suspended in the vforked
+ state, this doesn't work. Also note that the vfork(2) call might
+ actually be a call to fork(2) due to the fact that autoconf will
+ ``#define vfork fork'' on certain platforms. */
+#if !(defined(__UCLIBC__) && defined(HAS_NOMMU))
+ if (pre_trace_fun || debug_fork)
+ pid = fork ();
+ else
+#endif
+ pid = vfork ();
+
+ if (pid < 0)
+ perror_with_name (("vfork"));
+
+ if (pid == 0)
+ {
+ /* Close all file descriptors except those that gdb inherited
+ (usually 0/1/2), so they don't leak to the inferior. Note
+ that this closes the file descriptors of all secondary
+ UIs. */
+ close_most_fds ();
+
+ if (debug_fork)
+ sleep (debug_fork);
+
+ /* Execute any necessary post-fork actions before we exec. */
+ postfork_child_hook ();
+
+ /* Changing the signal handlers for the inferior after
+ a vfork can also change them for the superior, so we don't mess
+ with signals here. See comments in
+ initialize_signals for how we get the right signal handlers
+ for the inferior. */
+
+ /* "Trace me, Dr. Memory!" */
+ (*traceme_fun) ();
+
+ /* The call above set this process (the "child") as debuggable
+ by the original gdb process (the "parent"). Since processes
+ (unlike people) can have only one parent, if you are debugging
+ gdb itself (and your debugger is thus _already_ the
+ controller/parent for this child), code from here on out is
+ undebuggable. Indeed, you probably got an error message
+ saying "not parent". Sorry; you'll have to use print
+ statements! */
+
+ restore_original_signals_state ();
+
+ /* There is no execlpe call, so we have to set the environment
+ for our child in the global variable. If we've vforked, this
+ clobbers the parent, but environ is restored a few lines down
+ in the parent. By the way, yes we do need to look down the
+ path to find $SHELL. Rich Pixley says so, and I agree. */
+ environ = env;
+
+ char **argv = child_argv.argv ();
+
+ if (exec_fun != NULL)
+ (*exec_fun) (argv[0], &argv[0], env);
+ else
+ execvp (argv[0], &argv[0]);
+
+ /* If we get here, it's an error. */
+ save_errno = errno;
+ warning ("Cannot exec %s", argv[0]);
+
+ for (i = 1; argv[i] != NULL; i++)
+ warning (" %s", argv[i]);
+
+ warning ("Error: %s\n", safe_strerror (save_errno));
+
+ _exit (0177);
+ }
+
+ /* Restore our environment in case a vforked child clob'd it. */
+ environ = save_our_env;
+
+ postfork_hook (pid);
+
+ /* Now that we have a child process, make it our target, and
+ initialize anything target-vector-specific that needs
+ initializing. */
+ if (init_trace_fun)
+ (*init_trace_fun) (pid);
+
+ /* We are now in the child process of interest, having exec'd the
+ correct program, and are poised at the first instruction of the
+ new program. */
+ return pid;
+}
+
+/* See nat/fork-inferior.h. */
+
+ptid_t
+startup_inferior (pid_t pid, int ntraps,
+ struct target_waitstatus *last_waitstatus,
+ ptid_t *last_ptid)
+{
+ int pending_execs = ntraps;
+ int terminal_initted = 0;
+ ptid_t resume_ptid;
+
+ if (startup_with_shell)
+ {
+ /* One trap extra for exec'ing the shell. */
+ pending_execs++;
+ }
+
+ if (target_supports_multi_process ())
+ resume_ptid = pid_to_ptid (pid);
+ else
+ resume_ptid = minus_one_ptid;
+
+ /* The process was started by the fork that created it, but it will
+ have stopped one instruction after execing the shell. Here we
+ must get it up to actual execution of the real program. */
+ if (get_exec_wrapper () != NULL)
+ pending_execs++;
+
+ while (1)
+ {
+ enum gdb_signal resume_signal = GDB_SIGNAL_0;
+ ptid_t event_ptid;
+
+ struct target_waitstatus ws;
+ memset (&ws, 0, sizeof (ws));
+ event_ptid = target_wait (resume_ptid, &ws, 0);
+
+ if (last_waitstatus != NULL)
+ *last_waitstatus = ws;
+ if (last_ptid != NULL)
+ *last_ptid = event_ptid;
+
+ if (ws.kind == TARGET_WAITKIND_IGNORE)
+ /* The inferior didn't really stop, keep waiting. */
+ continue;
+
+ switch (ws.kind)
+ {
+ case TARGET_WAITKIND_SPURIOUS:
+ case TARGET_WAITKIND_LOADED:
+ case TARGET_WAITKIND_FORKED:
+ case TARGET_WAITKIND_VFORKED:
+ case TARGET_WAITKIND_SYSCALL_ENTRY:
+ case TARGET_WAITKIND_SYSCALL_RETURN:
+ /* Ignore gracefully during startup of the inferior. */
+ switch_to_thread (event_ptid);
+ break;
+
+ case TARGET_WAITKIND_SIGNALLED:
+ target_terminal_ours ();
+ target_mourn_inferior (event_ptid);
+ error (_("During startup program terminated with signal %s, %s."),
+ gdb_signal_to_name (ws.value.sig),
+ gdb_signal_to_string (ws.value.sig));
+ return resume_ptid;
+
+ case TARGET_WAITKIND_EXITED:
+ target_terminal_ours ();
+ target_mourn_inferior (event_ptid);
+ if (ws.value.integer)
+ error (_("During startup program exited with code %d."),
+ ws.value.integer);
+ else
+ error (_("During startup program exited normally."));
+ return resume_ptid;
+
+ case TARGET_WAITKIND_EXECD:
+ /* Handle EXEC signals as if they were SIGTRAP signals. */
+ xfree (ws.value.execd_pathname);
+ resume_signal = GDB_SIGNAL_TRAP;
+ switch_to_thread (event_ptid);
+ break;
+
+ case TARGET_WAITKIND_STOPPED:
+ resume_signal = ws.value.sig;
+ switch_to_thread (event_ptid);
+ break;
+ }
+
+ if (resume_signal != GDB_SIGNAL_TRAP)
+ {
+ /* Let shell child handle its own signals in its own way. */
+ target_continue (resume_ptid, resume_signal);
+ }
+ else
+ {
+ /* We handle SIGTRAP, however; it means child did an exec. */
+ if (!terminal_initted)
+ {
+ /* Now that the child has exec'd we know it has already
+ set its process group. On POSIX systems, tcsetpgrp
+ will fail with EPERM if we try it before the child's
+ setpgid. */
+
+ /* Set up the "saved terminal modes" of the inferior
+ based on what modes we are starting it with. */
+ target_terminal_init ();
+
+ /* Install inferior's terminal modes. */
+ target_terminal_inferior ();
+
+ terminal_initted = 1;
+ }
+
+ if (--pending_execs == 0)
+ break;
+
+ /* Just make it go on. */
+ target_continue_no_signal (resume_ptid);
+ }
+ }
+
+ return resume_ptid;
+}
+
+/* See nat/fork-inferior.h. */
+
+void
+trace_start_error (const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start (ap, fmt);
+ warning ("Could not trace the inferior process.\nError: ");
+ vwarning (fmt, ap);
+ va_end (ap);
+
+ gdb_flush_out_err ();
+ _exit (0177);
+}
+
+/* See nat/fork-inferior.h. */
+
+void
+trace_start_error_with_name (const char *string)
+{
+ trace_start_error ("%s: %s", string, safe_strerror (errno));
+}
diff --git a/gdb/nat/fork-inferior.h b/gdb/nat/fork-inferior.h
new file mode 100644
index 0000000..d369cff
--- /dev/null
+++ b/gdb/nat/fork-inferior.h
@@ -0,0 +1,106 @@
+/* Functions and data responsible for forking the inferior process.
+
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef FORK_INFERIOR_H
+#define FORK_INFERIOR_H
+
+#include <string>
+
+/* Number of traps that happen between exec'ing the shell to run an
+ inferior and when we finally get to the inferior code, not counting
+ the exec for the shell. This is 1 on all supported
+ implementations. */
+#define START_INFERIOR_TRAPS_EXPECTED 1
+
+/* Start an inferior Unix child process and sets inferior_ptid to its
+ pid. EXEC_FILE is the file to run. ALLARGS is a string containing
+ the arguments to the program. ENV is the environment vector to
+ pass. SHELL_FILE is the shell file, or NULL if we should pick
+ one. EXEC_FUN is the exec(2) function to use, or NULL for the default
+ one. */
+
+/* This function is NOT reentrant. Some of the variables have been
+ made static to ensure that they survive the vfork call. */
+extern pid_t fork_inferior (const char *exec_file_arg,
+ const std::string &allargs,
+ char **env, void (*traceme_fun) (),
+ void (*init_trace_fun) (int),
+ void (*pre_trace_fun) (),
+ const char *shell_file_arg,
+ void (*exec_fun) (const char *file,
+ char * const *argv,
+ char * const *env));
+
+/* Accept NTRAPS traps from the inferior.
+
+ Return the ptid of the inferior being started. */
+extern ptid_t startup_inferior (pid_t pid, int ntraps,
+ struct target_waitstatus *mystatus,
+ ptid_t *myptid);
+
+/* Whether to start up the debuggee under a shell.
+
+ If startup-with-shell is set, GDB's "run" will attempt to start up
+ the debuggee under a shell. This also happens when using GDBserver
+ under extended remote mode.
+
+ This is in order for argument-expansion to occur. E.g.,
+
+ (gdb) run *
+
+ The "*" gets expanded by the shell into a list of files.
+
+ While this is a nice feature, it may be handy to bypass the shell
+ in some cases. To disable this feature, do "set startup-with-shell
+ false".
+
+ The catch-exec traps expected during start-up will be one more if
+ the target is started up with a shell. */
+extern int startup_with_shell;
+
+/* Perform any necessary tasks before a fork/vfork takes place. ARGS
+ is a string containing all the arguments received by the inferior.
+ This function is mainly used by fork_inferior. */
+extern void prefork_hook (const char *args);
+
+/* Perform any necessary tasks after a fork/vfork takes place. This
+ function is mainly used by fork_inferior. */
+extern void postfork_hook (pid_t pid);
+
+/* Perform any necessary tasks *on the child* after a fork/vfork takes
+ place. This function is mainly used by fork_inferior. */
+extern void postfork_child_hook ();
+
+/* Flush both stdout and stderr. This function needs to be
+ implemented differently on GDB and GDBserver. */
+extern void gdb_flush_out_err ();
+
+/* Report an error that happened when starting to trace the inferior
+ (i.e., when the "traceme_fun" callback is called on fork_inferior)
+ and bail out. This function does not return. */
+extern void trace_start_error (const char *fmt, ...)
+ ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
+
+/* Like "trace_start_error", but the error message is constructed by
+ combining STRING with the system error message for errno. This
+ function does not return. */
+extern void trace_start_error_with_name (const char *string)
+ ATTRIBUTE_NORETURN;
+
+#endif /* ! FORK_INFERIOR_H */
diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index 3265b16..438177f 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -272,7 +272,7 @@ linux_fork_to_function (gdb_byte *child_stack, int (*function) (void *))
#define STACK_SIZE 4096
if (child_stack == NULL)
- child_stack = xmalloc (STACK_SIZE * 4);
+ child_stack = (gdb_byte *) xmalloc (STACK_SIZE * 4);
/* Use CLONE_VM instead of fork, to support uClinux (no MMU). */
#ifdef __ia64__
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 8c8adfa..478aa91 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -193,20 +193,16 @@ x86_show_dr (struct x86_debug_reg_state *state,
here. */
: "??unknown??"))));
debug_printf (":\n");
- debug_printf ("\tCONTROL (DR7): %s STATUS (DR6): %s\n",
- phex (state->dr_control_mirror, 8),
- phex (state->dr_status_mirror, 8));
+
+ debug_printf ("\tCONTROL (DR7): 0x%s\n", phex (state->dr_control_mirror, 8));
+ debug_printf ("\tSTATUS (DR6): 0x%s\n", phex (state->dr_status_mirror, 8));
+
ALL_DEBUG_ADDRESS_REGISTERS (i)
{
- debug_printf ("\
-\tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n",
+ debug_printf ("\tDR%d: addr=0x%s, ref.count=%d\n",
i, phex (state->dr_mirror[i],
x86_get_debug_register_length ()),
- state->dr_ref_count[i],
- i + 1, phex (state->dr_mirror[i + 1],
- x86_get_debug_register_length ()),
- state->dr_ref_count[i + 1]);
- i++;
+ state->dr_ref_count[i]);
}
}
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 02d6e1c..f392e6d 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -48,6 +48,7 @@
#include "cli/cli-script.h"
#include "format.h"
#include "source.h"
+#include "common/byte-vector.h"
#ifdef TUI
#include "tui/tui.h" /* For tui_active et al. */
@@ -356,43 +357,12 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
int size, struct ui_file *stream)
{
struct gdbarch *gdbarch = get_type_arch (type);
- LONGEST val_long = 0;
unsigned int len = TYPE_LENGTH (type);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
/* String printing should go through val_print_scalar_formatted. */
gdb_assert (options->format != 's');
- if (len > sizeof(LONGEST)
- && (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_ENUM))
- {
- switch (options->format)
- {
- case 'o':
- print_octal_chars (stream, valaddr, len, byte_order);
- return;
- case 'u':
- case 'd':
- print_decimal_chars (stream, valaddr, len, byte_order);
- return;
- case 't':
- print_binary_chars (stream, valaddr, len, byte_order);
- return;
- case 'x':
- print_hex_chars (stream, valaddr, len, byte_order);
- return;
- case 'c':
- print_char_chars (stream, type, valaddr, len, byte_order);
- return;
- default:
- break;
- };
- }
-
- if (options->format != 'f')
- val_long = unpack_long (type, valaddr);
-
/* If the value is a pointer, and pointers and addresses are not the
same, then at this point, the value's length (in target bytes) is
gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */
@@ -402,61 +372,93 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
/* If we are printing it as unsigned, truncate it in case it is actually
a negative signed value (e.g. "print/u (short)-1" should print 65535
(if shorts are 16 bits) instead of 4294967295). */
- if (options->format != 'd' || TYPE_UNSIGNED (type))
+ if (options->format != 'c'
+ && (options->format != 'd' || TYPE_UNSIGNED (type)))
{
- if (len < sizeof (LONGEST))
- val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1;
+ if (len < TYPE_LENGTH (type) && byte_order == BFD_ENDIAN_BIG)
+ valaddr += TYPE_LENGTH (type) - len;
}
- switch (options->format)
+ if (size != 0 && (options->format == 'x' || options->format == 't'))
{
- case 'x':
- if (!size)
+ /* Truncate to fit. */
+ unsigned newlen;
+ switch (size)
{
- /* No size specified, like in print. Print varying # of digits. */
- print_longest (stream, 'x', 1, val_long);
+ case 'b':
+ newlen = 1;
+ break;
+ case 'h':
+ newlen = 2;
+ break;
+ case 'w':
+ newlen = 4;
+ break;
+ case 'g':
+ newlen = 8;
+ break;
+ default:
+ error (_("Undefined output size \"%c\"."), size);
}
- else
- switch (size)
- {
- case 'b':
- case 'h':
- case 'w':
- case 'g':
- print_longest (stream, size, 1, val_long);
- break;
- default:
- error (_("Undefined output size \"%c\"."), size);
- }
- break;
+ if (newlen < len && byte_order == BFD_ENDIAN_BIG)
+ valaddr += len - newlen;
+ len = newlen;
+ }
- case 'd':
- print_longest (stream, 'd', 1, val_long);
- break;
+ /* Historically gdb has printed floats by first casting them to a
+ long, and then printing the long. PR cli/16242 suggests changing
+ this to using C-style hex float format. */
+ gdb::byte_vector converted_float_bytes;
+ if (TYPE_CODE (type) == TYPE_CODE_FLT
+ && (options->format == 'o'
+ || options->format == 'x'
+ || options->format == 't'
+ || options->format == 'z'))
+ {
+ LONGEST val_long = unpack_long (type, valaddr);
+ converted_float_bytes.resize (TYPE_LENGTH (type));
+ store_signed_integer (converted_float_bytes.data (), TYPE_LENGTH (type),
+ byte_order, val_long);
+ valaddr = converted_float_bytes.data ();
+ }
+ switch (options->format)
+ {
+ case 'o':
+ print_octal_chars (stream, valaddr, len, byte_order);
+ break;
case 'u':
- print_longest (stream, 'u', 0, val_long);
+ print_decimal_chars (stream, valaddr, len, false, byte_order);
break;
-
- case 'o':
- if (val_long)
- print_longest (stream, 'o', 1, val_long);
- else
- fprintf_filtered (stream, "0");
+ case 0:
+ case 'd':
+ if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ {
+ print_decimal_chars (stream, valaddr, len, !TYPE_UNSIGNED (type),
+ byte_order);
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'f':
+ type = float_type_from_length (type);
+ print_floating (valaddr, type, stream);
break;
- case 'a':
- {
- CORE_ADDR addr = unpack_pointer (type, valaddr);
-
- print_address (gdbarch, addr, stream);
- }
+ case 't':
+ print_binary_chars (stream, valaddr, len, byte_order, size > 0);
+ break;
+ case 'x':
+ print_hex_chars (stream, valaddr, len, byte_order, size > 0);
+ break;
+ case 'z':
+ print_hex_chars (stream, valaddr, len, byte_order, true);
break;
-
case 'c':
{
struct value_print_options opts = *options;
+ LONGEST val_long = unpack_long (type, valaddr);
+
opts.format = 0;
if (TYPE_UNSIGNED (type))
type = builtin_type (gdbarch)->builtin_true_unsigned_char;
@@ -467,66 +469,14 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
}
break;
- case 'f':
- type = float_type_from_length (type);
- print_floating (valaddr, type, stream);
- break;
-
- case 0:
- internal_error (__FILE__, __LINE__,
- _("failed internal consistency check"));
-
- case 't':
- /* Binary; 't' stands for "two". */
+ case 'a':
{
- char bits[8 * (sizeof val_long) + 1];
- char buf[8 * (sizeof val_long) + 32];
- char *cp = bits;
- int width;
-
- if (!size)
- width = 8 * (sizeof val_long);
- else
- switch (size)
- {
- case 'b':
- width = 8;
- break;
- case 'h':
- width = 16;
- break;
- case 'w':
- width = 32;
- break;
- case 'g':
- width = 64;
- break;
- default:
- error (_("Undefined output size \"%c\"."), size);
- }
+ CORE_ADDR addr = unpack_pointer (type, valaddr);
- bits[width] = '\0';
- while (width-- > 0)
- {
- bits[width] = (val_long & 1) ? '1' : '0';
- val_long >>= 1;
- }
- if (!size)
- {
- while (*cp && *cp == '0')
- cp++;
- if (*cp == '\0')
- cp--;
- }
- strncpy (buf, cp, sizeof (bits));
- fputs_filtered (buf, stream);
+ print_address (gdbarch, addr, stream);
}
break;
- case 'z':
- print_hex_chars (stream, valaddr, len, byte_order);
- break;
-
default:
error (_("Undefined output format \"%c\"."), options->format);
}
diff --git a/gdb/probe.c b/gdb/probe.c
index e65e031..cb2dcdb 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -36,6 +36,7 @@
#include "location.h"
#include <ctype.h>
#include <algorithm>
+#include "common/gdb_optional.h"
typedef struct bound_probe bound_probe_s;
DEF_VEC_O (bound_probe_s);
@@ -288,18 +289,17 @@ collect_probes (char *objname, char *provider, char *probe_name,
{
struct objfile *objfile;
VEC (bound_probe_s) *result = NULL;
- struct cleanup *cleanup, *cleanup_temps;
- regex_t obj_pat, prov_pat, probe_pat;
+ struct cleanup *cleanup;
+ gdb::optional<compiled_regex> obj_pat, prov_pat, probe_pat;
cleanup = make_cleanup (VEC_cleanup (bound_probe_s), &result);
- cleanup_temps = make_cleanup (null_cleanup, NULL);
if (provider != NULL)
- compile_rx_or_error (&prov_pat, provider, _("Invalid provider regexp"));
+ prov_pat.emplace (provider, REG_NOSUB, _("Invalid provider regexp"));
if (probe_name != NULL)
- compile_rx_or_error (&probe_pat, probe_name, _("Invalid probe regexp"));
+ probe_pat.emplace (probe_name, REG_NOSUB, _("Invalid probe regexp"));
if (objname != NULL)
- compile_rx_or_error (&obj_pat, objname, _("Invalid object file regexp"));
+ obj_pat.emplace (objname, REG_NOSUB, _("Invalid object file regexp"));
ALL_OBJFILES (objfile)
{
@@ -312,7 +312,7 @@ collect_probes (char *objname, char *provider, char *probe_name,
if (objname)
{
- if (regexec (&obj_pat, objfile_name (objfile), 0, NULL, 0) != 0)
+ if (obj_pat->exec (objfile_name (objfile), 0, NULL, 0) != 0)
continue;
}
@@ -326,11 +326,11 @@ collect_probes (char *objname, char *provider, char *probe_name,
continue;
if (provider
- && regexec (&prov_pat, probe->provider, 0, NULL, 0) != 0)
+ && prov_pat->exec (probe->provider, 0, NULL, 0) != 0)
continue;
if (probe_name
- && regexec (&probe_pat, probe->name, 0, NULL, 0) != 0)
+ && probe_pat->exec (probe->name, 0, NULL, 0) != 0)
continue;
bound.objfile = objfile;
@@ -339,7 +339,6 @@ collect_probes (char *objname, char *provider, char *probe_name,
}
}
- do_cleanups (cleanup_temps);
discard_cleanups (cleanup);
return result;
}
diff --git a/gdb/procfs.c b/gdb/procfs.c
index adb2e84..b03809c 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -4377,7 +4377,7 @@ procfs_init_inferior (struct target_ops *ops, int pid)
thread_change_ptid (pid_to_ptid (pid),
ptid_build (pid, lwpid, 0));
- startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
+ gdb_startup_inferior (pid, START_INFERIOR_TRAPS_EXPECTED);
#ifdef SYS_syssgi
/* On mips-irix, we need to stop the inferior early enough during
@@ -4604,6 +4604,11 @@ procfs_create_inferior (struct target_ops *ops, const char *exec_file,
pid = fork_inferior (exec_file, allargs, env, procfs_set_exec_trap,
NULL, NULL, shell_file, NULL);
+ /* We have something that executes now. We'll be running through
+ the shell at this point (if startup-with-shell is true), but the
+ pid shouldn't change. */
+ add_thread_silent (pid_to_ptid (pid));
+
procfs_init_inferior (ops, pid);
}
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index a5c2873..1d800a7 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -73,15 +73,6 @@ typedef struct
/* The data we keep for a frame we can unwind: frame ID and an array of
(register_number, register_value) pairs. */
-struct reg_info
-{
- /* Register number. */
- int number;
-
- /* Register data bytes pointer. */
- gdb_byte data[MAX_REGISTER_SIZE];
-};
-
typedef struct
{
/* Frame ID. */
@@ -93,7 +84,7 @@ typedef struct
/* Length of the `reg' array below. */
int reg_count;
- struct reg_info reg[];
+ cached_reg_t reg[];
} cached_frame_info;
extern PyTypeObject pending_frame_object_type
@@ -483,14 +474,14 @@ pyuw_prev_register (struct frame_info *this_frame, void **cache_ptr,
int regnum)
{
cached_frame_info *cached_frame = (cached_frame_info *) *cache_ptr;
- struct reg_info *reg_info = cached_frame->reg;
- struct reg_info *reg_info_end = reg_info + cached_frame->reg_count;
+ cached_reg_t *reg_info = cached_frame->reg;
+ cached_reg_t *reg_info_end = reg_info + cached_frame->reg_count;
TRACE_PY_UNWIND (1, "%s (frame=%p,...,reg=%d)\n", __FUNCTION__, this_frame,
regnum);
for (; reg_info < reg_info_end; ++reg_info)
{
- if (regnum == reg_info->number)
+ if (regnum == reg_info->num)
return frame_unwind_got_bytes (this_frame, regnum, reg_info->data);
}
@@ -580,13 +571,14 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame,
struct value *value = value_object_to_value (reg->value);
size_t data_size = register_size (gdbarch, reg->number);
- cached_frame->reg[i].number = reg->number;
+ cached_frame->reg[i].num = reg->number;
/* `value' validation was done before, just assert. */
gdb_assert (value != NULL);
gdb_assert (data_size == TYPE_LENGTH (value_type (value)));
gdb_assert (data_size <= MAX_REGISTER_SIZE);
+ cached_frame->reg[i].data = (gdb_byte *) xmalloc (data_size);
memcpy (cached_frame->reg[i].data, value_contents (value), data_size);
}
}
@@ -601,6 +593,11 @@ static void
pyuw_dealloc_cache (struct frame_info *this_frame, void *cache)
{
TRACE_PY_UNWIND (3, "%s: enter", __FUNCTION__);
+ cached_frame_info *cached_frame = (cached_frame_info *) cache;
+
+ for (int i = 0; cached_frame->reg_count; i++)
+ xfree (cached_frame->reg[i].data);
+
xfree (cache);
}
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 31ff558..7f6ecc7 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -36,6 +36,7 @@
#include "observer.h"
#include "infrun.h"
#include "common/gdb_unlinker.h"
+#include "common/byte-vector.h"
#include <signal.h>
@@ -698,7 +699,7 @@ record_full_exec_insn (struct regcache *regcache,
{
case record_full_reg: /* reg */
{
- gdb_byte reg[MAX_REGISTER_SIZE];
+ gdb::byte_vector reg (entry->u.reg.len);
if (record_debug > 1)
fprintf_unfiltered (gdb_stdlog,
@@ -707,10 +708,10 @@ record_full_exec_insn (struct regcache *regcache,
host_address_to_string (entry),
entry->u.reg.num);
- regcache_cooked_read (regcache, entry->u.reg.num, reg);
+ regcache_cooked_read (regcache, entry->u.reg.num, reg.data ());
regcache_cooked_write (regcache, entry->u.reg.num,
record_full_get_loc (entry));
- memcpy (record_full_get_loc (entry), reg, entry->u.reg.len);
+ memcpy (record_full_get_loc (entry), reg.data (), entry->u.reg.len);
}
break;
@@ -2339,16 +2340,6 @@ netorder32 (uint32_t input)
return ret;
}
-static inline uint16_t
-netorder16 (uint16_t input)
-{
- uint16_t ret;
-
- store_unsigned_integer ((gdb_byte *) &ret, sizeof (ret),
- BFD_ENDIAN_BIG, input);
- return ret;
-}
-
/* Restore the execution log from a core_bfd file. */
static void
record_full_restore (void)
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 3798f0a..7eeb737 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -328,7 +328,6 @@ regcache::save (regcache_cooked_read_ftype *cooked_read,
void *src)
{
struct gdbarch *gdbarch = m_descr->gdbarch;
- gdb_byte buf[MAX_REGISTER_SIZE];
int regnum;
/* The DST should be `read-only', if it wasn't then the save would
@@ -346,18 +345,14 @@ regcache::save (regcache_cooked_read_ftype *cooked_read,
{
if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup))
{
- enum register_status status = cooked_read (src, regnum, buf);
+ gdb_byte *dst_buf = register_buffer (regnum);
+ enum register_status status = cooked_read (src, regnum, dst_buf);
- if (status == REG_VALID)
- memcpy (register_buffer (regnum), buf,
- register_size (gdbarch, regnum));
- else
- {
- gdb_assert (status != REG_UNKNOWN);
+ gdb_assert (status != REG_UNKNOWN);
+
+ if (status != REG_VALID)
+ memset (dst_buf, 0, register_size (gdbarch, regnum));
- memset (register_buffer (regnum), 0,
- register_size (gdbarch, regnum));
- }
m_register_status[regnum] = status;
}
}
@@ -667,11 +662,12 @@ enum register_status
regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
{
gdb_assert (regcache != NULL);
- return regcache->raw_read_signed (regnum, val);
+ return regcache->raw_read (regnum, val);
}
+template<typename T, typename>
enum register_status
-regcache::raw_read_signed (int regnum, LONGEST *val)
+regcache::raw_read (int regnum, T *val)
{
gdb_byte *buf;
enum register_status status;
@@ -680,9 +676,9 @@ regcache::raw_read_signed (int regnum, LONGEST *val)
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
status = raw_read (regnum, buf);
if (status == REG_VALID)
- *val = extract_signed_integer
- (buf, m_descr->sizeof_register[regnum],
- gdbarch_byte_order (m_descr->gdbarch));
+ *val = extract_integer<T> (buf,
+ m_descr->sizeof_register[regnum],
+ gdbarch_byte_order (m_descr->gdbarch));
else
*val = 0;
return status;
@@ -693,44 +689,26 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
ULONGEST *val)
{
gdb_assert (regcache != NULL);
- return regcache->raw_read_unsigned (regnum, val);
-}
-
-
-enum register_status
-regcache::raw_read_unsigned (int regnum, ULONGEST *val)
-{
- gdb_byte *buf;
- enum register_status status;
-
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_raw_registers);
- buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
- status = raw_read (regnum, buf);
- if (status == REG_VALID)
- *val = extract_unsigned_integer
- (buf, m_descr->sizeof_register[regnum],
- gdbarch_byte_order (m_descr->gdbarch));
- else
- *val = 0;
- return status;
+ return regcache->raw_read (regnum, val);
}
void
regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val)
{
gdb_assert (regcache != NULL);
- regcache->raw_write_signed (regnum, val);
+ regcache->raw_write (regnum, val);
}
+template<typename T, typename>
void
-regcache::raw_write_signed (int regnum, LONGEST val)
+regcache::raw_write (int regnum, T val)
{
gdb_byte *buf;
gdb_assert (regnum >=0 && regnum < m_descr->nr_raw_registers);
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
- store_signed_integer (buf, m_descr->sizeof_register[regnum],
- gdbarch_byte_order (m_descr->gdbarch), val);
+ store_integer (buf, m_descr->sizeof_register[regnum],
+ gdbarch_byte_order (m_descr->gdbarch), val);
raw_write (regnum, buf);
}
@@ -739,19 +717,7 @@ regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
ULONGEST val)
{
gdb_assert (regcache != NULL);
- regcache->raw_write_unsigned (regnum, val);
-}
-
-void
-regcache::raw_write_unsigned (int regnum, ULONGEST val)
-{
- gdb_byte *buf;
-
- gdb_assert (regnum >=0 && regnum < m_descr->nr_raw_registers);
- buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
- store_unsigned_integer (buf, m_descr->sizeof_register[regnum],
- gdbarch_byte_order (m_descr->gdbarch), val);
- raw_write (regnum, buf);
+ regcache->raw_write (regnum, val);
}
LONGEST
@@ -862,11 +828,12 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum,
LONGEST *val)
{
gdb_assert (regcache != NULL);
- return regcache->cooked_read_signed (regnum, val);
+ return regcache->cooked_read (regnum, val);
}
+template<typename T, typename>
enum register_status
-regcache::cooked_read_signed (int regnum, LONGEST *val)
+regcache::cooked_read (int regnum, T *val)
{
enum register_status status;
gdb_byte *buf;
@@ -875,9 +842,8 @@ regcache::cooked_read_signed (int regnum, LONGEST *val)
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
status = cooked_read (regnum, buf);
if (status == REG_VALID)
- *val = extract_signed_integer
- (buf, m_descr->sizeof_register[regnum],
- gdbarch_byte_order (m_descr->gdbarch));
+ *val = extract_integer<T> (buf, m_descr->sizeof_register[regnum],
+ gdbarch_byte_order (m_descr->gdbarch));
else
*val = 0;
return status;
@@ -888,25 +854,7 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
ULONGEST *val)
{
gdb_assert (regcache != NULL);
- return regcache->cooked_read_unsigned (regnum, val);
-}
-
-enum register_status
-regcache::cooked_read_unsigned (int regnum, ULONGEST *val)
-{
- enum register_status status;
- gdb_byte *buf;
-
- gdb_assert (regnum >= 0 && regnum < m_descr->nr_cooked_registers);
- buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
- status = cooked_read (regnum, buf);
- if (status == REG_VALID)
- *val = extract_unsigned_integer
- (buf, m_descr->sizeof_register[regnum],
- gdbarch_byte_order (m_descr->gdbarch));
- else
- *val = 0;
- return status;
+ return regcache->cooked_read (regnum, val);
}
void
@@ -914,18 +862,19 @@ regcache_cooked_write_signed (struct regcache *regcache, int regnum,
LONGEST val)
{
gdb_assert (regcache != NULL);
- regcache->cooked_write_signed (regnum, val);
+ regcache->cooked_write (regnum, val);
}
+template<typename T, typename>
void
-regcache::cooked_write_signed (int regnum, LONGEST val)
+regcache::cooked_write (int regnum, T val)
{
gdb_byte *buf;
gdb_assert (regnum >=0 && regnum < m_descr->nr_cooked_registers);
buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
- store_signed_integer (buf, m_descr->sizeof_register[regnum],
- gdbarch_byte_order (m_descr->gdbarch), val);
+ store_integer (buf, m_descr->sizeof_register[regnum],
+ gdbarch_byte_order (m_descr->gdbarch), val);
cooked_write (regnum, buf);
}
@@ -934,19 +883,7 @@ regcache_cooked_write_unsigned (struct regcache *regcache, int regnum,
ULONGEST val)
{
gdb_assert (regcache != NULL);
- regcache->cooked_write_unsigned (regnum, val);
-}
-
-void
-regcache::cooked_write_unsigned (int regnum, ULONGEST val)
-{
- gdb_byte *buf;
-
- gdb_assert (regnum >=0 && regnum < m_descr->nr_cooked_registers);
- buf = (gdb_byte *) alloca (m_descr->sizeof_register[regnum]);
- store_unsigned_integer (buf, m_descr->sizeof_register[regnum],
- gdbarch_byte_order (m_descr->gdbarch), val);
- cooked_write (regnum, buf);
+ regcache->cooked_write (regnum, val);
}
/* See regcache.h. */
@@ -1471,7 +1408,6 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
int footnote_register_offset = 0;
int footnote_register_type_name_null = 0;
long register_offset = 0;
- gdb_byte buf[MAX_REGISTER_SIZE];
#if 0
fprintf_unfiltered (file, "nr_raw_registers %d\n",
@@ -1597,10 +1533,10 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
fprintf_unfiltered (file, "<unavailable>");
else
{
- raw_read (regnum, buf);
- print_hex_chars (file, buf,
+ raw_update (regnum);
+ print_hex_chars (file, register_buffer (regnum),
m_descr->sizeof_register[regnum],
- gdbarch_byte_order (gdbarch));
+ gdbarch_byte_order (gdbarch), true);
}
}
@@ -1611,9 +1547,30 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
fprintf_unfiltered (file, "Cooked value");
else
{
+ const gdb_byte *buf = NULL;
enum register_status status;
+ struct value *value = NULL;
+
+ if (regnum < m_descr->nr_raw_registers)
+ {
+ raw_update (regnum);
+ status = get_register_status (regnum);
+ buf = register_buffer (regnum);
+ }
+ else
+ {
+ value = cooked_read_value (regnum);
+
+ if (!value_optimized_out (value)
+ && value_entirely_available (value))
+ {
+ status = REG_VALID;
+ buf = value_contents_all (value);
+ }
+ else
+ status = REG_UNAVAILABLE;
+ }
- status = cooked_read (regnum, buf);
if (status == REG_UNKNOWN)
fprintf_unfiltered (file, "<invalid>");
else if (status == REG_UNAVAILABLE)
@@ -1621,7 +1578,13 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
else
print_hex_chars (file, buf,
m_descr->sizeof_register[regnum],
- gdbarch_byte_order (gdbarch));
+ gdbarch_byte_order (gdbarch), true);
+
+ if (value != NULL)
+ {
+ release_value (value);
+ value_free (value);
+ }
}
}
diff --git a/gdb/regcache.h b/gdb/regcache.h
index 4cf27a0..b416d5e 100644
--- a/gdb/regcache.h
+++ b/gdb/regcache.h
@@ -232,6 +232,14 @@ enum regcache_dump_what
regcache_dump_remote
};
+/* A (register_number, register_value) pair. */
+
+typedef struct cached_reg
+{
+ int num;
+ gdb_byte *data;
+} cached_reg_t;
+
/* The register cache for storing raw register values. */
class regcache
@@ -282,23 +290,19 @@ public:
#endif
void raw_write (int regnum, const gdb_byte *buf);
- enum register_status raw_read_signed (int regnum, LONGEST *val);
-
- void raw_write_signed (int regnum, LONGEST val);
+ template<typename T, typename = RequireLongest<T>>
+ enum register_status raw_read (int regnum, T *val);
- enum register_status raw_read_unsigned (int regnum, ULONGEST *val);
-
- void raw_write_unsigned (int regnum, ULONGEST val);
+ template<typename T, typename = RequireLongest<T>>
+ void raw_write (int regnum, T val);
struct value *cooked_read_value (int regnum);
- enum register_status cooked_read_signed (int regnum, LONGEST *val);
-
- void cooked_write_signed (int regnum, LONGEST val);
-
- enum register_status cooked_read_unsigned (int regnum, ULONGEST *val);
+ template<typename T, typename = RequireLongest<T>>
+ enum register_status cooked_read (int regnum, T *val);
- void cooked_write_unsigned (int regnum, ULONGEST val);
+ template<typename T, typename = RequireLongest<T>>
+ void cooked_write (int regnum, T val);
void raw_update (int regnum);
diff --git a/gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat
index 3ae6b0e..9cd0fae 100644
--- a/gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat
+++ b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat
@@ -157,3 +157,4 @@ expedite:rbp,rsp,rip
256:zmm29h
256:zmm30h
256:zmm31h
+32:pkru
diff --git a/gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat
index 88185fd..b3340d3 100644
--- a/gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat
+++ b/gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat
@@ -60,9 +60,6 @@ expedite:rbp,rsp,rip
128:xmm14
128:xmm15
32:mxcsr
-64:orig_rax
-64:fs_base
-64:gs_base
128:ymm0h
128:ymm1h
128:ymm2h
diff --git a/gdb/regformats/regdef.h b/gdb/regformats/regdef.h
index 3960a45..de7a010 100644
--- a/gdb/regformats/regdef.h
+++ b/gdb/regformats/regdef.h
@@ -36,9 +36,4 @@ struct reg
int size;
};
-/* Set the current remote protocol and register cache according to the array
- ``regs'', with ``n'' elements. */
-
-void set_register_cache (struct reg *regs, int n);
-
#endif /* REGDEF_H */
diff --git a/gdb/remote.c b/gdb/remote.c
index de52ac3..8e8ee6f 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1428,6 +1428,7 @@ enum {
PACKET_QPassSignals,
PACKET_QCatchSyscalls,
PACKET_QProgramSignals,
+ PACKET_QStartupWithShell,
PACKET_qCRC,
PACKET_qSearch_memory,
PACKET_vAttach,
@@ -4633,6 +4634,8 @@ static const struct protocol_feature remote_protocol_features[] = {
PACKET_QCatchSyscalls },
{ "QProgramSignals", PACKET_DISABLE, remote_supported_packet,
PACKET_QProgramSignals },
+ { "QStartupWithShell", PACKET_DISABLE, remote_supported_packet,
+ PACKET_QStartupWithShell },
{ "QStartNoAckMode", PACKET_DISABLE, remote_supported_packet,
PACKET_QStartNoAckMode },
{ "multiprocess", PACKET_DISABLE, remote_supported_packet,
@@ -6308,12 +6311,6 @@ remote_console_output (char *msg)
gdb_flush (gdb_stdtarg);
}
-typedef struct cached_reg
-{
- int num;
- gdb_byte *data;
-} cached_reg_t;
-
DEF_VEC_O(cached_reg_t);
typedef struct stop_reply
@@ -9614,6 +9611,20 @@ extended_remote_create_inferior (struct target_ops *ops,
if (extended_remote_supports_disable_randomization (ops))
extended_remote_disable_randomization (disable_randomization);
+ /* If startup-with-shell is on, we inform gdbserver to start the
+ remote inferior using a shell. */
+ if (packet_support (PACKET_QStartupWithShell) != PACKET_DISABLE)
+ {
+ xsnprintf (rs->buf, get_remote_packet_size (),
+ "QStartupWithShell:%d", startup_with_shell ? 1 : 0);
+ putpkt (rs->buf);
+ getpkt (&rs->buf, &rs->buf_size, 0);
+ if (strcmp (rs->buf, "OK") != 0)
+ error (_("\
+Remote replied unexpectedly while setting startup-with-shell: %s"),
+ rs->buf);
+ }
+
/* Now restart the remote server. */
run_worked = extended_remote_run (args) != -1;
if (!run_worked)
@@ -12650,9 +12661,9 @@ remote_get_tracepoint_status (struct target_ops *self, struct breakpoint *bp,
if (tp)
{
- tp->base.hit_count = 0;
+ tp->hit_count = 0;
tp->traceframe_usage = 0;
- for (loc = tp->base.loc; loc; loc = loc->next)
+ for (loc = tp->loc; loc; loc = loc->next)
{
/* If the tracepoint was never downloaded, don't go asking for
any status. */
@@ -14104,6 +14115,9 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (&remote_protocol_packets[PACKET_QProgramSignals],
"QProgramSignals", "program-signals", 0);
+ add_packet_config_cmd (&remote_protocol_packets[PACKET_QStartupWithShell],
+ "QStartupWithShell", "startup-with-shell", 0);
+
add_packet_config_cmd (&remote_protocol_packets[PACKET_qSymbol],
"qSymbol", "symbol-lookup", 0);
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 6cbfdbe..e9b3f10 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -1048,7 +1048,6 @@ rs6000_aix_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
software single-stepping. */
set_gdbarch_displaced_step_copy_insn (gdbarch, NULL);
set_gdbarch_displaced_step_fixup (gdbarch, NULL);
- set_gdbarch_displaced_step_free_closure (gdbarch, NULL);
set_gdbarch_displaced_step_location (gdbarch, NULL);
set_gdbarch_push_dummy_call (gdbarch, rs6000_push_dummy_call);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index 57faa67..97a975e 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -6522,8 +6522,6 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_displaced_step_hw_singlestep (gdbarch,
ppc_displaced_step_hw_singlestep);
set_gdbarch_displaced_step_fixup (gdbarch, ppc_displaced_step_fixup);
- set_gdbarch_displaced_step_free_closure (gdbarch,
- simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch,
displaced_step_at_entry_point);
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 6d68260..8840c2f 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -8005,8 +8005,6 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_displaced_step_copy_insn (gdbarch,
s390_displaced_step_copy_insn);
set_gdbarch_displaced_step_fixup (gdbarch, s390_displaced_step_fixup);
- set_gdbarch_displaced_step_free_closure (gdbarch,
- simple_displaced_step_free_closure);
set_gdbarch_displaced_step_location (gdbarch, linux_displaced_step_location);
set_gdbarch_max_insn_length (gdbarch, S390_MAX_INSTR_SIZE);
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 2c2b268..a87547d 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -1648,13 +1648,14 @@ sh_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, gdb_byte *buffer)
{
int base_regnum;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
enum register_status status;
if (reg_nr == PSEUDO_BANK_REGNUM)
return regcache_raw_read (regcache, BANK_REGNUM, buffer);
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
+ /* Enough space for two float registers. */
+ gdb_byte temp_buffer[4 * 2];
base_regnum = dr_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
@@ -1687,7 +1688,6 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
int reg_nr, const gdb_byte *buffer)
{
int base_regnum, portion;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
if (reg_nr == PSEUDO_BANK_REGNUM)
{
@@ -1703,6 +1703,8 @@ sh_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
}
else if (reg_nr >= DR0_REGNUM && reg_nr <= DR_LAST_REGNUM)
{
+ /* Enough space for two float registers. */
+ gdb_byte temp_buffer[4 * 2];
base_regnum = dr_reg_base_num (gdbarch, reg_nr);
/* We must pay attention to the endiannes. */
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index 06ae04e..5aeb235 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -1528,12 +1528,12 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int base_regnum;
int offset = 0;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
enum register_status status;
if (reg_nr >= DR0_REGNUM
&& reg_nr <= DR_LAST_REGNUM)
{
+ gdb_byte temp_buffer[8];
base_regnum = sh64_dr_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
@@ -1580,6 +1580,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= R0_C_REGNUM
&& reg_nr <= T_C_REGNUM)
{
+ gdb_byte temp_buffer[8];
base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* Build the value in the provided buffer. */
@@ -1607,6 +1608,7 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= DR0_C_REGNUM
&& reg_nr <= DR_LAST_C_REGNUM)
{
+ gdb_byte temp_buffer[8];
base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* DR_C regs are double precision registers obtained by
@@ -1639,8 +1641,8 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
{
int fpscr_base_regnum;
int sr_base_regnum;
- unsigned int fpscr_value;
- unsigned int sr_value;
+ ULONGEST fpscr_value;
+ ULONGEST sr_value;
unsigned int fpscr_c_value;
unsigned int fpscr_c_part1_value;
unsigned int fpscr_c_part2_value;
@@ -1662,18 +1664,14 @@ sh64_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache,
21-31 reserved
*/
/* *INDENT-ON* */
- /* Get FPSCR into a local buffer. */
- status = regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer);
+ /* Get FPSCR as an int. */
+ status = regcache->raw_read (fpscr_base_regnum, &fpscr_value);
if (status != REG_VALID)
return status;
- /* Get value as an int. */
- fpscr_value = extract_unsigned_integer (temp_buffer, 4, byte_order);
- /* Get SR into a local buffer */
- status = regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
+ /* Get SR as an int. */
+ status = regcache->raw_read (sr_base_regnum, &sr_value);
if (status != REG_VALID)
return status;
- /* Get value as an int. */
- sr_value = extract_unsigned_integer (temp_buffer, 4, byte_order);
/* Build the new value. */
fpscr_c_part1_value = fpscr_value & 0x3fffd;
fpscr_c_part2_value = (sr_value & 0x7000) << 6;
@@ -1704,11 +1702,11 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int base_regnum, portion;
int offset;
- gdb_byte temp_buffer[MAX_REGISTER_SIZE];
if (reg_nr >= DR0_REGNUM
&& reg_nr <= DR_LAST_REGNUM)
{
+ gdb_byte temp_buffer[8];
base_regnum = sh64_dr_reg_base_num (gdbarch, reg_nr);
/* We must pay attention to the endianness. */
sh64_register_convert_to_raw (gdbarch, register_type (gdbarch, reg_nr),
@@ -1752,6 +1750,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= R0_C_REGNUM
&& reg_nr <= T_C_REGNUM)
{
+ gdb_byte temp_buffer[8];
base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
/* reg_nr is 32 bit here, and base_regnum is 64 bits. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG)
@@ -1779,6 +1778,7 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
else if (reg_nr >= DR0_C_REGNUM
&& reg_nr <= DR_LAST_C_REGNUM)
{
+ gdb_byte temp_buffer[8];
base_regnum = sh64_compact_reg_base_num (gdbarch, reg_nr);
for (portion = 0; portion < 2; portion++)
{
@@ -1813,10 +1813,10 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
{
int fpscr_base_regnum;
int sr_base_regnum;
- unsigned int fpscr_value;
- unsigned int sr_value;
- unsigned int old_fpscr_value;
- unsigned int old_sr_value;
+ ULONGEST fpscr_value;
+ ULONGEST sr_value;
+ ULONGEST old_fpscr_value;
+ ULONGEST old_sr_value;
unsigned int fpscr_c_value;
unsigned int fpscr_mask;
unsigned int sr_mask;
@@ -1847,19 +1847,15 @@ sh64_pseudo_register_write (struct gdbarch *gdbarch, struct regcache *regcache,
fpscr_value = fpscr_c_value & fpscr_mask;
sr_value = (fpscr_value & sr_mask) >> 6;
- regcache_raw_read (regcache, fpscr_base_regnum, temp_buffer);
- old_fpscr_value = extract_unsigned_integer (temp_buffer, 4, byte_order);
+ regcache->raw_read (fpscr_base_regnum, &old_fpscr_value);
old_fpscr_value &= 0xfffc0002;
fpscr_value |= old_fpscr_value;
- store_unsigned_integer (temp_buffer, 4, byte_order, fpscr_value);
- regcache_raw_write (regcache, fpscr_base_regnum, temp_buffer);
-
- regcache_raw_read (regcache, sr_base_regnum, temp_buffer);
- old_sr_value = extract_unsigned_integer (temp_buffer, 4, byte_order);
+ regcache->raw_write (fpscr_base_regnum, fpscr_value);
+
+ regcache->raw_read (sr_base_regnum, &old_sr_value);
old_sr_value &= 0xffff8fff;
sr_value |= old_sr_value;
- store_unsigned_integer (temp_buffer, 4, byte_order, sr_value);
- regcache_raw_write (regcache, sr_base_regnum, temp_buffer);
+ regcache->raw_write (sr_base_regnum, sr_value);
}
else if (reg_nr == FPUL_C_REGNUM)
@@ -1949,7 +1945,7 @@ sh64_do_fp_register (struct gdbarch *gdbarch, struct ui_file *file,
fprintf_filtered (file, "\t(raw ");
print_hex_chars (file, raw_buffer,
register_size (gdbarch, regnum),
- gdbarch_byte_order (gdbarch));
+ gdbarch_byte_order (gdbarch), true);
fprintf_filtered (file, ")");
fprintf_filtered (file, "\n");
}
diff --git a/gdb/skip.c b/gdb/skip.c
index 4bd8a9e..e767f83 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -34,6 +34,7 @@
#include "filenames.h"
#include "fnmatch.h"
#include "gdb_regex.h"
+#include "common/gdb_optional.h"
struct skiplist_entry
{
@@ -57,10 +58,7 @@ struct skiplist_entry
char *function;
/* If this is a function regexp, the compiled form. */
- regex_t compiled_function_regexp;
-
- /* Non-zero if the function regexp has been compiled. */
- int compiled_function_regexp_is_valid;
+ gdb::optional<compiled_regex> compiled_function_regexp;
int enabled;
@@ -112,8 +110,6 @@ free_skiplist_entry (struct skiplist_entry *e)
{
xfree (e->file);
xfree (e->function);
- if (e->function_is_regexp && e->compiled_function_regexp_is_valid)
- regfree (&e->compiled_function_regexp);
xfree (e);
}
@@ -202,7 +198,6 @@ skip_function_command (char *arg, int from_tty)
static void
compile_skip_regexp (struct skiplist_entry *e, const char *message)
{
- int code;
int flags = REG_NOSUB;
#ifdef REG_EXTENDED
@@ -210,16 +205,7 @@ compile_skip_regexp (struct skiplist_entry *e, const char *message)
#endif
gdb_assert (e->function_is_regexp && e->function != NULL);
-
- code = regcomp (&e->compiled_function_regexp, e->function, flags);
- if (code != 0)
- {
- char *err = get_regcomp_error (code, &e->compiled_function_regexp);
-
- make_cleanup (xfree, err);
- error (_("%s: %s"), message, err);
- }
- e->compiled_function_regexp_is_valid = 1;
+ e->compiled_function_regexp.emplace (e->function, flags, message);
}
/* Process "skip ..." that does not match "skip file" or "skip function". */
@@ -601,8 +587,8 @@ static int
skip_rfunction_p (struct skiplist_entry *e, const char *function_name)
{
gdb_assert (e->function != NULL && e->function_is_regexp
- && e->compiled_function_regexp_is_valid);
- return (regexec (&e->compiled_function_regexp, function_name, 0, NULL, 0)
+ && e->compiled_function_regexp);
+ return (e->compiled_function_regexp->exec (function_name, 0, NULL, 0)
== 0);
}
diff --git a/gdb/solib.c b/gdb/solib.c
index 491c18a..788cf15 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -350,16 +350,15 @@ solib_find_1 (const char *in_pathname, int *fd, int is_solib)
/* If not found, next search the inferior's $PATH environment variable. */
if (found_file < 0 && sysroot == NULL)
- found_file = openp (get_in_environ (current_inferior ()->environment,
- "PATH"),
+ found_file = openp (current_inferior ()->environment.get ("PATH"),
OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
O_RDONLY | O_BINARY, &temp_pathname);
/* If not found, and we're looking for a solib, next search the
inferior's $LD_LIBRARY_PATH environment variable. */
if (is_solib && found_file < 0 && sysroot == NULL)
- found_file = openp (get_in_environ (current_inferior ()->environment,
- "LD_LIBRARY_PATH"),
+ found_file = openp (current_inferior ()->environment.get
+ ("LD_LIBRARY_PATH"),
OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH, in_pathname,
O_RDONLY | O_BINARY, &temp_pathname);
diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 08ab194..1ab9a9c 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -1721,7 +1721,7 @@ gdb_print_insn_spu (bfd_vma memaddr, struct disassemble_info *info)
memcpy (&spu_info, info, sizeof (*info));
spu_info.id = SPUADDR_SPU (memaddr);
spu_info.print_address_func = spu_dis_asm_print_address;
- return print_insn_spu (memaddr, &spu_info);
+ return default_print_insn (memaddr, &spu_info);
}
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 846aabe..f936cf3 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1333,6 +1333,10 @@ symbol_file_clear (int from_tty)
printf_unfiltered (_("No symbol file now.\n"));
}
+/* See symfile.h. */
+
+int separate_debug_file_debug = 0;
+
static int
separate_debug_file_exists (const char *name, unsigned long crc,
struct objfile *parent_objfile)
@@ -1351,6 +1355,9 @@ separate_debug_file_exists (const char *name, unsigned long crc,
if (filename_cmp (name, objfile_name (parent_objfile)) == 0)
return 0;
+ if (separate_debug_file_debug)
+ printf_unfiltered (_(" Trying %s\n"), name);
+
gdb_bfd_ref_ptr abfd (gdb_bfd_open (name, gnutarget, -1));
if (abfd == NULL)
@@ -1444,6 +1451,10 @@ find_separate_debug_file (const char *dir,
struct cleanup *back_to;
int ix;
+ if (separate_debug_file_debug)
+ printf_unfiltered (_("\nLooking for separate debug info (debug link) for "
+ "%s\n"), objfile_name (objfile));
+
/* Set I to std::max (strlen (canon_dir), strlen (dir)). */
i = strlen (dir);
if (canon_dir != NULL && strlen (canon_dir) > i)
@@ -3975,4 +3986,11 @@ full == print messages for the executable,\n\
NULL,
NULL,
&setprintlist, &showprintlist);
+
+ add_setshow_boolean_cmd ("separate-debug-file", no_class,
+ &separate_debug_file_debug, _("\
+Set printing of separate debug info file search debug."), _("\
+Show printing of separate debug info file search debug."), _("\
+When on, GDB prints the searched locations while looking for separate debug \
+info files."), NULL, NULL, &setdebuglist, &showdebuglist);
}
diff --git a/gdb/symfile.h b/gdb/symfile.h
index ab536e8..bb47fdf 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -646,4 +646,8 @@ extern void elfmdebug_build_psymtabs (struct objfile *,
extern gdb_bfd_ref_ptr find_separate_debug_file_in_section (struct objfile *);
+/* True if we are printing debug output about separate debug info files. */
+
+extern int separate_debug_file_debug;
+
#endif /* !defined(SYMFILE_H) */
diff --git a/gdb/symtab.c b/gdb/symtab.c
index f9ca2ce..c1fd5e6 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -62,6 +62,7 @@
#include "parser-defs.h"
#include "completer.h"
#include "progspace-and-thread.h"
+#include "common/gdb_optional.h"
/* Forward declarations for local functions. */
@@ -4301,9 +4302,7 @@ search_symbols (const char *regexp, enum search_domain kind,
struct symbol_search *found;
struct symbol_search *tail;
int nfound;
- /* This is true if PREG contains valid data, false otherwise. */
- bool preg_p;
- regex_t preg;
+ gdb::optional<compiled_regex> preg;
/* OLD_CHAIN .. RETVAL_CHAIN is always freed, RETVAL_CHAIN .. current
CLEANUP_CHAIN is freed only in the case of an error. */
@@ -4318,7 +4317,6 @@ search_symbols (const char *regexp, enum search_domain kind,
ourtype4 = types4[kind];
*matches = NULL;
- preg_p = false;
if (regexp != NULL)
{
@@ -4357,18 +4355,9 @@ search_symbols (const char *regexp, enum search_domain kind,
}
}
- errcode = regcomp (&preg, regexp,
- REG_NOSUB | (case_sensitivity == case_sensitive_off
- ? REG_ICASE : 0));
- if (errcode != 0)
- {
- char *err = get_regcomp_error (errcode, &preg);
-
- make_cleanup (xfree, err);
- error (_("Invalid regexp (%s): %s"), err, regexp);
- }
- preg_p = true;
- make_regfree_cleanup (&preg);
+ int cflags = REG_NOSUB | (case_sensitivity == case_sensitive_off
+ ? REG_ICASE : 0);
+ preg.emplace (regexp, cflags, _("Invalid regexp"));
}
/* Search through the partial symtabs *first* for all symbols
@@ -4381,8 +4370,8 @@ search_symbols (const char *regexp, enum search_domain kind,
},
[&] (const char *symname)
{
- return (!preg_p || regexec (&preg, symname,
- 0, NULL, 0) == 0);
+ return (!preg || preg->exec (symname,
+ 0, NULL, 0) == 0);
},
NULL,
kind);
@@ -4417,9 +4406,9 @@ search_symbols (const char *regexp, enum search_domain kind,
|| MSYMBOL_TYPE (msymbol) == ourtype3
|| MSYMBOL_TYPE (msymbol) == ourtype4)
{
- if (!preg_p
- || regexec (&preg, MSYMBOL_NATURAL_NAME (msymbol), 0,
- NULL, 0) == 0)
+ if (!preg
+ || preg->exec (MSYMBOL_NATURAL_NAME (msymbol), 0,
+ NULL, 0) == 0)
{
/* Note: An important side-effect of these lookup functions
is to expand the symbol table if msymbol is found, for the
@@ -4461,9 +4450,9 @@ search_symbols (const char *regexp, enum search_domain kind,
files, nfiles, 1))
&& file_matches (symtab_to_fullname (real_symtab),
files, nfiles, 0)))
- && ((!preg_p
- || regexec (&preg, SYMBOL_NATURAL_NAME (sym), 0,
- NULL, 0) == 0)
+ && ((!preg
+ || preg->exec (SYMBOL_NATURAL_NAME (sym), 0,
+ NULL, 0) == 0)
&& ((kind == VARIABLES_DOMAIN
&& SYMBOL_CLASS (sym) != LOC_TYPEDEF
&& SYMBOL_CLASS (sym) != LOC_UNRESOLVED
@@ -4519,9 +4508,8 @@ search_symbols (const char *regexp, enum search_domain kind,
|| MSYMBOL_TYPE (msymbol) == ourtype3
|| MSYMBOL_TYPE (msymbol) == ourtype4)
{
- if (!preg_p
- || regexec (&preg, MSYMBOL_NATURAL_NAME (msymbol), 0,
- NULL, 0) == 0)
+ if (!preg || preg->exec (MSYMBOL_NATURAL_NAME (msymbol), 0,
+ NULL, 0) == 0)
{
/* For functions we can do a quick check of whether the
symbol might be found via find_pc_symtab. */
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 9a7e2dd..0b5b46f 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -48,6 +48,31 @@ DEF_VEC_O(property_s);
typedef struct tdesc_reg
{
+ tdesc_reg (struct tdesc_feature *feature, const char *name_,
+ int regnum, int save_restore_, const char *group_,
+ int bitsize_, const char *type_)
+ : name (xstrdup (name_)), target_regnum (regnum),
+ save_restore (save_restore_),
+ group (group_ != NULL ? xstrdup (group_) : NULL),
+ bitsize (bitsize_),
+ type (type_ != NULL ? xstrdup (type_) : xstrdup ("<unknown>"))
+ {
+ /* If the register's type is target-defined, look it up now. We may not
+ have easy access to the containing feature when we want it later. */
+ tdesc_type = tdesc_named_type (feature, type);
+ }
+
+ ~tdesc_reg ()
+ {
+ xfree (name);
+ xfree (type);
+ xfree (group);
+ }
+
+ /* Disable copying. */
+ tdesc_reg (const tdesc_reg &) = delete;
+ tdesc_reg &operator= (const tdesc_reg &) = delete;
+
/* The name of this register. In standard features, it may be
recognized by the architecture support code, or it may be purely
for the user. */
@@ -128,6 +153,42 @@ enum tdesc_type_kind
typedef struct tdesc_type
{
+ tdesc_type (const char *name_, enum tdesc_type_kind kind_)
+ : name (xstrdup (name_)), kind (kind_)
+ {
+ memset (&u, 0, sizeof (u));
+ }
+
+ ~tdesc_type ()
+ {
+ switch (kind)
+ {
+ case TDESC_TYPE_STRUCT:
+ case TDESC_TYPE_UNION:
+ case TDESC_TYPE_FLAGS:
+ case TDESC_TYPE_ENUM:
+ {
+ struct tdesc_type_field *f;
+ int ix;
+
+ for (ix = 0;
+ VEC_iterate (tdesc_type_field, u.u.fields, ix, f);
+ ix++)
+ xfree (f->name);
+
+ VEC_free (tdesc_type_field, u.u.fields);
+ }
+ break;
+
+ default:
+ break;
+ }
+ xfree ((char *) name);
+ }
+ /* Disable copying. */
+ tdesc_type (const tdesc_type &) = delete;
+ tdesc_type &operator= (const tdesc_type &) = delete;
+
/* The name of this type. If this type is a built-in type, this is
a pointer to a constant string. Otherwise, it's a
malloc-allocated string (and thus must be freed). */
@@ -161,15 +222,40 @@ DEF_VEC_P(tdesc_type_p);
typedef struct tdesc_feature
{
+ tdesc_feature (const char *name_)
+ : name (xstrdup (name_))
+ {}
+
+ ~tdesc_feature ()
+ {
+ struct tdesc_reg *reg;
+ struct tdesc_type *type;
+ int ix;
+
+ for (ix = 0; VEC_iterate (tdesc_reg_p, registers, ix, reg); ix++)
+ delete reg;
+ VEC_free (tdesc_reg_p, registers);
+
+ for (ix = 0; VEC_iterate (tdesc_type_p, types, ix, type); ix++)
+ delete type;
+ VEC_free (tdesc_type_p, types);
+
+ xfree (name);
+ }
+
+ /* Disable copying. */
+ tdesc_feature (const tdesc_feature &) = delete;
+ tdesc_feature &operator= (const tdesc_feature &) = delete;
+
/* The name of this feature. It may be recognized by the architecture
support code. */
char *name;
/* The registers associated with this feature. */
- VEC(tdesc_reg_p) *registers;
+ VEC(tdesc_reg_p) *registers = NULL;
/* The types associated with this feature. */
- VEC(tdesc_type_p) *types;
+ VEC(tdesc_type_p) *types = NULL;
} *tdesc_feature_p;
DEF_VEC_P(tdesc_feature_p);
@@ -1274,81 +1360,23 @@ tdesc_use_registers (struct gdbarch *gdbarch,
}
-/* Methods for constructing a target description. */
-
-static void
-tdesc_free_reg (struct tdesc_reg *reg)
-{
- xfree (reg->name);
- xfree (reg->type);
- xfree (reg->group);
- xfree (reg);
-}
-
void
tdesc_create_reg (struct tdesc_feature *feature, const char *name,
int regnum, int save_restore, const char *group,
int bitsize, const char *type)
{
- struct tdesc_reg *reg = XCNEW (struct tdesc_reg);
-
- reg->name = xstrdup (name);
- reg->target_regnum = regnum;
- reg->save_restore = save_restore;
- reg->group = group ? xstrdup (group) : NULL;
- reg->bitsize = bitsize;
- reg->type = type ? xstrdup (type) : xstrdup ("<unknown>");
-
- /* If the register's type is target-defined, look it up now. We may not
- have easy access to the containing feature when we want it later. */
- reg->tdesc_type = tdesc_named_type (feature, reg->type);
+ tdesc_reg *reg = new tdesc_reg (feature, name, regnum, save_restore,
+ group, bitsize, type);
VEC_safe_push (tdesc_reg_p, feature->registers, reg);
}
-/* Subroutine of tdesc_free_feature to simplify it.
- Note: We do not want to free any referenced types here (e.g., types of
- fields of a struct). All types of a feature are recorded in
- feature->types and are freed that way. */
-
-static void
-tdesc_free_type (struct tdesc_type *type)
-{
- switch (type->kind)
- {
- case TDESC_TYPE_STRUCT:
- case TDESC_TYPE_UNION:
- case TDESC_TYPE_FLAGS:
- case TDESC_TYPE_ENUM:
- {
- struct tdesc_type_field *f;
- int ix;
-
- for (ix = 0;
- VEC_iterate (tdesc_type_field, type->u.u.fields, ix, f);
- ix++)
- xfree (f->name);
-
- VEC_free (tdesc_type_field, type->u.u.fields);
- }
- break;
-
- default:
- break;
- }
-
- xfree ((char *) type->name);
- xfree (type);
-}
-
struct tdesc_type *
tdesc_create_vector (struct tdesc_feature *feature, const char *name,
struct tdesc_type *field_type, int count)
{
- struct tdesc_type *type = XCNEW (struct tdesc_type);
+ struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_VECTOR);
- type->name = xstrdup (name);
- type->kind = TDESC_TYPE_VECTOR;
type->u.v.type = field_type;
type->u.v.count = count;
@@ -1359,10 +1387,7 @@ tdesc_create_vector (struct tdesc_feature *feature, const char *name,
struct tdesc_type *
tdesc_create_struct (struct tdesc_feature *feature, const char *name)
{
- struct tdesc_type *type = XCNEW (struct tdesc_type);
-
- type->name = xstrdup (name);
- type->kind = TDESC_TYPE_STRUCT;
+ struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_STRUCT);
VEC_safe_push (tdesc_type_p, feature->types, type);
return type;
@@ -1383,10 +1408,7 @@ tdesc_set_struct_size (struct tdesc_type *type, int size)
struct tdesc_type *
tdesc_create_union (struct tdesc_feature *feature, const char *name)
{
- struct tdesc_type *type = XCNEW (struct tdesc_type);
-
- type->name = xstrdup (name);
- type->kind = TDESC_TYPE_UNION;
+ struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_UNION);
VEC_safe_push (tdesc_type_p, feature->types, type);
return type;
@@ -1396,12 +1418,10 @@ struct tdesc_type *
tdesc_create_flags (struct tdesc_feature *feature, const char *name,
int size)
{
- struct tdesc_type *type = XCNEW (struct tdesc_type);
+ struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_FLAGS);
gdb_assert (size > 0);
- type->name = xstrdup (name);
- type->kind = TDESC_TYPE_FLAGS;
type->u.u.size = size;
VEC_safe_push (tdesc_type_p, feature->types, type);
@@ -1412,12 +1432,10 @@ struct tdesc_type *
tdesc_create_enum (struct tdesc_feature *feature, const char *name,
int size)
{
- struct tdesc_type *type = XCNEW (struct tdesc_type);
+ struct tdesc_type *type = new tdesc_type (name, TDESC_TYPE_ENUM);
gdb_assert (size > 0);
- type->name = xstrdup (name);
- type->kind = TDESC_TYPE_ENUM;
type->u.u.size = size;
VEC_safe_push (tdesc_type_p, feature->types, type);
@@ -1521,31 +1539,10 @@ tdesc_add_enum_value (struct tdesc_type *type, int value,
VEC_safe_push (tdesc_type_field, type->u.u.fields, &f);
}
-static void
-tdesc_free_feature (struct tdesc_feature *feature)
-{
- struct tdesc_reg *reg;
- struct tdesc_type *type;
- int ix;
-
- for (ix = 0; VEC_iterate (tdesc_reg_p, feature->registers, ix, reg); ix++)
- tdesc_free_reg (reg);
- VEC_free (tdesc_reg_p, feature->registers);
-
- for (ix = 0; VEC_iterate (tdesc_type_p, feature->types, ix, type); ix++)
- tdesc_free_type (type);
- VEC_free (tdesc_type_p, feature->types);
-
- xfree (feature->name);
- xfree (feature);
-}
-
struct tdesc_feature *
tdesc_create_feature (struct target_desc *tdesc, const char *name)
{
- struct tdesc_feature *new_feature = XCNEW (struct tdesc_feature);
-
- new_feature->name = xstrdup (name);
+ struct tdesc_feature *new_feature = new tdesc_feature (name);
VEC_safe_push (tdesc_feature_p, tdesc->features, new_feature);
return new_feature;
@@ -1568,7 +1565,7 @@ free_target_description (void *arg)
for (ix = 0;
VEC_iterate (tdesc_feature_p, target_desc->features, ix, feature);
ix++)
- tdesc_free_feature (feature);
+ delete feature;
VEC_free (tdesc_feature_p, target_desc->features);
for (ix = 0;
diff --git a/gdb/target.h b/gdb/target.h
index a971adf..c0155c1 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -712,22 +712,25 @@ struct target_ops
CORE_ADDR offset)
TARGET_DEFAULT_NORETURN (generic_tls_error ());
- /* Request that OPS transfer up to LEN 8-bit bytes of the target's
- OBJECT. The OFFSET, for a seekable object, specifies the
+ /* Request that OPS transfer up to LEN addressable units of the target's
+ OBJECT. When reading from a memory object, the size of an addressable
+ unit is architecture dependent and can be found using
+ gdbarch_addressable_memory_unit_size. Otherwise, an addressable unit is
+ 1 byte long. The OFFSET, for a seekable object, specifies the
starting point. The ANNEX can be used to provide additional
data-specific information to the target.
Return the transferred status, error or OK (an
- 'enum target_xfer_status' value). Save the number of bytes
+ 'enum target_xfer_status' value). Save the number of addressable units
actually transferred in *XFERED_LEN if transfer is successful
- (TARGET_XFER_OK) or the number unavailable bytes if the requested
+ (TARGET_XFER_OK) or the number unavailable units if the requested
data is unavailable (TARGET_XFER_UNAVAILABLE). *XFERED_LEN
smaller than LEN does not indicate the end of the object, only
the end of the transfer; higher level code should continue
transferring if desired. This is handled in target.c.
The interface does not support a "retry" mechanism. Instead it
- assumes that at least one byte will be transfered on each
+ assumes that at least one addressable unit will be transfered on each
successful call.
NOTE: cagney/2003-10-17: The current interface can lead to
@@ -1538,16 +1541,8 @@ extern int target_terminal_is_inferior (void);
extern int target_terminal_is_ours (void);
-/* Initialize the terminal settings we record for the inferior,
- before we actually run the inferior. */
-
-extern void target_terminal_init (void);
-
-/* Put the inferior's terminal settings into effect. This is
- preparation for starting or resuming the inferior. This is a no-op
- unless called with the main UI as current UI. */
-
-extern void target_terminal_inferior (void);
+/* For target_terminal_init, target_terminal_inferior and
+ target_terminal_ours, see target/target.h. */
/* Put some of our terminal settings into effect, enough to get proper
results from our output, but do not change into or out of RAW mode
@@ -1557,12 +1552,6 @@ extern void target_terminal_inferior (void);
extern void target_terminal_ours_for_output (void);
-/* Put our terminal settings into effect. First record the inferior's
- terminal settings so they can be restored properly later. This is
- a no-op unless called with the main UI as current UI. */
-
-extern void target_terminal_ours (void);
-
/* Return true if the target stack has a non-default
"to_terminal_ours" method. */
diff --git a/gdb/target/target.h b/gdb/target/target.h
index 582852c..0528766 100644
--- a/gdb/target/target.h
+++ b/gdb/target/target.h
@@ -95,4 +95,18 @@ extern void target_mourn_inferior (ptid_t ptid);
extern int target_supports_multi_process (void);
+/* Initialize the terminal settings we record for the inferior,
+ before we actually run the inferior. */
+extern void target_terminal_init ();
+
+/* Put the inferior's terminal settings into effect. This is
+ preparation for starting or resuming the inferior. This is a no-op
+ unless called with the main UI as current UI. */
+extern void target_terminal_inferior ();
+
+/* Put our terminal settings into effect. First record the inferior's
+ terminal settings so they can be restored properly later. This is
+ a no-op unless called with the main UI as current UI. */
+extern void target_terminal_ours ();
+
#endif /* TARGET_COMMON_H */
diff --git a/gdb/terminal.h b/gdb/terminal.h
index fb20ae0..0027a3a 100644
--- a/gdb/terminal.h
+++ b/gdb/terminal.h
@@ -29,16 +29,8 @@ extern void new_tty_postfork (void);
extern void copy_terminal_info (struct inferior *to, struct inferior *from);
-/* Do we have job control? Can be assumed to always be the same within
- a given run of GDB. In inflow.c. */
-extern int job_control;
-
extern pid_t create_tty_session (void);
-/* Set the process group of the caller to its own pid, or do nothing if
- we lack job control. */
-extern int gdb_setpgid (void);
-
/* Set up a serial structure describing standard input. In inflow.c. */
extern void initialize_stdin_serial (void);
@@ -48,8 +40,4 @@ extern void gdb_save_tty_state (void);
have had a chance to alter it. */
extern void set_initial_gdb_ttystate (void);
-/* Set the process group of the caller to its own pid, or do nothing
- if we lack job control. */
-extern int gdb_setpgid (void);
-
#endif /* !defined (TERMINAL_H) */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index cb1d8ec..253e229 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,91 @@
+2017-06-21 Kevin Buettner <kevinb@redhat.com>
+
+ * gdb.exp (gdb_test): Using noncapturing parens for the $pattern
+ subpattern.
+
+2017-06-19 Peter Bergner <bergner@vnet.ibm.com>
+
+ * gdb.arch/powerpc-power9.exp: Update test case for new lnia
+ extended mnemonic.
+ * gdb.arch/powerpc-power9.s: Likewise.
+
+2017-06-14 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.dwarf2/var-access.exp: Use register name ecx instead of edx
+ on 32-bit x86 targets. Exploit is_*_target macros where
+ appropriate.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.dwarf2/var-access.exp: Add test for non-byte-aligned
+ register pieces.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.dwarf2/var-access.exp: Add tests for accessing bit-fields
+ located in one or more DWARF pieces.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * lib/gdb.exp (get_endianness): New proc.
+ * gdb.arch/aarch64-fp.exp: Use it.
+ * gdb.arch/altivec-regs.exp: Likewise.
+ * gdb.arch/e500-regs.exp: Likewise.
+ * gdb.arch/vsx-regs.exp: Likewise.
+ * gdb.base/dump.exp: Likewise.
+ * gdb.base/funcargs.exp: Likewise.
+ * gdb.base/gnu_vector.exp: Likewise.
+ * gdb.dwarf2/formdata16.exp: Likewise.
+ * gdb.dwarf2/implptrpiece.exp: Likewise.
+ * gdb.dwarf2/nonvar-access.exp: Likewise.
+ * gdb.python/py-inferior.exp: Likewise.
+ * gdb.trace/unavailable-dwarf-piece.exp: Likewise.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ PR gdb/21226
+ * gdb.dwarf2/nonvar-access.exp: Add checks for verifying that
+ stack value pieces are taken from the LSB end.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.dwarf2/var-pieces.exp: Add test case for modifying a
+ variable at nonzero offset.
+
+2017-06-13 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * gdb.dwarf2/var-access.c: New file.
+ * gdb.dwarf2/var-access.exp: New test.
+ * lib/gdb-utils.exp (string_to_regexp): Quote braces as well.
+
+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ * gdb.dwarf2/formdata16.exp: Add tests.
+
+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ * gdb.arch/altivec-regs.exp: Expect decimal results for uint128.
+
+2017-06-12 Tom Tromey <tom@tromey.com>
+
+ PR exp/16225:
+ * gdb.reverse/i386-sse-reverse.exp: Update tests.
+ * gdb.arch/vsx-regs.exp: Update tests.
+ * gdb.arch/s390-vregs.exp (hex128): New proc.
+ Update test.
+ * gdb.arch/altivec-regs.exp: Update tests.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * gdb.base/startup-with-shell.c: New file.
+ * gdb.base/startup-with-shell.exp: Likewise.
+
+2017-06-07 Sergio Durigan Junior <sergiodj@redhat.com>
+
+ * gdb.server/non-existing-program.exp: Update regex in order to
+ reflect the fact that gdbserver is now using fork_inferior (with a
+ shell) to startup the inferior.
+
2017-05-30 Simon Marchi <simon.marchi@ericsson.com>
* gdb.base/watch-cond-infcall.exp: Don't run if target doesn't
diff --git a/gdb/testsuite/gdb.arch/aarch64-fp.exp b/gdb/testsuite/gdb.arch/aarch64-fp.exp
index 2faf121..483c8f1 100644
--- a/gdb/testsuite/gdb.arch/aarch64-fp.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-fp.exp
@@ -34,14 +34,7 @@ if ![runto_main] {
return -1
}
-set endianness "little"
-set test "show endian"
-gdb_test_multiple $test $test {
- -re "(.* )(big|little)( endian.*)$gdb_prompt $" {
- set endianness $expect_out(2,string)
- pass "endianness"
- }
-}
+set endianness [get_endianness]
gdb_test "break ${srcfile}:[gdb_get_line_number "return"]" \
"Breakpoint $decimal at 0x\[0-9a-fA-F\]+: file .*${srcfile}.*\\\." \
diff --git a/gdb/testsuite/gdb.arch/altivec-regs.exp b/gdb/testsuite/gdb.arch/altivec-regs.exp
index 680b512..165f61a 100644
--- a/gdb/testsuite/gdb.arch/altivec-regs.exp
+++ b/gdb/testsuite/gdb.arch/altivec-regs.exp
@@ -77,26 +77,16 @@ gdb_test "set \$vrsave = 1" "" ""
gdb_test "next" "" ""
-set endianness ""
-set msg "detect endianness"
-gdb_test_multiple "show endian" "$msg" {
- -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
- pass "$msg"
- set endianness $expect_out(2,string)
- }
- -re ".*$gdb_prompt $" {
- fail "$msg"
- }
-}
+set endianness [get_endianness]
# And then read the AltiVec registers back, to see that
# a) the register write above worked, and
# b) the register read (below) also works.
if {$endianness == "big"} {
-set vector_register ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
+set vector_register ".uint128 = 0x1000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
} else {
-set vector_register ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
+set vector_register ".uint128 = 0x1000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
}
for {set i 0} {$i < 32} {incr i 1} {
@@ -113,9 +103,9 @@ gdb_test "info reg vscr" "vscr.*0x1\t1" "info reg vscr"
# the way gdb works.
if {$endianness == "big"} {
- set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.."
+ set decimal_vector ".uint128 = 79228162532711081671548469249, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .0, 1, 0, 1, 0, 1, 0, 1., v16_int8 = .0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1.."
} else {
- set decimal_vector ".uint128 = 0x00000001000000010000000100000001, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.."
+ set decimal_vector ".uint128 = 79228162532711081671548469249, v4_float = .1.*e-45, 1.*e-45, 1.*e-45, 1.*e-45., v4_int32 = .1, 1, 1, 1., v8_int16 = .1, 0, 1, 0, 1, 0, 1, 0., v16_int8 = .1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.."
}
for {set i 0} {$i < 32} {incr i 1} {
diff --git a/gdb/testsuite/gdb.arch/e500-regs.exp b/gdb/testsuite/gdb.arch/e500-regs.exp
index 8bf405a..bab6e7d 100644
--- a/gdb/testsuite/gdb.arch/e500-regs.exp
+++ b/gdb/testsuite/gdb.arch/e500-regs.exp
@@ -59,17 +59,7 @@ for {set i 0} {$i < 32} {incr i 1} {
#gdb_test "next" "" ""
-send_gdb "show endian\n"
-gdb_expect {
- -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
- pass "endianness"
- set endianness $expect_out(2,string)
- }
- -re ".*$gdb_prompt $" {
- fail "couldn't get endianness"
- }
- timeout { fail "(timeout) endianness" }
-}
+set endianness [get_endianness]
# And then read the E500 registers back, to see that
# a) the register write above worked, and
diff --git a/gdb/testsuite/gdb.arch/powerpc-power9.exp b/gdb/testsuite/gdb.arch/powerpc-power9.exp
index cb9be17..4df78e1 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power9.exp
+++ b/gdb/testsuite/gdb.arch/powerpc-power9.exp
@@ -364,8 +364,8 @@ func_check "xscvhpdp vs40,vs50"
func_check "xscvdphp vs41,vs51"
func_check "xvcvhpsp vs42,vs52"
func_check "xvcvsphp vs43,vs53"
-func_check "addpcis r3,0"
-func_check "addpcis r3,0"
+func_check "lnia r3"
+func_check "lnia r3"
func_check "addpcis r4,1"
func_check "addpcis r4,1"
func_check "addpcis r5,-2"
diff --git a/gdb/testsuite/gdb.arch/powerpc-power9.s b/gdb/testsuite/gdb.arch/powerpc-power9.s
index 65d8783..5d1a280 100644
--- a/gdb/testsuite/gdb.arch/powerpc-power9.s
+++ b/gdb/testsuite/gdb.arch/powerpc-power9.s
@@ -321,7 +321,7 @@ func:
.long 0xf1319d6f /* xscvdphp vs41,vs51 */
.long 0xf158a76f /* xvcvhpsp vs42,vs52 */
.long 0xf179af6f /* xvcvsphp vs43,vs53 */
- .long 0x4c600004 /* addpcis r3,0 */
+ .long 0x4c600004 /* lnia r3 */
.long 0x4c600004 /* addpcis r3,0 */
.long 0x4c800005 /* addpcis r4,1 */
.long 0x4c800005 /* addpcis r4,1 */
diff --git a/gdb/testsuite/gdb.arch/s390-vregs.exp b/gdb/testsuite/gdb.arch/s390-vregs.exp
index 800cc0b..078c153 100644
--- a/gdb/testsuite/gdb.arch/s390-vregs.exp
+++ b/gdb/testsuite/gdb.arch/s390-vregs.exp
@@ -146,16 +146,23 @@ if { $i != 32 } {
gdb_continue_to_breakpoint "change vrs"
set vregs [capture_command_output "info registers vector" ""]
+# Format a 128-bit value, given individual 4-byte values, as hex.
+# Leading zeros are suppressed.
+proc hex128 {a_high a_low b_high b_low} {
+ set result [format %08x%08x%08x%08x \
+ [expr $a_high * ($i + 1) * $a_high ] \
+ [expr $a_low * ($i + 1) * $a_low ] \
+ [expr $b_high * (32 - $i) * $b_high * 32] \
+ [expr $b_low * (32 - $i) * $b_low * 32] ]
+ return [regsub -- "^0*" $result ""]
+}
+
set j 1
foreach {- r i val} [regexp -all -inline -line \
{^(\D*)(\d+)\s+.*?uint128 = 0x([0-9a-f]+?)} $vregs] {
if { $r ne "v" } {
fail "info registers vector: bad line $j"
- } elseif { $val ne [format %08x%08x%08x%08x \
- [expr $a_high * ($i + 1) * $a_high ] \
- [expr $a_low * ($i + 1) * $a_low ] \
- [expr $b_high * (32 - $i) * $b_high * 32] \
- [expr $b_low * (32 - $i) * $b_low * 32] ] } {
+ } elseif { $val ne [hex128 $a_high $a_low $b_high $b_low] } {
fail "compare \$v$i"
}
incr j 1
diff --git a/gdb/testsuite/gdb.arch/vsx-regs.exp b/gdb/testsuite/gdb.arch/vsx-regs.exp
index bedbcaa..e6b8d72 100644
--- a/gdb/testsuite/gdb.arch/vsx-regs.exp
+++ b/gdb/testsuite/gdb.arch/vsx-regs.exp
@@ -56,17 +56,7 @@ if ![runto_main] then {
gdb_suppress_tests
}
-set endianness ""
-set msg "detect endianness"
-gdb_test_multiple "show endian" "$msg" {
- -re "(The target endianness is set automatically .currently )(big|little)( endian.*)$gdb_prompt $" {
- pass "$msg"
- set endianness $expect_out(2,string)
- }
- -re ".*$gdb_prompt $" {
- fail "$msg"
- }
-}
+set endianness [get_endianness]
# Data sets used throughout the test
@@ -79,9 +69,9 @@ if {$endianness == "big"} {
set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef., v16_int8 = .0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef, 0xde, 0xad, 0xbe, 0xef.."
- set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
+ set vector_register3 ".uint128 = 0x1000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
- set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
+ set vector_register3_vr ".uint128 = 0x1000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1., v16_int8 = .0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1.."
} else {
set vector_register1 ".uint128 = 0x3ff4cccccccccccc0000000000000000, v2_double = .0x0, 0x1., v4_float = .0x0, 0x0, 0xf99999a0, 0x1., v4_int32 = .0x0, 0x0, 0xcccccccc, 0x3ff4cccc., v8_int16 = .0x0, 0x0, 0x0, 0x0, 0xcccc, 0xcccc, 0xcccc, 0x3ff4., v16_int8 = .0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xf4, 0x3f.."
@@ -91,9 +81,9 @@ if {$endianness == "big"} {
set vector_register2_vr "uint128 = 0xdeadbeefdeadbeefdeadbeefdeadbeef, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef., v8_int16 = .0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead, 0xbeef, 0xdead., v16_int8 = .0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde, 0xef, 0xbe, 0xad, 0xde.."
- set vector_register3 ".uint128 = 0x00000001000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
+ set vector_register3 ".uint128 = 0x1000000010000000100000001, v2_double = .0x0, 0x0., v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
- set vector_register3_vr ".uint128 = 0x00000001000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
+ set vector_register3_vr ".uint128 = 0x1000000010000000100000001, v4_float = .0x0, 0x0, 0x0, 0x0., v4_int32 = .0x1, 0x1, 0x1, 0x1., v8_int16 = .0x1, 0x0, 0x1, 0x0, 0x1, 0x0, 0x1, 0x0., v16_int8 = .0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0.."
}
set float_register ".raw 0xdeadbeefdeadbeef."
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index e67e1aa..a9625d7 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -101,12 +101,7 @@ if { ! [ runto checkpoint1 ] } then {
# Get the endianness for the later use with endianless formats.
-gdb_test_multiple "show endian" "show endian" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
-}
+set endian [get_endianness]
# Now generate some dump files.
diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp
index 5852f12..c48b882 100644
--- a/gdb/testsuite/gdb.base/funcargs.exp
+++ b/gdb/testsuite/gdb.base/funcargs.exp
@@ -1139,15 +1139,9 @@ gdb_test_multiple "print sizeof (int)" "getting sizeof int" {
}
}
-gdb_test_multiple "show endian" "getting target endian" {
- -re ".*little endian.*$gdb_prompt $" {
- set target_bigendian_p 0
- # pass silently
- }
- -re ".*big endian.*$gdb_prompt $" {
- set target_bigendian_p 1
- # pass silently
- }
+switch [get_endianness] {
+ little { set target_bigendian_p 0 }
+ big { set target_bigendian_p 1 }
}
# Perform tests
diff --git a/gdb/testsuite/gdb.base/gnu_vector.exp b/gdb/testsuite/gdb.base/gnu_vector.exp
index 1e0e46c..44b1405 100644
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
@@ -48,12 +48,7 @@ if { ![runto main] } {
}
# Get endianess for the scalar->vector casts
-gdb_test_multiple "show endian" "show endian" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
-}
+set endian [get_endianness]
# Test printing of character vector types
gdb_test "print c4" "\\\$$decimal = \\{1, 2, 3, 4\\}"
diff --git a/gdb/testsuite/gdb.base/startup-with-shell.c b/gdb/testsuite/gdb.base/startup-with-shell.c
new file mode 100644
index 0000000..6278447
--- /dev/null
+++ b/gdb/testsuite/gdb.base/startup-with-shell.c
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2017 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+
+int
+main (int argc, char *argv[])
+{
+ int i;
+
+ for (i = 0; argv[i] != NULL; ++i)
+ printf ("ARG %d = %s\n", i, argv[i]);
+
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
new file mode 100644
index 0000000..af06c88
--- /dev/null
+++ b/gdb/testsuite/gdb.base/startup-with-shell.exp
@@ -0,0 +1,89 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This test doesn't make sense on native-gdbserver.
+if { [use_gdb_stub] } {
+ untested "not supported"
+ return
+}
+
+# There's no easy way to set environment variables on remote targets
+# (via dejagnu) yet.
+if { [is_remote target] } {
+ untested "remote board"
+ return
+}
+
+standard_testfile
+
+if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } {
+ return -1
+}
+
+set unique_file [standard_output_file "unique-file.unique-extension"]
+set unique_file_dir [standard_output_file ""]
+
+run_on_host "touch $unique_file" "touch" "$unique_file"
+
+# Initial setup for simple test (wildcard expansion, variable substitution).
+
+proc initial_setup_simple { startup_with_shell run_args } {
+ global hex decimal binfile unique_file
+
+ clean_restart $binfile
+
+ gdb_test_no_output "set startup-with-shell $startup_with_shell"
+
+ gdb_test_no_output "set args $run_args"
+
+ set test "inferior started"
+ if { [runto_main] } {
+ pass $test
+ } else {
+ fail $test
+ }
+}
+
+## Run the actual tests
+
+with_test_prefix "startup_with_shell = on; run_args = *.unique-extension" {
+ initial_setup_simple "on" "$unique_file_dir/*.unique-extension"
+ gdb_test "print argv\[1\]" "\\\$$decimal = $hex \"$unique_file\"" \
+ "first argument expanded"
+}
+
+with_test_prefix "startup_with_shell = off; run_args = *.unique-extension" {
+ initial_setup_simple "off" "$unique_file_dir/*.unique-extension"
+ gdb_test "print argv\[1\]" "\\\$$decimal = $hex \"$unique_file_dir/\\\*\.unique-extension\"" \
+ "first argument not expanded"
+}
+
+with_test_prefix "startup_with_shell = on; run_args = \$TEST" {
+ set env(TEST) "1234"
+ initial_setup_simple "on" "\$TEST"
+ gdb_test "print argv\[1\]" "\\\$$decimal = $hex \"1234\"" \
+ "testing first argument"
+ unset env(TEST)
+}
+
+with_test_prefix "startup_with_shell = off; run_args = \$TEST" {
+ set env(TEST) "1234"
+ initial_setup_simple "off" "\$TEST"
+ gdb_test "print argv\[1\]" "\\\$$decimal = $hex \"\\\$TEST\"" \
+ "testing first argument"
+ unset env(TEST)
+}
diff --git a/gdb/testsuite/gdb.dwarf2/formdata16.exp b/gdb/testsuite/gdb.dwarf2/formdata16.exp
index bba2015..752ccb4 100644
--- a/gdb/testsuite/gdb.dwarf2/formdata16.exp
+++ b/gdb/testsuite/gdb.dwarf2/formdata16.exp
@@ -28,31 +28,28 @@ if [prepare_for_testing "failed to prepare for endianness test" ${testfile} ${sr
return -1
}
-set endianness "little"
-set test "show endian"
-gdb_test_multiple $test $test {
- -re "(.* )(big|little)( endian.*)\r\n$gdb_prompt $" {
- set endianness $expect_out(2,string)
- pass "endianness"
- }
-}
+set endianness [get_endianness]
set high "0x123456789abcdef0"
set low "0x0fedcba987654321"
if { $endianness == "big" } {
set pair $high,$low
+ set pair2 0x0,$low
+ set negative 0xffffffffffffffff,$low
} else {
set pair $low,$high
+ set pair2 $low,0x0
+ set negative $low,0xffffffffffffffff
}
# Make some DWARF for the test.
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
- global pair
+ global pair pair2 negative
cu { addr_size 4 } {
compile_unit {} {
- declare_labels int_label
+ declare_labels int_label sint_label
int_label: DW_TAG_base_type {
{DW_AT_byte_size 16 DW_FORM_udata}
@@ -60,11 +57,29 @@ Dwarf::assemble $asm_file {
{DW_AT_name "__uint128"}
}
+ sint_label: DW_TAG_base_type {
+ {DW_AT_byte_size 16 DW_FORM_udata}
+ {DW_AT_encoding @DW_ATE_signed}
+ {DW_AT_name "__int128"}
+ }
+
DW_TAG_variable {
{name xxx}
{type :$int_label}
{const_value $pair DW_FORM_data16}
}
+
+ DW_TAG_variable {
+ {name yyy}
+ {type :$int_label}
+ {const_value $pair2 DW_FORM_data16}
+ }
+
+ DW_TAG_variable {
+ {name sss}
+ {type :$sint_label}
+ {const_value $negative DW_FORM_data16}
+ }
}
}
}
@@ -75,3 +90,8 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
}
gdb_test "p/x xxx" " = 0x123456789abcdef00fedcba987654321"
+gdb_test "p xxx" "= 24197857203266734864629346612071973665"
+gdb_test "p/x yyy" " = 0xfedcba987654321"
+gdb_test "p yyy" "= 1147797409030816545"
+gdb_test "p/x sss" " = 0xffffffffffffffff0fedcba987654321"
+gdb_test "p sss" "= -17298946664678735071"
diff --git a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
index ef483c0..ac3ee78 100644
--- a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
+++ b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp
@@ -119,14 +119,8 @@ if ![runto_main] {
return -1
}
-# Determine endianness.
-set endian "little"
-gdb_test_multiple "show endian" "determine endianness" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
-}
+# Determine byte order.
+set endian [get_endianness]
# Access the second byte of s through an implicit pointer to the third
# byte of s, using a negative offset. Compare that to the second byte of
diff --git a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp
index 99f63cc..b7d952a 100644
--- a/gdb/testsuite/gdb.dwarf2/nonvar-access.exp
+++ b/gdb/testsuite/gdb.dwarf2/nonvar-access.exp
@@ -128,14 +128,26 @@ Dwarf::assemble $asm_file {
{name def_t}
{type :$struct_t_label}
{location {
- const1u 0
+ const2s -184
stack_value
bit_piece 9 0
- const1s -1
+ const4u 1752286
stack_value
bit_piece 23 0
} SPECIAL_expr}
}
+ # Composite location with some empty pieces.
+ DW_TAG_variable {
+ {name part_def_a}
+ {type :$array_a9_label}
+ {location {
+ piece 3
+ const4u 0xf1927314
+ stack_value
+ piece 4
+ piece 2
+ } SPECIAL_expr}
+ }
# Implicit location: immediate value.
DW_TAG_variable {
{name def_implicit_s}
@@ -193,14 +205,8 @@ if ![runto_main] {
return -1
}
-# Determine endianness.
-set endian "little"
-gdb_test_multiple "show endian" "determine endianness" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
-}
+# Determine byte order.
+set endian [get_endianness]
# Byte-aligned objects with simple location descriptions.
switch $endian { big {set val 0x345678} little {set val 0x785634} }
@@ -221,9 +227,12 @@ gdb_test "print/x *implicit_b_ptr" " = $val"
# Byte-aligned fields, pieced together from DWARF stack values.
gdb_test "print def_s" " = \\{a = 0, b = -1\\}"
+switch $endian { big {set val 0x92} little {set val 0x73} }
+gdb_test "print/x part_def_a\[4\]" " = $val"
+gdb_test "print/x part_def_a\[8\]" " = <optimized out>"
# Non-byte-aligned fields, pieced together from DWARF stack values.
-gdb_test "print def_t" " = \\{a = 0, b = -1\\}"
+gdb_test "print def_t" " = \\{a = -184, b = 1752286\\}"
# Simple variable without location.
gdb_test "print undef_int" " = <optimized out>"
diff --git a/gdb/testsuite/gdb.dwarf2/var-access.c b/gdb/testsuite/gdb.dwarf2/var-access.c
new file mode 100644
index 0000000..108be82
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/var-access.c
@@ -0,0 +1,25 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2017 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+char buf[] = {0, 1, 2, 3, 4, 5, 6, 7};
+
+int
+main (void)
+{
+ asm volatile ("main_label: .globl main_label");
+ return 0;
+}
diff --git a/gdb/testsuite/gdb.dwarf2/var-access.exp b/gdb/testsuite/gdb.dwarf2/var-access.exp
new file mode 100644
index 0000000..8ebad6a
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/var-access.exp
@@ -0,0 +1,345 @@
+# Copyright 2017 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test reading/writing variables with non-trivial DWARF locations. In
+# particular the test uses register- and memory locations as well as
+# composite locations with register- and memory pieces.
+
+load_lib dwarf.exp
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+if {![dwarf2_support]} {
+ return 0
+}
+
+# Choose suitable integer registers for the test.
+
+set dwarf_regnum {0 1}
+
+if { [is_aarch64_target] } {
+ set regname {x0 x1}
+} elseif { [is_aarch32_target]
+ || [istarget "s390*-*-*" ]
+ || [istarget "powerpc*-*-*"]
+ || [istarget "rs6000*-*-aix*"] } {
+ set regname {r0 r1}
+} elseif { [is_x86_like_target] } {
+ set regname {eax ecx}
+} elseif { [is_amd64_regs_target] } {
+ set regname {rax rdx}
+} else {
+ verbose "Skipping tests for accessing DWARF-described variables."
+ return
+}
+
+standard_testfile .c ${gdb_test_file_name}-dw.S
+
+# Make some DWARF for the test.
+
+set asm_file [standard_output_file $srcfile2]
+Dwarf::assemble $asm_file {
+ global srcdir subdir srcfile
+ global dwarf_regnum regname
+
+ set buf_var [gdb_target_symbol buf]
+
+ cu {} {
+ DW_TAG_compile_unit {
+ {DW_AT_name var-pieces-dw.c}
+ {DW_AT_comp_dir /tmp}
+ } {
+ declare_labels char_type_label
+ declare_labels int_type_label short_type_label
+ declare_labels array_a8_label struct_s_label struct_t_label
+ declare_labels struct_st_label
+
+ # char
+ char_type_label: base_type {
+ {name "char"}
+ {encoding @DW_ATE_unsigned_char}
+ {byte_size 1 DW_FORM_sdata}
+ }
+
+ # int
+ int_type_label: base_type {
+ {name "int"}
+ {encoding @DW_ATE_signed}
+ {byte_size 4 DW_FORM_sdata}
+ }
+
+ # char [8]
+ array_a8_label: array_type {
+ {type :$char_type_label}
+ } {
+ subrange_type {
+ {type :$int_type_label}
+ {upper_bound 7 DW_FORM_udata}
+ }
+ }
+
+ # struct s { char a, b, c, d; };
+ struct_s_label: structure_type {
+ {name "s"}
+ {byte_size 4 DW_FORM_sdata}
+ } {
+ member {
+ {name "a"}
+ {type :$char_type_label}
+ {data_member_location 0 DW_FORM_udata}
+ }
+ member {
+ {name "b"}
+ {type :$char_type_label}
+ {data_member_location 1 DW_FORM_udata}
+ }
+ member {
+ {name "c"}
+ {type :$char_type_label}
+ {data_member_location 2 DW_FORM_udata}
+ }
+ member {
+ {name "d"}
+ {type :$char_type_label}
+ {data_member_location 3 DW_FORM_udata}
+ }
+ }
+
+ # struct t { int u, x:9, y:13, z:10; };
+ struct_t_label: structure_type {
+ {name "t"}
+ {byte_size 8 DW_FORM_sdata}
+ } {
+ member {
+ {name "u"}
+ {type :$int_type_label}
+ }
+ member {
+ {name "x"}
+ {type :$int_type_label}
+ {data_member_location 4 DW_FORM_udata}
+ {bit_size 9 DW_FORM_udata}
+ }
+ member {
+ {name "y"}
+ {type :$int_type_label}
+ {data_bit_offset 41 DW_FORM_udata}
+ {bit_size 13 DW_FORM_udata}
+ }
+ member {
+ {name "z"}
+ {type :$int_type_label}
+ {data_bit_offset 54 DW_FORM_udata}
+ {bit_size 10 DW_FORM_udata}
+ }
+ }
+
+ # struct st { struct s s; struct t t; };
+ struct_st_label: structure_type {
+ {name "st"}
+ {byte_size 12 DW_FORM_udata}
+ } {
+ member {
+ {name "s"}
+ {type :$struct_s_label}
+ }
+ member {
+ {name "t"}
+ {type :$struct_t_label}
+ {data_member_location 4 DW_FORM_udata}
+ }
+ }
+
+ DW_TAG_subprogram {
+ {MACRO_AT_func { main ${srcdir}/${subdir}/${srcfile} }}
+ {DW_AT_external 1 flag}
+ } {
+ # Simple memory location.
+ DW_TAG_variable {
+ {name "a"}
+ {type :$array_a8_label}
+ {location {
+ addr $buf_var
+ } SPECIAL_expr}
+ }
+ # Memory pieces: two bytes from &buf[2], and two bytes
+ # from &buf[0].
+ DW_TAG_variable {
+ {name "s1"}
+ {type :$struct_s_label}
+ {location {
+ addr $buf_var
+ plus_uconst 2
+ piece 2
+ addr $buf_var
+ piece 2
+ } SPECIAL_expr}
+ }
+ # Register- and memory pieces: one byte each from r0,
+ # &buf[4], r1, and &buf[5].
+ DW_TAG_variable {
+ {name "s2"}
+ {type :$struct_s_label}
+ {location {
+ regx [lindex $dwarf_regnum 0]
+ piece 1
+ addr "$buf_var + 4"
+ piece 1
+ regx [lindex $dwarf_regnum 1]
+ piece 1
+ addr "$buf_var + 5"
+ piece 1
+ } SPECIAL_expr}
+ }
+ # Memory pieces for bitfield access: 8 bytes optimized
+ # out, 3 bytes from &buf[3], and 1 byte from &buf[1].
+ DW_TAG_variable {
+ {name "st1"}
+ {type :$struct_st_label}
+ {location {
+ piece 8
+ addr "$buf_var + 3"
+ piece 3
+ addr "$buf_var + 1"
+ piece 1
+ } SPECIAL_expr}
+ }
+ # Register pieces for bitfield access: 4 bytes optimized
+ # out, 3 bytes from r0, and 1 byte from r1.
+ DW_TAG_variable {
+ {name "t2"}
+ {type :$struct_t_label}
+ {location {
+ piece 4
+ regx [lindex $dwarf_regnum 0]
+ piece 3
+ regx [lindex $dwarf_regnum 1]
+ piece 1
+ } SPECIAL_expr}
+ }
+ # One piece per bitfield, using piece offsets: 32 bits of
+ # an implicit value, 9 bits of a stack value, 13 bits of
+ # r0, and 10 bits of buf.
+ DW_TAG_variable {
+ {name "t3"}
+ {type :$struct_t_label}
+ {location {
+ implicit_value 0x12 0x34 0x56 0x78 0x9a
+ bit_piece 32 4
+ const2s -280
+ stack_value
+ bit_piece 9 2
+ regx [lindex $dwarf_regnum 0]
+ bit_piece 13 14
+ addr $buf_var
+ bit_piece 10 42
+ } SPECIAL_expr}
+ }
+ }
+ }
+ }
+}
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile $asm_file] {nodebug}] } {
+ return -1
+}
+
+if ![runto_main] {
+ return -1
+}
+
+# Determine byte order.
+set endian [get_endianness]
+
+# Byte-aligned memory pieces.
+gdb_test "print/d s1" " = \\{a = 2, b = 3, c = 0, d = 1\\}" \
+ "s1 == re-ordered buf"
+gdb_test_no_output "set var s1.a = 63"
+gdb_test "print/d s1" " = \\{a = 63, b = 3, c = 0, d = 1\\}" \
+ "verify s1.a"
+gdb_test "print/d a" " = \\{0, 1, 63, 3, 4, 5, 6, 7\\}" \
+ "verify s1.a through a"
+gdb_test_no_output "set var s1.b = 42"
+gdb_test "print/d s1" " = \\{a = 63, b = 42, c = 0, d = 1\\}" \
+ "verify s1.b"
+gdb_test "print/d a" " = \\{0, 1, 63, 42, 4, 5, 6, 7\\}" \
+ "verify s1.b through a"
+
+# Byte-aligned register- and memory pieces.
+gdb_test_no_output "set var \$[lindex $regname 0] = 81" \
+ "init reg for s2.a"
+gdb_test_no_output "set var \$[lindex $regname 1] = 28" \
+ "init reg for s2.c"
+gdb_test "print/d s2" " = \\{a = 81, b = 4, c = 28, d = 5\\}" \
+ "initialized s2 from mem and regs"
+gdb_test_no_output "set var s2.c += s2.a + s2.b - s2.d"
+gdb_test "print/d s2" " = \\{a = 81, b = 4, c = 108, d = 5\\}" \
+ "verify s2.c"
+gdb_test "print/d \$[lindex $regname 1]" " = 108" \
+ "verify s2.c through reg"
+gdb_test_no_output "set var s2 = {191, 73, 231, 123}" \
+ "re-initialize s2"
+gdb_test "print/d s2" " = \\{a = 191, b = 73, c = 231, d = 123\\}" \
+ "verify re-initialized s2"
+
+# Unaligned bitfield access through byte-aligned pieces.
+gdb_test_no_output "set var a = { 0 }"
+gdb_test_no_output "set var st1.t.x = -7"
+gdb_test_no_output "set var st1.t.z = 340"
+gdb_test_no_output "set var st1.t.y = 1234"
+gdb_test "print st1.t" " = \\{u = <optimized out>, x = -7, y = 1234, z = 340\\}" \
+ "verify st1.t"
+switch $endian {
+ little {set val "0x55, 0x0, 0xf9, 0xa5, 0x9"}
+ big {set val "0x54, 0x0, 0xfc, 0x93, 0x49"}
+}
+# | -- | z:2-9 | -- | x:0-7 | x:8 y:0-6 | y:7-12 z:0-1 | -- | -- |
+# \_______________________________________________/
+# val
+gdb_test "print/x a" " = \\{0x0, ${val}, 0x0, 0x0\\}" \
+ "verify st1 through a"
+
+switch $endian { big {set val 0x7ffc} little {set val 0x3ffe00} }
+gdb_test_no_output "set var \$[lindex $regname 0] = $val" \
+ "init t2, first piece"
+gdb_test_no_output "set var \$[lindex $regname 1] = 0" \
+ "init t2, second piece"
+gdb_test "print/d t2" " = \\{u = <optimized out>, x = 0, y = -1, z = 0\\}" \
+ "initialized t2 from regs"
+gdb_test_no_output "set var t2.y = 2641"
+gdb_test_no_output "set var t2.z = -400"
+gdb_test_no_output "set var t2.x = 200"
+gdb_test "print t2.x + t2.y + t2.z" " = 2441"
+
+# Bitfield access through pieces with nonzero piece offsets.
+gdb_test_no_output "set var \$[lindex $regname 0] = 0xa8000" \
+ "init reg for t3.y"
+gdb_test_no_output "set var *(char \[2\] *) (a + 5) = { 70, 82 }" \
+ "init mem for t3.z"
+switch $endian {
+ little {set val "u = -1484430527, x = -70, y = 42, z = 145"}
+ big {set val "u = 591751049, x = -70, y = 42, z = 101"}
+}
+gdb_test "print t3" " = \\{$val\\}" \
+ "initialized t3 from reg and mem"
+gdb_test_no_output "set var t3.y = -1" \
+ "overwrite t3.y"
+gdb_test "print/x \$[lindex $regname 0]" " = 0x7ffc000" \
+ "verify t3.y through reg"
+gdb_test_no_output "set var t3.z = -614" \
+ "overwrite t3.z"
+switch $endian {big {set val "0x59, 0xa2"} little {set val "0x6a, 0x56"}}
+gdb_test "print/x *(char \[2\] *) (a + 5)" " = \\{$val\\}" \
+ "verify t3.z through mem"
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index adb5df3..c2ea2c2 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -30,15 +30,9 @@ clean_restart ${testfile}
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
-gdb_test_multiple "show endian" "getting target endian" {
- -re ".*little endian.*$gdb_prompt $" {
- set python_pack_char "<"
- # pass silently
- }
- -re ".*big endian.*$gdb_prompt $" {
- set python_pack_char ">"
- # pass silently
- }
+switch [get_endianness] {
+ little { set python_pack_char "<" }
+ big { set python_pack_char ">" }
}
# The following tests require execution.
diff --git a/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp b/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
index 1d9cd19..6f36476 100644
--- a/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
@@ -200,7 +200,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "orpd.*" "reverse-step to orpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse orps"
gdb_test "info register xmm1" \
@@ -214,7 +214,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "mulss.*" "reverse-step to mulss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse orpd"
gdb_test "info register xmm1" \
@@ -228,7 +228,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "mulsd.*" "reverse-step to mulsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse mulss"
gdb_test "info register xmm1" \
@@ -242,7 +242,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "mulps.*" "reverse-step to mulps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse mulsd"
gdb_test "info register xmm1" \
@@ -256,7 +256,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "mulpd.*" "reverse-step to mulpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse mulps"
gdb_test "info register xmm1" \
@@ -270,7 +270,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "divss.*" "reverse-step to divss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0000000000000000fff80000ffc00000.*" \
+ "xmm0 .*uint128 = 0xfff80000ffc00000.*" \
"verify xmm0 after reverse mulpd"
gdb_test "info register xmm1" \
@@ -284,7 +284,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "divsd.*" "reverse-step to divsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \
+ "xmm0 .*uint128 = 0x8000000080000000.*" \
"verify xmm0 after reverse divss"
gdb_test "info register xmm1" \
@@ -298,11 +298,11 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "divps.*" "reverse-step to divps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \
+ "xmm0 .*uint128 = 0x8000000080000000.*" \
"verify xmm0 after reverse divsd"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x00000000000000000000000080000000.*" \
+ "xmm1 .*uint128 = 0x80000000.*" \
"verify xmm1 after reverse divsd"
gdb_test "info register xmm2" \
@@ -312,11 +312,11 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "divpd.*" "reverse-step to divpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \
+ "xmm0 .*uint128 = 0x8000000080000000.*" \
"verify xmm0 after reverse divps"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x00000000000000000000000080000000.*" \
+ "xmm1 .*uint128 = 0x80000000.*" \
"verify xmm1 after reverse divps"
gdb_test "info register xmm2" \
@@ -326,7 +326,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "cvtpd2ps.*" "reverse-step to cvtpd2ps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x00000000000000008000000080000000.*" \
+ "xmm0 .*uint128 = 0x8000000080000000.*" \
"verify xmm0 after reverse divpd"
gdb_test "info register xmm1" \
@@ -340,7 +340,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "cvtpd2dq.*" "reverse-step to cvtpd2dq"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse cvtpd2ps"
gdb_test "info register xmm1" \
@@ -354,11 +354,11 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "cvtdq2ps.*" "reverse-step to cvtdq2ps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse cvtpd2dq"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse cvtpd2dq"
gdb_test "info register xmm2" \
@@ -368,11 +368,11 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "cvtdq2pd.*" "reverse-step to cvtdq2pd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse cvtdq2ps"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse cvtdq2ps"
gdb_test "info register xmm2" \
@@ -382,11 +382,11 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "comiss.*" "reverse-step to comiss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse cvtdq2pd"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse cvtdq2pd"
gdb_test "info register xmm2" \
@@ -396,11 +396,11 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "comisd.*" "reverse-step to comisd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a090807060504ffffffff.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a090807060504ffffffff.*" \
"verify xmm0 after reverse comiss"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse comiss"
gdb_test "info register xmm2" \
@@ -410,11 +410,11 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "cmpss.*" "reverse-step to cmpss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse comisd"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0000000000000000ffffffffffffffff.*" \
+ "xmm1 .*uint128 = 0xffffffffffffffff.*" \
"verify xmm1 after reverse comisd"
gdb_test "info register xmm2" \
@@ -424,11 +424,11 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "cmpsd.*" "reverse-step to cmpsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse cmpss"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x00000000000000000000000000000000.*" \
+ "xmm1 .*uint128 = 0x.*" \
"verify xmm1 after reverse cmpss"
gdb_test "info register xmm2" \
@@ -438,35 +438,35 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "cmpps.*" "reverse-step to cmpps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse cmpsd"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x00000000000000000000000000000000.*" \
+ "xmm1 .*uint128 = 0x.*" \
"verify xmm1 after reverse cmpsd"
gdb_test "info register xmm2" \
- "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \
+ "xmm2 .*uint128 = 0xf0e0d0c0b0a09082726252400000000.*" \
"verify xmm2 after reverse cmpsd"
gdb_test "reverse-step" "cmppd.*" "reverse-step to cmppd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse cmpps"
gdb_test "info register xmm1" \
- "xmm1 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \
+ "xmm1 .*uint128 = 0xf0e0d0c0b0a09082726252400000000.*" \
"verify xmm1 after reverse cmpps"
gdb_test "info register xmm2" \
- "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \
+ "xmm2 .*uint128 = 0xf0e0d0c0b0a09082726252400000000.*" \
"verify xmm2 after reverse cmpps"
gdb_test "reverse-step" "andps.*" "reverse-step to andps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse cmppd"
gdb_test "info register xmm1" \
@@ -474,13 +474,13 @@ gdb_test "info register xmm1" \
"verify xmm1 after reverse cmppd"
gdb_test "info register xmm2" \
- "xmm2 .*uint128 = 0x0f0e0d0c0b0a09082726252400000000.*" \
+ "xmm2 .*uint128 = 0xf0e0d0c0b0a09082726252400000000.*" \
"verify xmm2 after reverse cmppd"
gdb_test "reverse-step" "andpd.*" "reverse-step to andpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse andps"
gdb_test "info register xmm1" \
@@ -494,7 +494,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "addsubps.*" "reverse-step to addsubps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse andpd"
gdb_test "info register xmm1" \
@@ -508,7 +508,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "addsubpd.*" "reverse-step to addsubpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050423222120.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050423222120.*" \
"verify xmm0 after reverse addsubps"
gdb_test "info register xmm1" \
@@ -522,7 +522,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "addss.*" "reverse-step to addss"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse addsubpd"
gdb_test "info register xmm1" \
@@ -536,7 +536,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "addsd.*" "reverse-step to addsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse addss"
gdb_test "info register xmm1" \
@@ -550,7 +550,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "addps.*" "reverse-step to addps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse addsd"
gdb_test "info register xmm1" \
@@ -564,7 +564,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "addpd.*" "reverse-step to addpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse addps"
gdb_test "info register xmm1" \
@@ -612,7 +612,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "pabsd.*" "reverse-step to pabsd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse pabsd"
gdb_test "info register xmm1" \
@@ -626,7 +626,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "pabsw.*" "reverse-step to pabsw"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse pabsw"
gdb_test "info register xmm1" \
@@ -640,7 +640,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "pabsb.*" "reverse-step to pabsb"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse pabsb"
gdb_test "info register xmm1" \
@@ -676,7 +676,7 @@ gdb_test_multiple "continue" $test {
gdb_test "reverse-step" "blendvps.*" "reverse-step to blendvps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09082726252413121110.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09082726252413121110.*" \
"verify xmm0 at end of sse4_test"
gdb_test "info register xmm1" \
@@ -690,7 +690,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "blendvpd.*" "reverse-step to blendvpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09082726252413121110.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09082726252413121110.*" \
"verify xmm0 after reverse blendvps"
gdb_test "info register xmm1" \
@@ -704,7 +704,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "blendps.*" "reverse-step to blendps"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09081716151413121110.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09081716151413121110.*" \
"verify xmm0 after reverse blendvpd"
gdb_test "info register xmm1" \
@@ -718,7 +718,7 @@ gdb_test "info register xmm2" \
gdb_test "reverse-step" "blendpd.*" "reverse-step to blendpd"
gdb_test "info register xmm0" \
- "xmm0 .*uint128 = 0x0f0e0d0c0b0a09080706050403020100.*" \
+ "xmm0 .*uint128 = 0xf0e0d0c0b0a09080706050403020100.*" \
"verify xmm0 after reverse blendps"
gdb_test "info register xmm1" \
diff --git a/gdb/testsuite/gdb.server/non-existing-program.exp b/gdb/testsuite/gdb.server/non-existing-program.exp
index d404564..68d4d53 100644
--- a/gdb/testsuite/gdb.server/non-existing-program.exp
+++ b/gdb/testsuite/gdb.server/non-existing-program.exp
@@ -39,8 +39,16 @@ set spawn_id [remote_spawn target "$gdbserver stdio non-existing-program"]
set msg "gdbserver exits cleanly"
set saw_exiting 0
expect {
- # This is what we get on ptrace-based targets.
- -re "stdin/stdout redirected.*No program to debug\r\nExiting\r\n$" {
+ # This is what we get on ptrace-based targets with
+ # startup-with-shell disabled (e.g., when the SHELL variable is
+ # unset).
+ -re "stdin/stdout redirected.*gdbserver: Cannot exec non-existing-program\r\ngdbserver: Error: No such file or directory\r\n\r\nDuring startup program exited with code 127\.\r\nExiting\r\n$" {
+ set saw_exiting 1
+ exp_continue
+ }
+ # Likewise, but with startup-with-shell enabled, which is the
+ # default behaviour.
+ -re "stdin/stdout redirected.*exec: non-existing-program: not found\r\nDuring startup program exited with code 127\.\r\nExiting\r\n$" {
set saw_exiting 1
exp_continue
}
diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
index 3b14bea..d8a75d4 100644
--- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
+++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp
@@ -325,13 +325,7 @@ with_test_prefix "tracing bar" {
gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
gdb_test_no_output "tstop"
- set endian ""
- gdb_test_multiple "show endian" "show endian" {
- -re ".* (big|little) endian.*$gdb_prompt $" {
- set endian $expect_out(1,string)
- pass "endianness: $endian"
- }
- }
+ set endian [get_endianness]
gdb_test "tfind 0" "Found trace frame 0, tracepoint .*"
if { $endian == "little" } {
diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index ff1b24a..37abb14 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -34,6 +34,6 @@ proc gdb_init_commands {} {
proc string_to_regexp {str} {
set result $str
- regsub -all {[]*+.|()^$\[\\]} $str {\\&} result
+ regsub -all {[]*+.|(){}^$\[\\]} $str {\\&} result
return $result
}
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 6633d24..3d3eaab 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1000,7 +1000,7 @@ proc gdb_test { args } {
}
return [gdb_test_multiple $command $message {
- -re "\[\r\n\]*($pattern)\[\r\n\]+$gdb_prompt $" {
+ -re "\[\r\n\]*(?:$pattern)\[\r\n\]+$gdb_prompt $" {
if ![string match "" $message] then {
pass "$message"
}
@@ -5671,6 +5671,19 @@ proc set_remotetimeout { timeout } {
}
}
+# Get the target's current endianness and return it.
+proc get_endianness { } {
+ global gdb_prompt
+
+ gdb_test_multiple "show endian" "determine endianness" {
+ -re ".* (little|big) endian.*\r\n$gdb_prompt $" {
+ # Pass silently.
+ return $expect_out(1,string)
+ }
+ }
+ return "little"
+}
+
# ROOT and FULL are file names. Returns the relative path from ROOT
# to FULL. Note that FULL must be in a subdirectory of ROOT.
# For example, given ROOT = /usr/bin and FULL = /usr/bin/ls, this
diff --git a/gdb/top.c b/gdb/top.c
index 3de8a26..17261cc 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -35,6 +35,7 @@
#include "value.h"
#include "language.h"
#include "terminal.h" /* For job_control. */
+#include "job-control.h"
#include "annotate.h"
#include "completer.h"
#include "top.h"
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 255bbc9..d479cef 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -650,8 +650,8 @@ tfile_get_traceframe_address (off_t tframe_offset)
tp = get_tracepoint_by_number_on_target (tpnum);
/* FIXME this is a poor heuristic if multiple locations. */
- if (tp && tp->base.loc)
- addr = tp->base.loc->address;
+ if (tp && tp->loc)
+ addr = tp->loc->address;
/* Restore our seek position. */
cur_offset = saved_offset;
diff --git a/gdb/tracefile.c b/gdb/tracefile.c
index cc90945..e208fc6 100644
--- a/gdb/tracefile.c
+++ b/gdb/tracefile.c
@@ -398,15 +398,15 @@ tracefile_fetch_registers (struct regcache *regcache, int regno)
/* We can often usefully guess that the PC is going to be the same
as the address of the tracepoint. */
- if (tp == NULL || tp->base.loc == NULL)
+ if (tp == NULL || tp->loc == NULL)
return;
/* But don't try to guess if tracepoint is multi-location... */
- if (tp->base.loc->next)
+ if (tp->loc->next)
{
warning (_("Tracepoint %d has multiple "
"locations, cannot infer $pc"),
- tp->base.number);
+ tp->number);
return;
}
/* ... or does while-stepping. */
@@ -414,13 +414,13 @@ tracefile_fetch_registers (struct regcache *regcache, int regno)
{
warning (_("Tracepoint %d does while-stepping, "
"cannot infer $pc"),
- tp->base.number);
+ tp->number);
return;
}
/* Guess what we can from the tracepoint location. */
gdbarch_guess_tracepoint_registers (gdbarch, regcache,
- tp->base.loc->address);
+ tp->loc->address);
}
/* This is the implementation of target_ops method to_has_all_memory. */
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 98213cf..4f2bac5 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -648,11 +648,11 @@ actions_command (char *args, int from_tty)
{
std::string tmpbuf =
string_printf ("Enter actions for tracepoint %d, one per line.",
- t->base.number);
+ t->number);
command_line_up l = read_command_lines (&tmpbuf[0], from_tty, 1,
check_tracepoint_command, t);
- breakpoint_set_commands (&t->base, std::move (l));
+ breakpoint_set_commands (t, std::move (l));
}
/* else just return */
}
@@ -738,7 +738,7 @@ validate_actionline (const char *line, struct breakpoint *b)
/* else fall thru, treat p as an expression and parse it! */
}
tmp_p = p;
- for (loc = t->base.loc; loc; loc = loc->next)
+ for (loc = t->loc; loc; loc = loc->next)
{
p = tmp_p;
expression_up exp = parse_exp_1 (&p, loc->address,
@@ -788,7 +788,7 @@ validate_actionline (const char *line, struct breakpoint *b)
p = skip_spaces_const (p);
tmp_p = p;
- for (loc = t->base.loc; loc; loc = loc->next)
+ for (loc = t->loc; loc; loc = loc->next)
{
p = tmp_p;
@@ -2246,7 +2246,7 @@ tfind_1 (enum trace_find_type type, int num,
reinit_frame_cache ();
target_dcache_invalidate ();
- set_tracepoint_num (tp ? tp->base.number : target_tracept);
+ set_tracepoint_num (tp ? tp->number : target_tracept);
if (target_frameno != get_traceframe_number ())
observer_notify_traceframe_changed (target_frameno, tracepoint_number);
@@ -2870,7 +2870,7 @@ get_traceframe_location (int *stepping_frame_p)
locations, assume it is a direct hit rather than a while-stepping
frame. (FIXME this is not reliable, should record each frame's
type.) */
- for (tloc = t->base.loc; tloc; tloc = tloc->next)
+ for (tloc = t->loc; tloc; tloc = tloc->next)
if (tloc->address == regcache_read_pc (regcache))
{
*stepping_frame_p = 0;
@@ -2880,7 +2880,7 @@ get_traceframe_location (int *stepping_frame_p)
/* If this is a stepping frame, we don't know which location
triggered. The first is as good (or bad) a guess as any... */
*stepping_frame_p = 1;
- return t->base.loc;
+ return t->loc;
}
/* Return all the actions, including default collect, of a tracepoint
@@ -3231,7 +3231,7 @@ find_matching_tracepoint_location (struct uploaded_tp *utp)
if (b->type == utp->type
&& t->step_count == utp->step
&& t->pass_count == utp->pass
- && cond_string_is_same (t->base.cond_string, utp->cond_string)
+ && cond_string_is_same (t->cond_string, utp->cond_string)
/* FIXME also test actions. */
)
{
@@ -3300,7 +3300,7 @@ merge_uploaded_tracepoints (struct uploaded_tp **uploaded_tps)
if (t)
printf_filtered (_("Created tracepoint %d for "
"target's tracepoint %d at %s.\n"),
- t->base.number, utp->number,
+ t->number, utp->number,
paddress (get_current_arch (), utp->addr));
else
printf_filtered (_("Failed to create tracepoint for target's "
@@ -3603,7 +3603,7 @@ parse_tracepoint_status (char *p, struct breakpoint *bp,
p = unpack_varlen_hex (p, &uval);
if (tp)
- tp->base.hit_count += uval;
+ tp->hit_count += uval;
else
utp->hit_count += uval;
p = unpack_varlen_hex (p + 1, &uval);
diff --git a/gdb/unittests/environ-selftests.c b/gdb/unittests/environ-selftests.c
new file mode 100644
index 0000000..28b16f8
--- /dev/null
+++ b/gdb/unittests/environ-selftests.c
@@ -0,0 +1,159 @@
+/* Self tests for gdb_environ for GDB, the GNU debugger.
+
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include "defs.h"
+#include "selftest.h"
+#include "common/environ.h"
+#include "common/diagnostics.h"
+
+namespace selftests {
+namespace gdb_environ_tests {
+
+static void
+run_tests ()
+{
+ /* Set a test environment variable. This will be unset at the end
+ of this function. */
+ if (setenv ("GDB_SELFTEST_ENVIRON", "1", 1) != 0)
+ error (_("Could not set environment variable for testing."));
+
+ gdb_environ env;
+
+ /* When the vector is initialized, there should always be one NULL
+ element in it. */
+ SELF_CHECK (env.envp ()[0] == NULL);
+
+ /* Make sure that there is no other element. */
+ SELF_CHECK (env.get ("PWD") == NULL);
+
+ /* Check if unset followed by a set in an empty vector works. */
+ env.set ("PWD", "test");
+ SELF_CHECK (strcmp (env.get ("PWD"), "test") == 0);
+ /* The second element must be NULL. */
+ SELF_CHECK (env.envp ()[1] == NULL);
+ env.unset ("PWD");
+ SELF_CHECK (env.envp ()[0] == NULL);
+
+ /* Initialize the environment vector using the host's environ. */
+ env = gdb_environ::from_host_environ ();
+
+ /* Our test environment variable should be present at the
+ vector. */
+ SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON"), "1") == 0);
+
+ /* Set our test variable to another value. */
+ env.set ("GDB_SELFTEST_ENVIRON", "test");
+ SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON"), "test") == 0);
+
+ /* And unset our test variable. The variable still exists in the
+ host's environment, but doesn't exist in our vector. */
+ env.unset ("GDB_SELFTEST_ENVIRON");
+ SELF_CHECK (env.get ("GDB_SELFTEST_ENVIRON") == NULL);
+
+ /* Re-set the test variable. */
+ env.set ("GDB_SELFTEST_ENVIRON", "1");
+ SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON"), "1") == 0);
+
+ /* When we clear our environ vector, there should be only one
+ element on it (NULL), and we shouldn't be able to get our test
+ variable. */
+ env.clear ();
+ SELF_CHECK (env.envp ()[0] == NULL);
+ SELF_CHECK (env.get ("GDB_SELFTEST_ENVIRON") == NULL);
+
+ /* Reinitialize our environ vector using the host environ. We
+ should be able to see one (and only one) instance of the test
+ variable. */
+ env = gdb_environ::from_host_environ ();
+ char **envp = env.envp ();
+ int num_found = 0;
+
+ for (size_t i = 0; envp[i] != NULL; ++i)
+ if (strcmp (envp[i], "GDB_SELFTEST_ENVIRON=1") == 0)
+ ++num_found;
+ SELF_CHECK (num_found == 1);
+
+ /* Get rid of our test variable. */
+ unsetenv ("GDB_SELFTEST_ENVIRON");
+
+ /* Test the case when we set a variable A, then set a variable B,
+ then unset A, and make sure that we cannot find A in the environ
+ vector, but can still find B. */
+ env.set ("GDB_SELFTEST_ENVIRON_1", "aaa");
+ SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_1"), "aaa") == 0);
+
+ env.set ("GDB_SELFTEST_ENVIRON_2", "bbb");
+ SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb") == 0);
+
+ env.unset ("GDB_SELFTEST_ENVIRON_1");
+ SELF_CHECK (env.get ("GDB_SELFTEST_ENVIRON_1") == NULL);
+ SELF_CHECK (strcmp (env.get ("GDB_SELFTEST_ENVIRON_2"), "bbb") == 0);
+
+ env.clear ();
+
+ /* Test that after a std::move the moved-from object is left at a
+ valid state (i.e., its only element is NULL). */
+ env.set ("A", "1");
+ SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+ gdb_environ env2;
+ env2 = std::move (env);
+ SELF_CHECK (env.envp ()[0] == NULL);
+ SELF_CHECK (strcmp (env2.get ("A"), "1") == 0);
+ SELF_CHECK (env2.envp ()[1] == NULL);
+ env.set ("B", "2");
+ SELF_CHECK (strcmp (env.get ("B"), "2") == 0);
+ SELF_CHECK (env.envp ()[1] == NULL);
+
+ /* Test that the move constructor leaves everything at a valid
+ state. */
+ env.clear ();
+ env.set ("A", "1");
+ SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+ gdb_environ env3 = std::move (env);
+ SELF_CHECK (env.envp ()[0] == NULL);
+ SELF_CHECK (strcmp (env3.get ("A"), "1") == 0);
+ SELF_CHECK (env3.envp ()[1] == NULL);
+ env.set ("B", "2");
+ SELF_CHECK (strcmp (env.get ("B"), "2") == 0);
+ SELF_CHECK (env.envp ()[1] == NULL);
+
+ /* Test self-move. */
+ env.clear ();
+ env.set ("A", "1");
+ SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+
+ /* Some compilers warn about moving to self, but that's precisely what we want
+ to test here, so turn this warning off. */
+ DIAGNOSTIC_PUSH
+ DIAGNOSTIC_IGNORE_SELF_MOVE
+ env = std::move (env);
+ DIAGNOSTIC_POP
+
+ SELF_CHECK (strcmp (env.get ("A"), "1") == 0);
+ SELF_CHECK (strcmp (env.envp ()[0], "A=1") == 0);
+ SELF_CHECK (env.envp ()[1] == NULL);
+}
+} /* namespace gdb_environ */
+} /* namespace selftests */
+
+void
+_initialize_environ_selftests ()
+{
+ register_self_test (selftests::gdb_environ_tests::run_tests);
+}
diff --git a/gdb/utils.c b/gdb/utils.c
index e3bb601..c110ef4 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -65,6 +65,7 @@
#include "gdb_usleep.h"
#include "interps.h"
#include "gdb_regex.h"
+#include "job-control.h"
#if !HAVE_DECL_MALLOC
extern PTR malloc (); /* ARI: PTR */
@@ -102,10 +103,6 @@ static std::chrono::steady_clock::duration prompt_for_continue_wait_time;
static int debug_timestamp = 0;
-/* Nonzero if we have job control. */
-
-int job_control;
-
/* Nonzero means that strings with character values >0x7F should be printed
as octal escapes. Zero means just print the value (e.g. it's an
international character, and the terminal or window can cope.) */
@@ -1038,58 +1035,6 @@ make_hex_string (const gdb_byte *data, size_t length)
-/* A cleanup function that calls regfree. */
-
-static void
-do_regfree_cleanup (void *r)
-{
- regfree ((regex_t *) r);
-}
-
-/* Create a new cleanup that frees the compiled regular expression R. */
-
-struct cleanup *
-make_regfree_cleanup (regex_t *r)
-{
- return make_cleanup (do_regfree_cleanup, r);
-}
-
-/* Return an xmalloc'd error message resulting from a regular
- expression compilation failure. */
-
-char *
-get_regcomp_error (int code, regex_t *rx)
-{
- size_t length = regerror (code, rx, NULL, 0);
- char *result = (char *) xmalloc (length);
-
- regerror (code, rx, result, length);
- return result;
-}
-
-/* Compile a regexp and throw an exception on error. This returns a
- cleanup to free the resulting pattern on success. RX must not be
- NULL. */
-
-struct cleanup *
-compile_rx_or_error (regex_t *pattern, const char *rx, const char *message)
-{
- int code;
-
- gdb_assert (rx != NULL);
-
- code = regcomp (pattern, rx, REG_NOSUB);
- if (code != 0)
- {
- char *err = get_regcomp_error (code, pattern);
-
- make_cleanup (xfree, err);
- error (("%s: %s"), message, err);
- }
-
- return make_regfree_cleanup (pattern);
-}
-
/* A cleanup that simply calls ui_unregister_input_event_handler. */
static void
diff --git a/gdb/valops.c b/gdb/valops.c
index cb9d38d..708b86c 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -958,7 +958,7 @@ value_at_lazy (struct type *type, CORE_ADDR addr)
}
void
-read_value_memory (struct value *val, LONGEST embedded_offset,
+read_value_memory (struct value *val, LONGEST bit_offset,
int stack, CORE_ADDR memaddr,
gdb_byte *buffer, size_t length)
{
@@ -984,8 +984,9 @@ read_value_memory (struct value *val, LONGEST embedded_offset,
if (status == TARGET_XFER_OK)
/* nothing */;
else if (status == TARGET_XFER_UNAVAILABLE)
- mark_value_bytes_unavailable (val, embedded_offset + xfered_total,
- xfered_partial);
+ mark_value_bits_unavailable (val, (xfered_total * HOST_CHAR_BIT
+ + bit_offset),
+ xfered_partial * HOST_CHAR_BIT);
else if (status == TARGET_XFER_EOF)
memory_error (TARGET_XFER_E_IO, memaddr + xfered_total);
else
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 6937dab..c10dade 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -37,6 +37,7 @@
#include "typeprint.h"
#include <ctype.h>
#include <algorithm>
+#include "common/byte-vector.h"
/* Maximum number of wchars returned from wchar_iterate. */
#define MAX_WCHARS 4
@@ -781,25 +782,12 @@ generic_val_print_int (struct type *type,
struct value *original_value,
const struct value_print_options *options)
{
- struct gdbarch *gdbarch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
-
- if (options->format || options->output_format)
- {
- struct value_print_options opts = *options;
+ struct value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
- val_print_scalar_formatted (type, embedded_offset,
- original_value, &opts, 0, stream);
- }
- else
- {
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
-
- val_print_type_code_int (type, valaddr + embedded_offset * unit_size,
- stream);
- }
+ opts.format = (options->format ? options->format
+ : options->output_format);
+ val_print_scalar_formatted (type, embedded_offset,
+ original_value, &opts, 0, stream);
}
/* generic_val_print helper for TYPE_CODE_CHAR. */
@@ -1237,43 +1225,6 @@ value_print (struct value *val, struct ui_file *stream,
LA_VALUE_PRINT (val, stream, options);
}
-/* Called by various <lang>_val_print routines to print
- TYPE_CODE_INT's. TYPE is the type. VALADDR is the address of the
- value. STREAM is where to print the value. */
-
-void
-val_print_type_code_int (struct type *type, const gdb_byte *valaddr,
- struct ui_file *stream)
-{
- enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
-
- if (TYPE_LENGTH (type) > sizeof (LONGEST))
- {
- LONGEST val;
-
- if (TYPE_UNSIGNED (type)
- && extract_long_unsigned_integer (valaddr, TYPE_LENGTH (type),
- byte_order, &val))
- {
- print_longest (stream, 'u', 0, val);
- }
- else
- {
- /* Signed, or we couldn't turn an unsigned value into a
- LONGEST. For signed values, one could assume two's
- complement (a reasonable assumption, I think) and do
- better than this. */
- print_hex_chars (stream, (unsigned char *) valaddr,
- TYPE_LENGTH (type), byte_order);
- }
- }
- else
- {
- print_longest (stream, TYPE_UNSIGNED (type) ? 'u' : 'd', 0,
- unpack_long (type, valaddr));
- }
-}
-
static void
val_print_type_code_flags (struct type *type, const gdb_byte *valaddr,
struct ui_file *stream)
@@ -1537,7 +1488,7 @@ print_decimal_floating (const gdb_byte *valaddr, struct type *type,
void
print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
- unsigned len, enum bfd_endian byte_order)
+ unsigned len, enum bfd_endian byte_order, bool zero_pad)
{
#define BITS_IN_BYTES 8
@@ -1545,14 +1496,13 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
const gdb_byte *p;
unsigned int i;
int b;
+ bool seen_a_one = false;
/* Declared "int" so it will be signed.
This ensures that right shift will shift in zeros. */
const int mask = 0x080;
- /* FIXME: We should be not printing leading zeroes in most cases. */
-
if (byte_order == BFD_ENDIAN_BIG)
{
for (p = valaddr;
@@ -1565,11 +1515,14 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
{
if (*p & (mask >> i))
- b = 1;
+ b = '1';
else
- b = 0;
+ b = '0';
- fprintf_filtered (stream, "%1d", b);
+ if (zero_pad || seen_a_one || b == '1')
+ fputc_filtered (b, stream);
+ if (b == '1')
+ seen_a_one = true;
}
}
}
@@ -1582,14 +1535,34 @@ print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr,
for (i = 0; i < (BITS_IN_BYTES * sizeof (*p)); i++)
{
if (*p & (mask >> i))
- b = 1;
+ b = '1';
else
- b = 0;
+ b = '0';
- fprintf_filtered (stream, "%1d", b);
+ if (zero_pad || seen_a_one || b == '1')
+ fputc_filtered (b, stream);
+ if (b == '1')
+ seen_a_one = true;
}
}
}
+
+ /* When not zero-padding, ensure that something is printed when the
+ input is 0. */
+ if (!zero_pad && !seen_a_one)
+ fputc_filtered ('0', stream);
+}
+
+/* A helper for print_octal_chars that emits a single octal digit,
+ optionally suppressing it if is zero and updating SEEN_A_ONE. */
+
+static void
+emit_octal_digit (struct ui_file *stream, bool *seen_a_one, int digit)
+{
+ if (*seen_a_one || digit != 0)
+ fprintf_filtered (stream, "%o", digit);
+ if (digit != 0)
+ *seen_a_one = true;
}
/* VALADDR points to an integer of LEN bytes.
@@ -1603,9 +1576,6 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
unsigned char octa1, octa2, octa3, carry;
int cycle;
- /* FIXME: We should be not printing leading zeroes in most cases. */
-
-
/* Octal is 3 bits, which doesn't fit. Yuk. So we have to track
* the extra bits, which cycle every three bytes:
*
@@ -1640,6 +1610,7 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
carry = 0;
fputs_filtered ("0", stream);
+ bool seen_a_one = false;
if (byte_order == BFD_ENDIAN_BIG)
{
for (p = valaddr;
@@ -1654,8 +1625,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
octa1 = (HIGH_ZERO & *p) >> 5;
octa2 = (LOW_ZERO & *p) >> 2;
carry = (CARRY_ZERO & *p);
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
break;
case 1:
@@ -1665,9 +1636,9 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
octa2 = (MID_ONE & *p) >> 4;
octa3 = (LOW_ONE & *p) >> 1;
carry = (CARRY_ONE & *p);
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
- fprintf_filtered (stream, "%o", octa3);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
+ emit_octal_digit (stream, &seen_a_one, octa3);
break;
case 2:
@@ -1677,9 +1648,9 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
octa2 = (MID_TWO & *p) >> 3;
octa3 = (LOW_TWO & *p);
carry = 0;
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
- fprintf_filtered (stream, "%o", octa3);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
+ emit_octal_digit (stream, &seen_a_one, octa3);
break;
default:
@@ -1704,8 +1675,8 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
octa1 = (HIGH_ZERO & *p) >> 5;
octa2 = (LOW_ZERO & *p) >> 2;
carry = (CARRY_ZERO & *p);
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
break;
case 1:
@@ -1715,9 +1686,9 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
octa2 = (MID_ONE & *p) >> 4;
octa3 = (LOW_ONE & *p) >> 1;
carry = (CARRY_ONE & *p);
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
- fprintf_filtered (stream, "%o", octa3);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
+ emit_octal_digit (stream, &seen_a_one, octa3);
break;
case 2:
@@ -1727,9 +1698,9 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
octa2 = (MID_TWO & *p) >> 3;
octa3 = (LOW_TWO & *p);
carry = 0;
- fprintf_filtered (stream, "%o", octa1);
- fprintf_filtered (stream, "%o", octa2);
- fprintf_filtered (stream, "%o", octa3);
+ emit_octal_digit (stream, &seen_a_one, octa1);
+ emit_octal_digit (stream, &seen_a_one, octa2);
+ emit_octal_digit (stream, &seen_a_one, octa3);
break;
default:
@@ -1743,12 +1714,58 @@ print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr,
}
+/* Possibly negate the integer represented by BYTES. It contains LEN
+ bytes in the specified byte order. If the integer is negative,
+ copy it into OUT_VEC, negate it, and return true. Otherwise, do
+ nothing and return false. */
+
+static bool
+maybe_negate_by_bytes (const gdb_byte *bytes, unsigned len,
+ enum bfd_endian byte_order,
+ gdb::byte_vector *out_vec)
+{
+ gdb_byte sign_byte;
+ if (byte_order == BFD_ENDIAN_BIG)
+ sign_byte = bytes[0];
+ else
+ sign_byte = bytes[len - 1];
+ if ((sign_byte & 0x80) == 0)
+ return false;
+
+ out_vec->resize (len);
+
+ /* Compute -x == 1 + ~x. */
+ if (byte_order == BFD_ENDIAN_LITTLE)
+ {
+ unsigned carry = 1;
+ for (unsigned i = 0; i < len; ++i)
+ {
+ unsigned tem = (0xff & ~bytes[i]) + carry;
+ (*out_vec)[i] = tem & 0xff;
+ carry = tem / 256;
+ }
+ }
+ else
+ {
+ unsigned carry = 1;
+ for (unsigned i = len; i > 0; --i)
+ {
+ unsigned tem = (0xff & ~bytes[i - 1]) + carry;
+ (*out_vec)[i - 1] = tem & 0xff;
+ carry = tem / 256;
+ }
+ }
+
+ return true;
+}
+
/* VALADDR points to an integer of LEN bytes.
Print it in decimal on stream or format it in buf. */
void
print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
- unsigned len, enum bfd_endian byte_order)
+ unsigned len, bool is_signed,
+ enum bfd_endian byte_order)
{
#define TEN 10
#define CARRY_OUT( x ) ((x) / TEN) /* extend char to int */
@@ -1758,23 +1775,25 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
#define HIGH_NIBBLE( x ) (((x) & 0x0F0) >> 4)
const gdb_byte *p;
- unsigned char *digits;
int carry;
int decimal_len;
int i, j, decimal_digits;
int dummy;
int flip;
+ gdb::byte_vector negated_bytes;
+ if (is_signed
+ && maybe_negate_by_bytes (valaddr, len, byte_order, &negated_bytes))
+ {
+ fputs_filtered ("-", stream);
+ valaddr = negated_bytes.data ();
+ }
+
/* Base-ten number is less than twice as many digits
as the base 16 number, which is 2 digits per byte. */
decimal_len = len * 2 * 2;
- digits = (unsigned char *) xmalloc (decimal_len);
-
- for (i = 0; i < decimal_len; i++)
- {
- digits[i] = 0;
- }
+ std::vector<unsigned char> digits (decimal_len, 0);
/* Ok, we have an unknown number of bytes of data to be printed in
* decimal.
@@ -1868,40 +1887,73 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr,
/* Ok, now "digits" is the decimal representation, with
the "decimal_digits" actual digits. Print! */
- for (i = decimal_digits - 1; i >= 0; i--)
+ for (i = decimal_digits - 1; i > 0 && digits[i] == 0; --i)
+ ;
+
+ for (; i >= 0; i--)
{
fprintf_filtered (stream, "%1d", digits[i]);
}
- xfree (digits);
}
/* VALADDR points to an integer of LEN bytes. Print it in hex on stream. */
void
print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr,
- unsigned len, enum bfd_endian byte_order)
+ unsigned len, enum bfd_endian byte_order,
+ bool zero_pad)
{
const gdb_byte *p;
- /* FIXME: We should be not printing leading zeroes in most cases. */
-
fputs_filtered ("0x", stream);
if (byte_order == BFD_ENDIAN_BIG)
{
- for (p = valaddr;
+ p = valaddr;
+
+ if (!zero_pad)
+ {
+ /* Strip leading 0 bytes, but be sure to leave at least a
+ single byte at the end. */
+ for (; p < valaddr + len - 1 && !*p; ++p)
+ ;
+ }
+
+ const gdb_byte *first = p;
+ for (;
p < valaddr + len;
p++)
{
- fprintf_filtered (stream, "%02x", *p);
+ /* When not zero-padding, use a different format for the
+ very first byte printed. */
+ if (!zero_pad && p == first)
+ fprintf_filtered (stream, "%x", *p);
+ else
+ fprintf_filtered (stream, "%02x", *p);
}
}
else
{
- for (p = valaddr + len - 1;
+ p = valaddr + len - 1;
+
+ if (!zero_pad)
+ {
+ /* Strip leading 0 bytes, but be sure to leave at least a
+ single byte at the end. */
+ for (; p >= valaddr + 1 && !*p; --p)
+ ;
+ }
+
+ const gdb_byte *first = p;
+ for (;
p >= valaddr;
p--)
{
- fprintf_filtered (stream, "%02x", *p);
+ /* When not zero-padding, use a different format for the
+ very first byte printed. */
+ if (!zero_pad && p == first)
+ fprintf_filtered (stream, "%x", *p);
+ else
+ fprintf_filtered (stream, "%02x", *p);
}
}
}
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 835296a..302626d 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -121,9 +121,6 @@ extern void val_print_array_elements (struct type *, LONGEST,
const struct value_print_options *,
unsigned int);
-extern void val_print_type_code_int (struct type *, const gdb_byte *,
- struct ui_file *);
-
extern void val_print_scalar_formatted (struct type *,
LONGEST,
struct value *,
@@ -132,16 +129,16 @@ extern void val_print_scalar_formatted (struct type *,
struct ui_file *);
extern void print_binary_chars (struct ui_file *, const gdb_byte *,
- unsigned int, enum bfd_endian);
+ unsigned int, enum bfd_endian, bool);
extern void print_octal_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian);
extern void print_decimal_chars (struct ui_file *, const gdb_byte *,
- unsigned int, enum bfd_endian);
+ unsigned int, bool, enum bfd_endian);
extern void print_hex_chars (struct ui_file *, const gdb_byte *,
- unsigned int, enum bfd_endian);
+ unsigned int, enum bfd_endian, bool);
extern void print_char_chars (struct ui_file *, struct type *,
const gdb_byte *, unsigned int, enum bfd_endian);
diff --git a/gdb/value.h b/gdb/value.h
index 8ec6939..852ce60 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -581,12 +581,11 @@ extern int value_contents_eq (const struct value *val1, LONGEST offset1,
/* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
which is (or will be copied to) VAL's contents buffer offset by
- EMBEDDED_OFFSET (that is, to &VAL->contents[EMBEDDED_OFFSET]).
- Marks value contents ranges as unavailable if the corresponding
- memory is likewise unavailable. STACK indicates whether the memory
- is known to be stack memory. */
+ BIT_OFFSET bits. Marks value contents ranges as unavailable if
+ the corresponding memory is likewise unavailable. STACK indicates
+ whether the memory is known to be stack memory. */
-extern void read_value_memory (struct value *val, LONGEST embedded_offset,
+extern void read_value_memory (struct value *val, LONGEST bit_offset,
int stack, CORE_ADDR memaddr,
gdb_byte *buffer, size_t length);
diff --git a/gdb/warning.m4 b/gdb/warning.m4
index 98e7453..0b6aaab 100644
--- a/gdb/warning.m4
+++ b/gdb/warning.m4
@@ -40,7 +40,8 @@ build_warnings="-Wall -Wpointer-arith \
-Wno-unused -Wunused-value -Wunused-function \
-Wno-switch -Wno-char-subscripts \
-Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
--Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized"
+-Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \
+-Wno-mismatched-tags"
# Enable -Wno-format by default when using gcc on mingw since many
# GCC versions complain about %I64.
@@ -103,9 +104,9 @@ then
*)
# Check whether GCC accepts it.
saved_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $wtest"
+ CFLAGS="$CFLAGS -Werror $wtest"
saved_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $wtest"
+ CXXFLAGS="$CXXFLAGS -Werror $wtest"
AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
CFLAGS="$saved_CFLAGS"
CXXFLAGS="$saved_CXXFLAGS"
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c
index 40a1b62..7362282 100644
--- a/gdb/x86-linux-nat.c
+++ b/gdb/x86-linux-nat.c
@@ -43,16 +43,6 @@
#include "nat/x86-linux-dregs.h"
#include "nat/linux-ptrace.h"
-/* Per-thread arch-specific data we want to keep. */
-
-struct arch_lwp_info
-{
- /* Non-zero if our copy differs from what's recorded in the thread. */
- int debug_registers_changed;
-};
-
-
-
/* linux_nat_new_fork hook. */
static void
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index f9e8584..f875f20 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -120,6 +120,9 @@ static unsigned int xtensa_debug_level = 0;
#define PS_WOE (1<<18)
#define PS_EXC (1<<4)
+/* Big enough to hold the size of the largest register in bytes. */
+#define XTENSA_MAX_REGISTER_SIZE 64
+
static int
windowing_enabled (struct gdbarch *gdbarch, unsigned int ps)
{
@@ -370,7 +373,7 @@ static void
xtensa_register_write_masked (struct regcache *regcache,
xtensa_register_t *reg, const gdb_byte *buffer)
{
- unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+ unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
const xtensa_mask_t *mask = reg->mask;
int shift = 0; /* Shift for next mask (mod 32). */
@@ -454,7 +457,7 @@ static enum register_status
xtensa_register_read_masked (struct regcache *regcache,
xtensa_register_t *reg, gdb_byte *buffer)
{
- unsigned int value[(MAX_REGISTER_SIZE + 3) / 4];
+ unsigned int value[(XTENSA_MAX_REGISTER_SIZE + 3) / 4];
const xtensa_mask_t *mask = reg->mask;
int shift = 0;
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 1f7d01e..7a0a1cf 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,3 +1,82 @@
+2017-06-23 Alan Modra <amodra@gmail.com>
+
+ * options.h (General_options): Add plt_localentry.
+ * powerpc.cc (Target_powerpc::st_other): New function.
+ (Target_powerpc::plt_localentry0_, plt_localentry0_init_,
+ has_localentry0_): New vars.
+ (Target_powerpc::plt_localentry0, set_has_localentry0,
+ is_elfv2_localentry0): New functions.
+ (Target_powerpc::Branch_info::mark_pltcall): Don't set tocsave or
+ return true for localentry:0 calls.
+ (Stub_table::Plt_stub_ent::localentry0_): New var.
+ (Stub_table::add_plt_call_entry): Set localentry0_ and has_localentry0_.
+ Don't set r2save_ for localentry:0 calls.
+ (Output_data_glink::do_write): Save r2 in __glink_PLTresolve for elfv2.
+ (Target_powerpc::scan_relocs): Default plt_localentry0_.
+ (Target_powerpc::do_finalize_sections): Set DT_PPC64_OPT.
+ (Target_powerpc::Relocate::relocate): Don't require nop following
+ calls for localentry:0 plt calls, and don't change nop.
+
+2017-06-23 Alan Modra <amodra@gmail.com>
+
+ * powerpc.cc (Target_powerpc::tocsave_loc_): New var.
+ (Target_powerpc::mark_pltcall, add_tocsave, tocsave_loc): New functions.
+ (Target_powerpc::Branch_info::tocsave_): New var.
+ (Target_powerpc::Branch_info::mark_pltcall): New function.
+ (Target_powerpc::Branch_info::make_stub): Pass tocsave_ to
+ add_plt_call_entry.
+ (Stub_table::Plt_stub_ent): Make public. Add r2save_.
+ (Stub_table::add_plt_call_entry): Add bool tocsave_ param. Set
+ r2save_.
+ (Stub_table::find_plt_call_entry): Return Plt_stub_ent*. Adjust
+ use throughout.
+ (Stub_table::do_write): Conditionally output r2 save in plt stubs.
+ (Target_powerpc::Scan::local): Handle R_PPC64_TOCSAVE.
+ (Target_powerpc::Scan::global): Likewise.
+ (Target_powerpc::Relocate::relocate): Skip r2 save in plt call stub
+ with tocsave reloc. Replace header tocsave nop with r2 save.
+ * symtab.h (struct Symbol_location_hash): Make public.
+
+2017-06-21 Alan Modra <amodra@gmail.com>
+
+ * powerpc.cc (Plt_stub_key): Rename from Plt_stub_ent. Remove indx_.
+ (Plt_stub_key_hash): Rename from Plt_stub_ent_hash.
+ (struct Plt_stub_ent): New.
+ (Plt_stub_entries): Map from Plt_stub_key to Plt_stub_ent. Adjust
+ use throughout file.
+
+2017-06-20 Eric Christopher <echristo@gmail.com>
+
+ * aarch64.cc (scan_reloc_for_stub): Use plt_address_for_global to
+ calculate the symbol value.
+ (scan_reloc_section_for_stubs): Allow stubs to be created for
+ section symbols.
+ (maybe_apply_stub): Handle creating stubs for weak symbols to
+ match the code in scan_reloc_for_stub.
+
+2017-06-20 James Clarke <jrtc27@jrtc27.com>
+
+ * powerpc.cc (Stub_table::define_stub_syms): Always include object's
+ uniq_ value.
+
+2017-06-15 Eric Christopher <echristo@gmail.com>
+
+ * aarch64.cc: Fix a few typos and grammar-os.
+
+2017-06-15 Jiong Wang <jiong.wang@arm.com>
+
+ * aarch64.cc (Insn_utilities::is_mrs_tpidr_el0): New method.
+ (AArch64_relobj<size, big_endian>::try_fix_erratum_843419_optimized):
+ Return ture for some TLS relaxed sequences.
+
+2017-06-07 Eric Christopher <echristo@gmail.com>
+
+ * aarch64.cc (maybe_apply_stub): Add debug logging for looking
+ up stubs to undefined symbols and early return rather than
+ fail to look them up.
+ (scan_reloc_for_stub): Add debug logging for no stub creation
+ for undefined symbols.
+
2017-05-23 Alan Modra <amodra@gmail.com>
PR 21503
diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index c9bb6b7..11bb48e 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -110,6 +110,10 @@ public:
is_adrp(const Insntype insn)
{ return (insn & 0x9F000000) == 0x90000000; }
+ static bool
+ is_mrs_tpidr_el0(const Insntype insn)
+ { return (insn & 0xFFFFFFE0) == 0xd53bd040; }
+
static unsigned int
aarch64_rm(const Insntype insn)
{ return aarch64_bits(insn, 16, 5); }
@@ -926,7 +930,7 @@ private:
// Erratum stub class. An erratum stub differs from a reloc stub in that for
// each erratum occurrence, we generate an erratum stub. We never share erratum
-// stubs, whereas for reloc stubs, different branches insns share a single reloc
+// stubs, whereas for reloc stubs, different branch insns share a single reloc
// stub as long as the branch targets are the same. (More to the point, reloc
// stubs can be shared because they're used to reach a specific target, whereas
// erratum stubs branch back to the original control flow.)
@@ -2010,9 +2014,32 @@ AArch64_relobj<size, big_endian>::try_fix_erratum_843419_optimized(
E843419_stub<size, big_endian>* e843419_stub =
reinterpret_cast<E843419_stub<size, big_endian>*>(stub);
AArch64_address pc = pview.address + e843419_stub->adrp_sh_offset();
- Insntype* adrp_view = reinterpret_cast<Insntype*>(
- pview.view + e843419_stub->adrp_sh_offset());
+ unsigned int adrp_offset = e843419_stub->adrp_sh_offset ();
+ Insntype* adrp_view = reinterpret_cast<Insntype*>(pview.view + adrp_offset);
Insntype adrp_insn = adrp_view[0];
+
+ // If the instruction at adrp_sh_offset is "mrs R, tpidr_el0", it may come
+ // from IE -> LE relaxation etc. This is a side-effect of TLS relaxation that
+ // ADRP has been turned into MRS, there is no erratum risk anymore.
+ // Therefore, we return true to avoid doing unnecessary branch-to-stub.
+ if (Insn_utilities::is_mrs_tpidr_el0(adrp_insn))
+ return true;
+
+ // If the instruction at adrp_sh_offset is not ADRP and the instruction before
+ // it is "mrs R, tpidr_el0", it may come from LD -> LE relaxation etc.
+ // Like the above case, there is no erratum risk any more, we can safely
+ // return true.
+ if (!Insn_utilities::is_adrp(adrp_insn) && adrp_offset)
+ {
+ Insntype* prev_view
+ = reinterpret_cast<Insntype*>(pview.view + adrp_offset - 4);
+ Insntype prev_insn = prev_view[0];
+
+ if (Insn_utilities::is_mrs_tpidr_el0(prev_insn))
+ return true;
+ }
+
+ /* If we reach here, the first instruction must be ADRP. */
gold_assert(Insn_utilities::is_adrp(adrp_insn));
// Get adrp 33-bit signed imm value.
int64_t adrp_imm = Insn_utilities::
@@ -3741,13 +3768,18 @@ Target_aarch64<size, big_endian>::scan_reloc_for_stub(
if (gsym->use_plt_offset(arp->reference_flags()))
{
// This uses a PLT, change the symbol value.
- symval.set_output_value(this->plt_section()->address()
- + gsym->plt_offset());
+ symval.set_output_value(this->plt_address_for_global(gsym));
psymval = &symval;
}
else if (gsym->is_undefined())
- // There is no need to generate a stub symbol is undefined.
- return;
+ {
+ // There is no need to generate a stub symbol if the original symbol
+ // is undefined.
+ gold_debug(DEBUG_TARGET,
+ "stub: not creating a stub for undefined symbol %s in file %s",
+ gsym->name(), aarch64_relobj->name().c_str());
+ return;
+ }
}
// Get the symbol value.
@@ -3969,11 +4001,6 @@ Target_aarch64<size, big_endian>::scan_reloc_section_for_stubs(
psymval = &symval2;
}
- // If symbol is a section symbol, we don't know the actual type of
- // destination. Give up.
- if (psymval->is_section_symbol())
- continue;
-
this->scan_reloc_for_stub(relinfo, r_type, sym, r_sym, psymval,
addend, view_address + offset);
} // End of iterating relocs in a section
@@ -5405,6 +5432,21 @@ maybe_apply_stub(unsigned int r_type,
const The_aarch64_relobj* aarch64_relobj =
static_cast<const The_aarch64_relobj*>(object);
+ const AArch64_reloc_property* arp =
+ aarch64_reloc_property_table->get_reloc_property(r_type);
+ gold_assert(arp != NULL);
+
+ // We don't create stubs for undefined symbols, but do for weak.
+ if (gsym
+ && !gsym->use_plt_offset(arp->reference_flags())
+ && gsym->is_undefined())
+ {
+ gold_debug(DEBUG_TARGET,
+ "stub: looking for a stub for undefined symbol %s in file %s",
+ gsym->name(), aarch64_relobj->name().c_str());
+ return false;
+ }
+
The_stub_table* stub_table = aarch64_relobj->stub_table(relinfo->data_shndx);
gold_assert(stub_table != NULL);
@@ -5416,9 +5458,6 @@ maybe_apply_stub(unsigned int r_type,
Address new_branch_target = stub_table->address() + stub->offset();
typename elfcpp::Swap<size, big_endian>::Valtype branch_offset =
new_branch_target - address;
- const AArch64_reloc_property* arp =
- aarch64_reloc_property_table->get_reloc_property(r_type);
- gold_assert(arp != NULL);
typename This::Status status = This::template
rela_general<32>(view, branch_offset, 0, arp);
if (status != This::STATUS_OKAY)
@@ -7695,8 +7734,8 @@ Target_aarch64<size, big_endian>::Relocate::tls_ld_to_le(
{
// Ideally we should give up gd_to_le relaxation and do gd access.
// However the gd_to_le relaxation decision has been made early
- // in the scan stage, where we did not allocate any GOT entry for
- // this symbol. Therefore we have to exit and report error now.
+ // in the scan stage, where we did not allocate a GOT entry for
+ // this symbol. Therefore we have to exit and report an error now.
gold_error(_("unexpected reloc insn sequence while relaxing "
"tls gd to le for reloc %u."), r_type);
return aarch64_reloc_funcs::STATUS_BAD_RELOC;
diff --git a/gold/options.h b/gold/options.h
index 202d4b0..c7c032b 100644
--- a/gold/options.h
+++ b/gold/options.h
@@ -1104,6 +1104,10 @@ class General_options
N_("(PowerPC64 only) Align PLT call stubs to fit cache lines"),
N_("[=P2ALIGN]"), true, int, int, options::parse_uint, false);
+ DEFINE_bool(plt_localentry, options::TWO_DASHES, '\0', false,
+ N_("(PowerPC64 only) Optimize calls to ELFv2 localentry:0 functions"),
+ N_("(PowerPC64 only) Don't optimize ELFv2 calls"));
+
DEFINE_bool(plt_static_chain, options::TWO_DASHES, '\0', false,
N_("(PowerPC64 only) PLT call stubs should load r11"),
N_("(PowerPC64 only) PLT call stubs should not load r11"));
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 1f2bc9e..a046bbe 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -373,6 +373,12 @@ public:
set_abiversion(int ver);
unsigned int
+ st_other (unsigned int symndx) const
+ {
+ return this->st_other_[symndx];
+ }
+
+ unsigned int
ppc64_local_entry_offset(const Symbol* sym) const
{ return elfcpp::ppc64_decode_local_entry(sym->nonvis() >> 3); }
@@ -593,6 +599,7 @@ class Target_powerpc : public Sized_target<size, big_endian>
Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian> Reloc_section;
typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
typedef typename elfcpp::Elf_types<size>::Elf_Swxword Signed_address;
+ typedef Unordered_set<Symbol_location, Symbol_location_hash> Tocsave_loc;
static const Address invalid_address = static_cast<Address>(0) - 1;
// Offset of tp and dtp pointers from start of TLS block.
static const Address tp_offset = 0x7000;
@@ -603,8 +610,10 @@ class Target_powerpc : public Sized_target<size, big_endian>
got_(NULL), plt_(NULL), iplt_(NULL), brlt_section_(NULL),
glink_(NULL), rela_dyn_(NULL), copy_relocs_(),
tlsld_got_offset_(-1U),
- stub_tables_(), branch_lookup_table_(), branch_info_(),
- plt_thread_safe_(false), relax_failed_(false), relax_fail_count_(0),
+ stub_tables_(), branch_lookup_table_(), branch_info_(), tocsave_loc_(),
+ plt_thread_safe_(false), plt_localentry0_(false),
+ plt_localentry0_init_(false), has_localentry0_(false),
+ relax_failed_(false), relax_fail_count_(0),
stub_group_size_(0), savres_section_(0)
{
}
@@ -680,6 +689,39 @@ class Target_powerpc : public Sized_target<size, big_endian>
ppc_object->set_has_14bit_branch(data_shndx);
}
+ // Return whether the last branch is a plt call, and if so, mark the
+ // branch as having an R_PPC64_TOCSAVE.
+ bool
+ mark_pltcall(Powerpc_relobj<size, big_endian>* ppc_object,
+ unsigned int data_shndx, Address r_offset, Symbol_table* symtab)
+ {
+ return (size == 64
+ && !this->branch_info_.empty()
+ && this->branch_info_.back().mark_pltcall(ppc_object, data_shndx,
+ r_offset, this, symtab));
+ }
+
+ // Say the given location, that of a nop in a function prologue with
+ // an R_PPC64_TOCSAVE reloc, will be used to save r2.
+ // R_PPC64_TOCSAVE relocs on nops following calls point at this nop.
+ void
+ add_tocsave(Powerpc_relobj<size, big_endian>* ppc_object,
+ unsigned int shndx, Address offset)
+ {
+ Symbol_location loc;
+ loc.object = ppc_object;
+ loc.shndx = shndx;
+ loc.offset = offset;
+ this->tocsave_loc_.insert(loc);
+ }
+
+ // Accessor
+ const Tocsave_loc
+ tocsave_loc() const
+ {
+ return this->tocsave_loc_;
+ }
+
void
do_define_standard_symbols(Symbol_table*, Layout*);
@@ -966,6 +1008,49 @@ class Target_powerpc : public Sized_target<size, big_endian>
plt_thread_safe() const
{ return this->plt_thread_safe_; }
+ bool
+ plt_localentry0() const
+ { return this->plt_localentry0_; }
+
+ void
+ set_has_localentry0()
+ {
+ this->has_localentry0_ = true;
+ }
+
+ bool
+ is_elfv2_localentry0(const Symbol* gsym) const
+ {
+ return (size == 64
+ && this->abiversion() >= 2
+ && this->plt_localentry0()
+ && gsym->type() == elfcpp::STT_FUNC
+ && gsym->is_defined()
+ && gsym->nonvis() >> 3 == 0);
+ }
+
+ bool
+ is_elfv2_localentry0(const Sized_relobj_file<size, big_endian>* object,
+ unsigned int r_sym) const
+ {
+ const Powerpc_relobj<size, big_endian>* ppc_object
+ = static_cast<const Powerpc_relobj<size, big_endian>*>(object);
+
+ if (size == 64
+ && this->abiversion() >= 2
+ && this->plt_localentry0()
+ && ppc_object->st_other(r_sym) >> 5 == 0)
+ {
+ const Symbol_value<size>* psymval = object->local_symbol(r_sym);
+ bool is_ordinary;
+ if (!psymval->is_ifunc_symbol()
+ && psymval->input_shndx(&is_ordinary) != elfcpp::SHN_UNDEF
+ && is_ordinary)
+ return true;
+ }
+ return false;
+ }
+
int
abiversion () const
{ return this->processor_specific_flags() & elfcpp::EF_PPC64_ABI; }
@@ -1346,12 +1431,19 @@ class Target_powerpc : public Sized_target<size, big_endian>
unsigned int r_sym,
Address addend)
: object_(ppc_object), shndx_(data_shndx), offset_(r_offset),
- r_type_(r_type), r_sym_(r_sym), addend_(addend)
+ r_type_(r_type), tocsave_ (0), r_sym_(r_sym), addend_(addend)
{ }
~Branch_info()
{ }
+ // Return whether this branch is going via a plt call stub, and if
+ // so, mark it as having an R_PPC64_TOCSAVE.
+ bool
+ mark_pltcall(Powerpc_relobj<size, big_endian>* ppc_object,
+ unsigned int shndx, Address offset,
+ Target_powerpc* target, Symbol_table* symtab);
+
// If this branch needs a plt call stub, or a long branch stub, make one.
bool
make_stub(Stub_table<size, big_endian>*,
@@ -1364,7 +1456,8 @@ class Target_powerpc : public Sized_target<size, big_endian>
unsigned int shndx_;
Address offset_;
// ..and the branch type and destination.
- unsigned int r_type_;
+ unsigned int r_type_ : 31;
+ unsigned int tocsave_ : 1;
unsigned int r_sym_;
Address addend_;
};
@@ -1429,8 +1522,12 @@ class Target_powerpc : public Sized_target<size, big_endian>
typedef std::vector<Branch_info> Branches;
Branches branch_info_;
+ Tocsave_loc tocsave_loc_;
bool plt_thread_safe_;
+ bool plt_localentry0_;
+ bool plt_localentry0_init_;
+ bool has_localentry0_;
bool relax_failed_;
int relax_fail_count_;
@@ -2889,6 +2986,38 @@ max_branch_delta (unsigned int r_type)
return 0;
}
+// Return whether this branch is going via a plt call stub.
+
+template<int size, bool big_endian>
+bool
+Target_powerpc<size, big_endian>::Branch_info::mark_pltcall(
+ Powerpc_relobj<size, big_endian>* ppc_object,
+ unsigned int shndx,
+ Address offset,
+ Target_powerpc* target,
+ Symbol_table* symtab)
+{
+ if (this->object_ != ppc_object
+ || this->shndx_ != shndx
+ || this->offset_ != offset)
+ return false;
+
+ Symbol* sym = this->object_->global_symbol(this->r_sym_);
+ if (sym != NULL && sym->is_forwarder())
+ sym = symtab->resolve_forwards(sym);
+ const Sized_symbol<size>* gsym = static_cast<const Sized_symbol<size>*>(sym);
+ if (gsym != NULL
+ ? (gsym->use_plt_offset(Scan::get_reference_flags(this->r_type_, target))
+ && !target->is_elfv2_localentry0(gsym))
+ : (this->object_->local_has_plt_offset(this->r_sym_)
+ && !target->is_elfv2_localentry0(this->object_, this->r_sym_)))
+ {
+ this->tocsave_ = 1;
+ return true;
+ }
+ return false;
+}
+
// If this branch needs a plt call stub, or a long branch stub, make one.
template<int size, bool big_endian>
@@ -2934,11 +3063,13 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub(
if (gsym != NULL)
ok = stub_table->add_plt_call_entry(from,
this->object_, gsym,
- this->r_type_, this->addend_);
+ this->r_type_, this->addend_,
+ this->tocsave_);
else
ok = stub_table->add_plt_call_entry(from,
this->object_, this->r_sym_,
- this->r_type_, this->addend_);
+ this->r_type_, this->addend_,
+ this->tocsave_);
}
}
else
@@ -3910,6 +4041,17 @@ template<int size, bool big_endian>
class Stub_table : public Output_relaxed_input_section
{
public:
+ struct Plt_stub_ent
+ {
+ Plt_stub_ent(unsigned int off, unsigned int indx)
+ : off_(off), indx_(indx), r2save_(0), localentry0_(0)
+ { }
+
+ unsigned int off_;
+ unsigned int indx_ : 30;
+ unsigned int r2save_ : 1;
+ unsigned int localentry0_ : 1;
+ };
typedef typename elfcpp::Elf_types<size>::Elf_Addr Address;
static const Address invalid_address = static_cast<Address>(0) - 1;
@@ -3939,30 +4081,32 @@ class Stub_table : public Output_relaxed_input_section
const Sized_relobj_file<size, big_endian>*,
const Symbol*,
unsigned int,
- Address);
+ Address,
+ bool);
bool
add_plt_call_entry(Address,
const Sized_relobj_file<size, big_endian>*,
unsigned int,
unsigned int,
- Address);
+ Address,
+ bool);
// Find a given plt call stub.
- Address
+ const Plt_stub_ent*
find_plt_call_entry(const Symbol*) const;
- Address
+ const Plt_stub_ent*
find_plt_call_entry(const Sized_relobj_file<size, big_endian>*,
unsigned int) const;
- Address
+ const Plt_stub_ent*
find_plt_call_entry(const Sized_relobj_file<size, big_endian>*,
const Symbol*,
unsigned int,
Address) const;
- Address
+ const Plt_stub_ent*
find_plt_call_entry(const Sized_relobj_file<size, big_endian>*,
unsigned int,
unsigned int,
@@ -4117,10 +4261,10 @@ class Stub_table : public Output_relaxed_input_section
{ return targ_; }
private:
- class Plt_stub_ent;
- class Plt_stub_ent_hash;
- typedef Unordered_map<Plt_stub_ent, unsigned int,
- Plt_stub_ent_hash> Plt_stub_entries;
+ class Plt_stub_key;
+ class Plt_stub_key_hash;
+ typedef Unordered_map<Plt_stub_key, Plt_stub_ent,
+ Plt_stub_key_hash> Plt_stub_entries;
class Branch_stub_ent;
class Branch_stub_ent_hash;
typedef Unordered_map<Branch_stub_ent, unsigned int,
@@ -4208,19 +4352,19 @@ class Stub_table : public Output_relaxed_input_section
do_write(Output_file*);
// Plt call stub keys.
- class Plt_stub_ent
+ class Plt_stub_key
{
public:
- Plt_stub_ent(const Symbol* sym)
+ Plt_stub_key(const Symbol* sym)
: sym_(sym), object_(0), addend_(0), locsym_(0)
{ }
- Plt_stub_ent(const Sized_relobj_file<size, big_endian>* object,
+ Plt_stub_key(const Sized_relobj_file<size, big_endian>* object,
unsigned int locsym_index)
: sym_(NULL), object_(object), addend_(0), locsym_(locsym_index)
{ }
- Plt_stub_ent(const Sized_relobj_file<size, big_endian>* object,
+ Plt_stub_key(const Sized_relobj_file<size, big_endian>* object,
const Symbol* sym,
unsigned int r_type,
Address addend)
@@ -4237,7 +4381,7 @@ class Stub_table : public Output_relaxed_input_section
}
}
- Plt_stub_ent(const Sized_relobj_file<size, big_endian>* object,
+ Plt_stub_key(const Sized_relobj_file<size, big_endian>* object,
unsigned int locsym_index,
unsigned int r_type,
Address addend)
@@ -4250,7 +4394,7 @@ class Stub_table : public Output_relaxed_input_section
this->addend_ = addend;
}
- bool operator==(const Plt_stub_ent& that) const
+ bool operator==(const Plt_stub_key& that) const
{
return (this->sym_ == that.sym_
&& this->object_ == that.object_
@@ -4262,13 +4406,12 @@ class Stub_table : public Output_relaxed_input_section
const Sized_relobj_file<size, big_endian>* object_;
typename elfcpp::Elf_types<size>::Elf_Addr addend_;
unsigned int locsym_;
- unsigned int indx_;
};
- class Plt_stub_ent_hash
+ class Plt_stub_key_hash
{
public:
- size_t operator()(const Plt_stub_ent& ent) const
+ size_t operator()(const Plt_stub_key& ent) const
{
return (reinterpret_cast<uintptr_t>(ent.sym_)
^ reinterpret_cast<uintptr_t>(ent.object_)
@@ -4344,16 +4487,28 @@ Stub_table<size, big_endian>::add_plt_call_entry(
const Sized_relobj_file<size, big_endian>* object,
const Symbol* gsym,
unsigned int r_type,
- Address addend)
+ Address addend,
+ bool tocsave)
{
- Plt_stub_ent ent(object, gsym, r_type, addend);
- unsigned int off = this->plt_size_;
- ent.indx_ = this->plt_call_stubs_.size();
+ Plt_stub_key key(object, gsym, r_type, addend);
+ Plt_stub_ent ent(this->plt_size_, this->plt_call_stubs_.size());
std::pair<typename Plt_stub_entries::iterator, bool> p
- = this->plt_call_stubs_.insert(std::make_pair(ent, off));
+ = this->plt_call_stubs_.insert(std::make_pair(key, ent));
if (p.second)
- this->plt_size_ = off + this->plt_call_size(p.first);
- return this->can_reach_stub(from, off, r_type);
+ {
+ this->plt_size_ = ent.off_ + this->plt_call_size(p.first);
+ if (size == 64
+ && this->targ_->is_elfv2_localentry0(gsym))
+ {
+ p.first->second.localentry0_ = 1;
+ this->targ_->set_has_localentry0();
+ }
+ }
+ if (size == 64
+ && !tocsave
+ && !p.first->second.localentry0_)
+ p.first->second.r2save_ = 1;
+ return this->can_reach_stub(from, ent.off_, r_type);
}
template<int size, bool big_endian>
@@ -4363,64 +4518,84 @@ Stub_table<size, big_endian>::add_plt_call_entry(
const Sized_relobj_file<size, big_endian>* object,
unsigned int locsym_index,
unsigned int r_type,
- Address addend)
+ Address addend,
+ bool tocsave)
{
- Plt_stub_ent ent(object, locsym_index, r_type, addend);
- unsigned int off = this->plt_size_;
- ent.indx_ = this->plt_call_stubs_.size();
+ Plt_stub_key key(object, locsym_index, r_type, addend);
+ Plt_stub_ent ent(this->plt_size_, this->plt_call_stubs_.size());
std::pair<typename Plt_stub_entries::iterator, bool> p
- = this->plt_call_stubs_.insert(std::make_pair(ent, off));
+ = this->plt_call_stubs_.insert(std::make_pair(key, ent));
if (p.second)
- this->plt_size_ = off + this->plt_call_size(p.first);
- return this->can_reach_stub(from, off, r_type);
+ {
+ this->plt_size_ = ent.off_ + this->plt_call_size(p.first);
+ if (size == 64
+ && this->targ_->is_elfv2_localentry0(object, locsym_index))
+ {
+ p.first->second.localentry0_ = 1;
+ this->targ_->set_has_localentry0();
+ }
+ }
+ if (size == 64
+ && !tocsave
+ && !p.first->second.localentry0_)
+ p.first->second.r2save_ = 1;
+ return this->can_reach_stub(from, ent.off_, r_type);
}
// Find a plt call stub.
template<int size, bool big_endian>
-typename Stub_table<size, big_endian>::Address
+const typename Stub_table<size, big_endian>::Plt_stub_ent*
Stub_table<size, big_endian>::find_plt_call_entry(
const Sized_relobj_file<size, big_endian>* object,
const Symbol* gsym,
unsigned int r_type,
Address addend) const
{
- Plt_stub_ent ent(object, gsym, r_type, addend);
- typename Plt_stub_entries::const_iterator p = this->plt_call_stubs_.find(ent);
- return p == this->plt_call_stubs_.end() ? invalid_address : p->second;
+ Plt_stub_key key(object, gsym, r_type, addend);
+ typename Plt_stub_entries::const_iterator p = this->plt_call_stubs_.find(key);
+ if (p == this->plt_call_stubs_.end())
+ return NULL;
+ return &p->second;
}
template<int size, bool big_endian>
-typename Stub_table<size, big_endian>::Address
+const typename Stub_table<size, big_endian>::Plt_stub_ent*
Stub_table<size, big_endian>::find_plt_call_entry(const Symbol* gsym) const
{
- Plt_stub_ent ent(gsym);
- typename Plt_stub_entries::const_iterator p = this->plt_call_stubs_.find(ent);
- return p == this->plt_call_stubs_.end() ? invalid_address : p->second;
+ Plt_stub_key key(gsym);
+ typename Plt_stub_entries::const_iterator p = this->plt_call_stubs_.find(key);
+ if (p == this->plt_call_stubs_.end())
+ return NULL;
+ return &p->second;
}
template<int size, bool big_endian>
-typename Stub_table<size, big_endian>::Address
+const typename Stub_table<size, big_endian>::Plt_stub_ent*
Stub_table<size, big_endian>::find_plt_call_entry(
const Sized_relobj_file<size, big_endian>* object,
unsigned int locsym_index,
unsigned int r_type,
Address addend) const
{
- Plt_stub_ent ent(object, locsym_index, r_type, addend);
- typename Plt_stub_entries::const_iterator p = this->plt_call_stubs_.find(ent);
- return p == this->plt_call_stubs_.end() ? invalid_address : p->second;
+ Plt_stub_key key(object, locsym_index, r_type, addend);
+ typename Plt_stub_entries::const_iterator p = this->plt_call_stubs_.find(key);
+ if (p == this->plt_call_stubs_.end())
+ return NULL;
+ return &p->second;
}
template<int size, bool big_endian>
-typename Stub_table<size, big_endian>::Address
+const typename Stub_table<size, big_endian>::Plt_stub_ent*
Stub_table<size, big_endian>::find_plt_call_entry(
const Sized_relobj_file<size, big_endian>* object,
unsigned int locsym_index) const
{
- Plt_stub_ent ent(object, locsym_index);
- typename Plt_stub_entries::const_iterator p = this->plt_call_stubs_.find(ent);
- return p == this->plt_call_stubs_.end() ? invalid_address : p->second;
+ Plt_stub_key key(object, locsym_index);
+ typename Plt_stub_entries::const_iterator p = this->plt_call_stubs_.find(key);
+ if (p == this->plt_call_stubs_.end())
+ return NULL;
+ return &p->second;
}
// Add a long branch stub if we don't already have one to given
@@ -4647,7 +4822,7 @@ Stub_table<size, big_endian>::define_stub_syms(Symbol_table* symtab)
for (plt_iter cs = this->plt_call_stubs_.begin();
cs != this->plt_call_stubs_.end();
++cs)
- sorted[cs->first.indx_] = cs;
+ sorted[cs->second.indx_] = cs;
for (unsigned int i = 0; i < this->plt_call_stubs_.size(); ++i)
{
@@ -4656,20 +4831,27 @@ Stub_table<size, big_endian>::define_stub_syms(Symbol_table* symtab)
add[0] = 0;
if (cs->first.addend_ != 0)
sprintf(add, "+%x", static_cast<uint32_t>(cs->first.addend_));
- char localname[18];
- const char *symname;
- if (cs->first.sym_ == NULL)
+ char obj[10];
+ obj[0] = 0;
+ if (cs->first.object_)
{
const Powerpc_relobj<size, big_endian>* ppcobj = static_cast
<const Powerpc_relobj<size, big_endian>*>(cs->first.object_);
- sprintf(localname, "%x:%x", ppcobj->uniq(), cs->first.locsym_);
+ sprintf(obj, "%x:", ppcobj->uniq());
+ }
+ char localname[9];
+ const char *symname;
+ if (cs->first.sym_ == NULL)
+ {
+ sprintf(localname, "%x", cs->first.locsym_);
symname = localname;
}
else
symname = cs->first.sym_->name();
- char* name = new char[8 + 10 + strlen(symname) + strlen(add) + 1];
- sprintf(name, "%08x.plt_call.%s%s", this->uniq_, symname, add);
- Address value = this->stub_address() - this->address() + cs->second;
+ char* name = new char[8 + 10 + strlen(obj) + strlen(symname) + strlen(add) + 1];
+ sprintf(name, "%08x.plt_call.%s%s%s", this->uniq_, obj, symname, add);
+ Address value
+ = this->stub_address() - this->address() + cs->second.off_;
unsigned int stub_size = this->plt_call_size(cs);
this->targ_->define_local(symtab, name, this, value, stub_size);
}
@@ -4769,7 +4951,8 @@ Stub_table<size, big_endian>::do_write(Output_file* of)
Address to
= this->targ_->glink_section()->address() + glinkoff;
Address from
- = (this->stub_address() + cs->second + 24
+ = (this->stub_address() + cs->second.off_ + 20
+ + 4 * cs->second.r2save_
+ 4 * (ha(off) != 0)
+ 4 * (ha(off + 8 + 8 * static_chain) != ha(off))
+ 4 * static_chain);
@@ -4777,11 +4960,15 @@ Stub_table<size, big_endian>::do_write(Output_file* of)
use_fake_dep = cmp_branch_off + (1 << 25) >= (1 << 26);
}
- p = oview + cs->second;
+ p = oview + cs->second.off_;
if (ha(off) != 0)
{
- write_insn<big_endian>(p, std_2_1 + this->targ_->stk_toc());
- p += 4;
+ if (cs->second.r2save_)
+ {
+ write_insn<big_endian>(p,
+ std_2_1 + this->targ_->stk_toc());
+ p += 4;
+ }
if (plt_load_toc)
{
write_insn<big_endian>(p, addis_11_2 + ha(off));
@@ -4825,8 +5012,12 @@ Stub_table<size, big_endian>::do_write(Output_file* of)
}
else
{
- write_insn<big_endian>(p, std_2_1 + this->targ_->stk_toc());
- p += 4;
+ if (cs->second.r2save_)
+ {
+ write_insn<big_endian>(p,
+ std_2_1 + this->targ_->stk_toc());
+ p += 4;
+ }
write_insn<big_endian>(p, ld_12_2 + l(off));
p += 4;
if (plt_load_toc
@@ -4931,7 +5122,7 @@ Stub_table<size, big_endian>::do_write(Output_file* of)
else
plt_addr += plt_base;
- p = oview + cs->second;
+ p = oview + cs->second.off_;
if (parameters->options().output_is_position_independent())
{
Address got_addr;
@@ -5069,6 +5260,7 @@ Output_data_glink<size, big_endian>::do_write(Output_file* of)
write_insn<big_endian>(p, mflr_0), p += 4;
write_insn<big_endian>(p, bcl_20_31), p += 4;
write_insn<big_endian>(p, mflr_11), p += 4;
+ write_insn<big_endian>(p, std_2_1 + 24), p += 4;
write_insn<big_endian>(p, ld_2_11 + l(-16)), p += 4;
write_insn<big_endian>(p, mtlr_0), p += 4;
write_insn<big_endian>(p, sub_12_12_11), p += 4;
@@ -6029,7 +6221,6 @@ Target_powerpc<size, big_endian>::Scan::local(
case elfcpp::R_POWERPC_NONE:
case elfcpp::R_POWERPC_GNU_VTINHERIT:
case elfcpp::R_POWERPC_GNU_VTENTRY:
- case elfcpp::R_PPC64_TOCSAVE:
case elfcpp::R_POWERPC_TLS:
case elfcpp::R_PPC64_ENTRY:
break;
@@ -6137,6 +6328,27 @@ Target_powerpc<size, big_endian>::Scan::local(
}
break;
+ case elfcpp::R_PPC64_TOCSAVE:
+ // R_PPC64_TOCSAVE follows a call instruction to indicate the
+ // caller has already saved r2 and thus a plt call stub need not
+ // save r2.
+ if (size == 64
+ && target->mark_pltcall(ppc_object, data_shndx,
+ reloc.get_r_offset() - 4, symtab))
+ {
+ unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
+ unsigned int shndx = lsym.get_st_shndx();
+ bool is_ordinary;
+ shndx = object->adjust_sym_shndx(r_sym, shndx, &is_ordinary);
+ if (!is_ordinary)
+ object->error(_("tocsave symbol %u has bad shndx %u"),
+ r_sym, shndx);
+ else
+ target->add_tocsave(ppc_object, shndx,
+ lsym.get_st_value() + reloc.get_r_addend());
+ }
+ break;
+
case elfcpp::R_PPC64_REL64:
case elfcpp::R_POWERPC_REL32:
case elfcpp::R_POWERPC_REL16:
@@ -6740,6 +6952,29 @@ Target_powerpc<size, big_endian>::Scan::global(
}
break;
+ case elfcpp::R_PPC64_TOCSAVE:
+ // R_PPC64_TOCSAVE follows a call instruction to indicate the
+ // caller has already saved r2 and thus a plt call stub need not
+ // save r2.
+ if (size == 64
+ && target->mark_pltcall(ppc_object, data_shndx,
+ reloc.get_r_offset() - 4, symtab))
+ {
+ unsigned int r_sym = elfcpp::elf_r_sym<size>(reloc.get_r_info());
+ bool is_ordinary;
+ unsigned int shndx = gsym->shndx(&is_ordinary);
+ if (!is_ordinary)
+ object->error(_("tocsave symbol %u has bad shndx %u"),
+ r_sym, shndx);
+ else
+ {
+ Sized_symbol<size>* sym = symtab->get_sized_symbol<size>(gsym);
+ target->add_tocsave(ppc_object, shndx,
+ sym->value() + reloc.get_r_addend());
+ }
+ }
+ break;
+
case elfcpp::R_POWERPC_REL16:
case elfcpp::R_POWERPC_REL16_LO:
case elfcpp::R_POWERPC_REL16_HI:
@@ -7417,6 +7652,21 @@ Target_powerpc<size, big_endian>::scan_relocs(
typedef gold::Default_classify_reloc<elfcpp::SHT_RELA, size, big_endian>
Classify_reloc;
+ if (!this->plt_localentry0_init_)
+ {
+ bool plt_localentry0 = false;
+ if (size == 64
+ && this->abiversion() >= 2)
+ {
+ if (parameters->options().user_set_plt_localentry())
+ plt_localentry0 = parameters->options().plt_localentry();
+ else
+ plt_localentry0 = symtab->lookup("GLIBC_2.26", NULL) != NULL;
+ }
+ this->plt_localentry0_ = plt_localentry0;
+ this->plt_localentry0_init_ = true;
+ }
+
if (sh_type == elfcpp::SHT_REL)
{
gold_error(_("%s: unsupported REL reloc section"),
@@ -7613,6 +7863,9 @@ Target_powerpc<size, big_endian>::do_finalize_sections(
(this->glink_->pltresolve_size
- 32));
}
+ if (this->has_localentry0_)
+ odyn->add_constant(elfcpp::DT_PPC64_OPT,
+ elfcpp::PPC64_OPT_LOCALENTRY);
}
}
@@ -7757,6 +8010,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
= static_cast<Powerpc_relobj<size, big_endian>*>(relinfo->object);
Address value = 0;
bool has_stub_value = false;
+ bool localentry0 = false;
unsigned int r_sym = elfcpp::elf_r_sym<size>(rela.get_r_info());
if ((gsym != NULL
? gsym->use_plt_offset(Scan::get_reference_flags(r_type, target))
@@ -7789,16 +8043,30 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
}
if (stub_table != NULL)
{
- Address off;
+ const typename Stub_table<size, big_endian>::Plt_stub_ent* ent;
if (gsym != NULL)
- off = stub_table->find_plt_call_entry(object, gsym, r_type,
+ ent = stub_table->find_plt_call_entry(object, gsym, r_type,
rela.get_r_addend());
else
- off = stub_table->find_plt_call_entry(object, r_sym, r_type,
+ ent = stub_table->find_plt_call_entry(object, r_sym, r_type,
rela.get_r_addend());
- if (off != invalid_address)
+ if (ent != NULL)
{
- value = stub_table->stub_address() + off;
+ value = stub_table->stub_address() + ent->off_;
+ const int reloc_size = elfcpp::Elf_sizes<size>::rela_size;
+ elfcpp::Shdr<size, big_endian> shdr(relinfo->reloc_shdr);
+ size_t reloc_count = shdr.get_sh_size() / reloc_size;
+ if (size == 64
+ && ent->r2save_
+ && relnum + 1 < reloc_count)
+ {
+ Reltype next_rela(preloc + reloc_size);
+ if (elfcpp::elf_r_type<size>(next_rela.get_r_info())
+ == elfcpp::R_PPC64_TOCSAVE
+ && next_rela.get_r_offset() == rela.get_r_offset() + 4)
+ value += 4;
+ }
+ localentry0 = ent->localentry0_;
has_stub_value = true;
}
}
@@ -7842,8 +8110,8 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
{
typedef typename elfcpp::Swap<32, big_endian>::Valtype Valtype;
Valtype* wv = reinterpret_cast<Valtype*>(view);
- bool can_plt_call = false;
- if (rela.get_r_offset() + 8 <= view_size)
+ bool can_plt_call = localentry0;
+ if (!localentry0 && rela.get_r_offset() + 8 <= view_size)
{
Valtype insn = elfcpp::Swap<32, big_endian>::readval(wv);
Valtype insn2 = elfcpp::Swap<32, big_endian>::readval(wv + 1);
@@ -8827,12 +9095,26 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
r_type);
break;
- case elfcpp::R_PPC_EMB_SDA21:
+ case elfcpp::R_PPC64_TOCSAVE:
if (size == 32)
+ // R_PPC_EMB_SDA21
goto unsupp;
else
{
- // R_PPC64_TOCSAVE. For the time being this can be ignored.
+ Symbol_location loc;
+ loc.object = relinfo->object;
+ loc.shndx = relinfo->data_shndx;
+ loc.offset = rela.get_r_offset();
+ Tocsave_loc::const_iterator p = target->tocsave_loc().find(loc);
+ if (p != target->tocsave_loc().end())
+ {
+ // If we've generated plt calls using this tocsave, then
+ // the nop needs to be changed to save r2.
+ Insn* iview = reinterpret_cast<Insn*>(view);
+ if (elfcpp::Swap<32, big_endian>::readval(iview) == nop)
+ elfcpp::Swap<32, big_endian>::
+ writeval(iview, std_2_1 + target->stk_toc());
+ }
}
break;
@@ -9390,9 +9672,10 @@ Target_powerpc<size, big_endian>::do_dynsym_value(const Symbol* gsym) const
p != this->stub_tables_.end();
++p)
{
- Address off = (*p)->find_plt_call_entry(gsym);
- if (off != invalid_address)
- return (*p)->stub_address() + off;
+ const typename Stub_table<size, big_endian>::Plt_stub_ent* ent
+ = (*p)->find_plt_call_entry(gsym);
+ if (ent != NULL)
+ return (*p)->stub_address() + ent->off_;
}
}
else if (this->abiversion() >= 2)
@@ -9419,10 +9702,10 @@ Target_powerpc<size, big_endian>::do_plt_address_for_local(
p != this->stub_tables_.end();
++p)
{
- Address off = (*p)->find_plt_call_entry(relobj->sized_relobj(),
- symndx);
- if (off != invalid_address)
- return (*p)->stub_address() + off;
+ const typename Stub_table<size, big_endian>::Plt_stub_ent* ent
+ = (*p)->find_plt_call_entry(relobj->sized_relobj(), symndx);
+ if (ent != NULL)
+ return (*p)->stub_address() + ent->off_;
}
}
gold_unreachable();
@@ -9440,9 +9723,10 @@ Target_powerpc<size, big_endian>::do_plt_address_for_global(
p != this->stub_tables_.end();
++p)
{
- Address off = (*p)->find_plt_call_entry(gsym);
- if (off != invalid_address)
- return (*p)->stub_address() + off;
+ const typename Stub_table<size, big_endian>::Plt_stub_ent* ent
+ = (*p)->find_plt_call_entry(gsym);
+ if (ent != NULL)
+ return (*p)->stub_address() + ent->off_;
}
}
else if (this->abiversion() >= 2)
diff --git a/gold/symtab.h b/gold/symtab.h
index 46c7fce..77552ae 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -1273,6 +1273,16 @@ struct Symbol_location
}
};
+// A map from symbol name (as a pointer into the namepool) to all
+// the locations the symbols is (weakly) defined (and certain other
+// conditions are met). This map will be used later to detect
+// possible One Definition Rule (ODR) violations.
+struct Symbol_location_hash
+{
+ size_t operator()(const Symbol_location& loc) const
+ { return reinterpret_cast<uintptr_t>(loc.object) ^ loc.offset ^ loc.shndx; }
+};
+
// This class manages warnings. Warnings are a GNU extension. When
// we see a section named .gnu.warning.SYM in an object file, and if
// we wind using the definition of SYM from that object file, then we
@@ -1695,16 +1705,6 @@ class Symbol_table
typedef Unordered_map<Symbol_table_key, Symbol*, Symbol_table_hash,
Symbol_table_eq> Symbol_table_type;
- // A map from symbol name (as a pointer into the namepool) to all
- // the locations the symbols is (weakly) defined (and certain other
- // conditions are met). This map will be used later to detect
- // possible One Definition Rule (ODR) violations.
- struct Symbol_location_hash
- {
- size_t operator()(const Symbol_location& loc) const
- { return reinterpret_cast<uintptr_t>(loc.object) ^ loc.offset ^ loc.shndx; }
- };
-
typedef Unordered_map<const char*,
Unordered_set<Symbol_location, Symbol_location_hash> >
Odr_map;
diff --git a/include/ChangeLog b/include/ChangeLog
index c1fdb8e..91cb91f 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,66 @@
+2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * elf/arm.h (TAG_CPU_ARCH_V8R): New macro.
+ * opcode/arm.h (ARM_EXT2_V8A): New macro.
+ (ARM_AEXT2_V8A): Rename into ...
+ (ARM_AEXT2_V8AR): This.
+ (ARM_AEXT2_V8A): New macro.
+ (ARM_AEXT_V8R): New macro.
+ (ARM_AEXT2_V8R): New macro.
+ (ARM_ARCH_V8R): New macro.
+
+2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * opcode/arm.h (ARM_AEXT_V4TxM): Add ARM_EXT_OS bit to the set.
+ (ARM_AEXT_V4T): Likewise.
+ (ARM_AEXT_V5TxM): Likewise.
+ (ARM_AEXT_V5T): Likewise.
+ (ARM_AEXT_V6M): Mask off ARM_EXT_OS bit.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfdlink.h (bfd_link_info): Add shstk.
+ * elf/common.h (GNU_PROPERTY_X86_FEATURE_1_SHSTK): New.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bfdlink.h (bfd_link_info): Add ibtplt and ibt.
+ * elf/common.h (GNU_PROPERTY_X86_FEATURE_1_AND): New.
+ (GNU_PROPERTY_X86_FEATURE_1_IBT): Likewise.
+
+2017-06-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * opcode/arm.h (FPU_ANY): New macro.
+
+2017-06-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * elf/s390.h (PT_S390_PGSTE): Define macro.
+
+2017-06-16 Alan Modra <amodra@gmail.com>
+
+ PR ld/20022
+ PR ld/21557
+ PR ld/21562
+ PR ld/21571
+ * bfdlink.h (struct bfd_link_hash_entry): Delete undef.section.
+
+2017-06-14 Yao Qi <yao.qi@linaro.org>
+
+ * dis-asm.h (print_insn_aarch64): Move it to opcodes/disassemble.h.
+ (print_insn_big_arm, print_insn_big_mips): Likewise.
+ (print_insn_i386, print_insn_ia64): Likewise.
+ (print_insn_little_arm, print_insn_little_mips): Likewise.
+ (print_insn_spu): Likewise.
+
+2017-06-06 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * bfdlink.h (struct bfd_link_info): Add new resolve_section_groups
+ flag.
+
+2017-06-01 Alan Modra <amodra@gmail.com>
+
+ * elf/ppc64.h (PPC64_OPT_LOCALENTRY): Define.
+
2017-05-31 Eli Zaretskii <eliz@gnu.org>
* environ.h: Add #ifndef guard.
diff --git a/include/bfdlink.h b/include/bfdlink.h
index 371822c..e7c7836 100644
--- a/include/bfdlink.h
+++ b/include/bfdlink.h
@@ -144,9 +144,6 @@ struct bfd_link_hash_entry
struct bfd_link_hash_entry *next;
/* BFD symbol was found in. */
bfd *abfd;
- /* For __start_<name> and __stop_<name> symbols, the first
- input section matching the name. */
- asection *section;
} undef;
/* bfd_link_hash_defined, bfd_link_hash_defweak. */
struct
@@ -348,6 +345,9 @@ struct bfd_link_info
/* TRUE if all data symbols should be dynamic. */
unsigned int dynamic_data: 1;
+ /* TRUE if section groups should be resolved. */
+ unsigned int resolve_section_groups: 1;
+
/* Which symbols to strip. */
ENUM_BITFIELD (bfd_link_strip) strip : 2;
@@ -471,6 +471,15 @@ struct bfd_link_info
/* TRUE if BND prefix in PLT entries is always generated. */
unsigned int bndplt: 1;
+ /* TRUE if IBT-enabled PLT entries should be generated. */
+ unsigned int ibtplt: 1;
+
+ /* TRUE if GNU_PROPERTY_X86_FEATURE_1_IBT should be generated. */
+ unsigned int ibt: 1;
+
+ /* TRUE if GNU_PROPERTY_X86_FEATURE_1_SHSTK should be generated. */
+ unsigned int shstk: 1;
+
/* TRUE if generation of .interp/PT_INTERP should be suppressed. */
unsigned int nointerp: 1;
diff --git a/include/dis-asm.h b/include/dis-asm.h
index 911bfb0..9b42514 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -238,19 +238,11 @@ typedef struct
typedef int (*disassembler_ftype) (bfd_vma, disassemble_info *);
/* Disassemblers used out side of opcodes library. */
-extern int print_insn_aarch64 (bfd_vma, disassemble_info *);
-extern int print_insn_big_arm (bfd_vma, disassemble_info *);
-extern int print_insn_big_mips (bfd_vma, disassemble_info *);
-extern int print_insn_i386 (bfd_vma, disassemble_info *);
-extern int print_insn_ia64 (bfd_vma, disassemble_info *);
-extern int print_insn_little_arm (bfd_vma, disassemble_info *);
-extern int print_insn_little_mips (bfd_vma, disassemble_info *);
extern int print_insn_m32c (bfd_vma, disassemble_info *);
extern int print_insn_mep (bfd_vma, disassemble_info *);
extern int print_insn_sh (bfd_vma, disassemble_info *);
extern int print_insn_sh64x_media (bfd_vma, disassemble_info *);
extern int print_insn_sparc (bfd_vma, disassemble_info *);
-extern int print_insn_spu (bfd_vma, disassemble_info *);
extern int print_insn_rx (bfd_vma, disassemble_info *);
extern int print_insn_rl78 (bfd_vma, disassemble_info *);
extern int print_insn_rl78_g10 (bfd_vma, disassemble_info *);
diff --git a/include/elf/arm.h b/include/elf/arm.h
index 270aa45..30a31e6 100644
--- a/include/elf/arm.h
+++ b/include/elf/arm.h
@@ -106,6 +106,7 @@
#define TAG_CPU_ARCH_V6S_M 12
#define TAG_CPU_ARCH_V7E_M 13
#define TAG_CPU_ARCH_V8 14
+#define TAG_CPU_ARCH_V8R 15
#define TAG_CPU_ARCH_V8M_BASE 16
#define TAG_CPU_ARCH_V8M_MAIN 17
#define MAX_TAG_CPU_ARCH TAG_CPU_ARCH_V8M_MAIN
diff --git a/include/elf/common.h b/include/elf/common.h
index 484cb48..8ca14bc 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -709,6 +709,7 @@
#define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000
#define GNU_PROPERTY_X86_ISA_1_NEEDED 0xc0000001
+#define GNU_PROPERTY_X86_FEATURE_1_AND 0xc0000002
#define GNU_PROPERTY_X86_ISA_1_486 (1U << 0)
#define GNU_PROPERTY_X86_ISA_1_586 (1U << 1)
@@ -729,6 +730,9 @@
#define GNU_PROPERTY_X86_ISA_1_AVX512DQ (1U << 16)
#define GNU_PROPERTY_X86_ISA_1_AVX512BW (1U << 17)
+#define GNU_PROPERTY_X86_FEATURE_1_IBT (1U << 0)
+#define GNU_PROPERTY_X86_FEATURE_1_SHSTK (1U << 1)
+
/* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG). */
#define GNU_ABI_TAG_LINUX 0
#define GNU_ABI_TAG_HURD 1
diff --git a/include/elf/ppc64.h b/include/elf/ppc64.h
index 43090dd..145e9b6 100644
--- a/include/elf/ppc64.h
+++ b/include/elf/ppc64.h
@@ -251,5 +251,6 @@ ppc64_encode_local_entry(unsigned int val)
#define DT_PPC64_OPT (DT_LOPROC + 3)
#define PPC64_OPT_TLS 1
#define PPC64_OPT_MULTI_TOC 2
+#define PPC64_OPT_LOCALENTRY 4
#endif /* _ELF_PPC64_H */
diff --git a/include/elf/s390.h b/include/elf/s390.h
index 5da5e6e..1c91a68 100644
--- a/include/elf/s390.h
+++ b/include/elf/s390.h
@@ -37,6 +37,9 @@
#define EF_S390_HIGH_GPRS 0x00000001
+/* Request 4k page table size. */
+#define PT_S390_PGSTE (PT_LOPROC + 0)
+
/* Relocation types. */
START_RELOC_NUMBERS (elf_s390_reloc_type)
diff --git a/include/opcode/arm.h b/include/opcode/arm.h
index bb68a78..e2049a0 100644
--- a/include/opcode/arm.h
+++ b/include/opcode/arm.h
@@ -65,6 +65,7 @@
#define ARM_EXT2_V8M_MAIN 0x00000040 /* ARMv8-M Mainline. */
#define ARM_EXT2_RAS 0x00000080 /* RAS extension. */
#define ARM_EXT2_V8_3A 0x00000100 /* ARM V8.3A. */
+#define ARM_EXT2_V8A 0x00000200 /* ARMv8-A. */
/* Co-processor space extensions. */
#define ARM_CEXT_XSCALE 0x00000001 /* Allow MIA etc. */
@@ -106,12 +107,14 @@
#define ARM_AEXT_V3M (ARM_AEXT_V3 | ARM_EXT_V3M)
#define ARM_AEXT_V4xM (ARM_AEXT_V3 | ARM_EXT_V4)
#define ARM_AEXT_V4 (ARM_AEXT_V3M | ARM_EXT_V4)
-#define ARM_AEXT_V4TxM (ARM_AEXT_V4xM | ARM_EXT_V4T)
-#define ARM_AEXT_V4T (ARM_AEXT_V4 | ARM_EXT_V4T)
+#define ARM_AEXT_V4TxM (ARM_AEXT_V4xM | ARM_EXT_V4T | ARM_EXT_OS)
+#define ARM_AEXT_V4T (ARM_AEXT_V4 | ARM_EXT_V4T | ARM_EXT_OS)
#define ARM_AEXT_V5xM (ARM_AEXT_V4xM | ARM_EXT_V5)
#define ARM_AEXT_V5 (ARM_AEXT_V4 | ARM_EXT_V5)
-#define ARM_AEXT_V5TxM (ARM_AEXT_V5xM | ARM_EXT_V4T | ARM_EXT_V5T)
-#define ARM_AEXT_V5T (ARM_AEXT_V5 | ARM_EXT_V4T | ARM_EXT_V5T)
+#define ARM_AEXT_V5TxM (ARM_AEXT_V5xM | ARM_EXT_V4T | ARM_EXT_V5T \
+ | ARM_EXT_OS)
+#define ARM_AEXT_V5T (ARM_AEXT_V5 | ARM_EXT_V4T | ARM_EXT_V5T \
+ | ARM_EXT_OS)
#define ARM_AEXT_V5TExP (ARM_AEXT_V5T | ARM_EXT_V5ExP)
#define ARM_AEXT_V5TE (ARM_AEXT_V5TExP | ARM_EXT_V5E)
#define ARM_AEXT_V5TEJ (ARM_AEXT_V5TE | ARM_EXT_V5J)
@@ -136,7 +139,7 @@
#define ARM_AEXT_V6M_ONLY \
((ARM_EXT_BARRIER | ARM_EXT_V6M | ARM_EXT_THUMB_MSR) & ~(ARM_AEXT_NOTM))
#define ARM_AEXT_V6M \
- ((ARM_AEXT_V6K | ARM_AEXT_V6M_ONLY) & ~(ARM_AEXT_NOTM))
+ ((ARM_AEXT_V6K | ARM_AEXT_V6M_ONLY) & ~(ARM_AEXT_NOTM | ARM_EXT_OS))
#define ARM_AEXT_V6SM (ARM_AEXT_V6M | ARM_EXT_OS)
#define ARM_AEXT_V7M \
((ARM_AEXT_V7_ARM | ARM_EXT_V6M | ARM_EXT_V7M | ARM_EXT_DIV) \
@@ -147,7 +150,8 @@
#define ARM_AEXT_V8A \
(ARM_AEXT_V7A | ARM_EXT_MP | ARM_EXT_SEC | ARM_EXT_DIV | ARM_EXT_ADIV \
| ARM_EXT_VIRT | ARM_EXT_V8)
-#define ARM_AEXT2_V8A (ARM_EXT2_V6T2_V8M | ARM_EXT2_ATOMICS)
+#define ARM_AEXT2_V8AR (ARM_EXT2_V6T2_V8M | ARM_EXT2_ATOMICS)
+#define ARM_AEXT2_V8A (ARM_AEXT2_V8AR | ARM_EXT2_V8A)
#define ARM_AEXT2_V8_1A (ARM_AEXT2_V8A | ARM_EXT2_PAN)
#define ARM_AEXT2_V8_2A (ARM_AEXT2_V8_1A | ARM_EXT2_V8_2A | ARM_EXT2_RAS)
#define ARM_AEXT2_V8_3A (ARM_AEXT2_V8_2A | ARM_EXT2_V8_3A)
@@ -157,6 +161,8 @@
#define ARM_AEXT2_V8M (ARM_EXT2_V8M | ARM_EXT2_ATOMICS | ARM_EXT2_V6T2_V8M)
#define ARM_AEXT2_V8M_MAIN (ARM_AEXT2_V8M | ARM_EXT2_V8M_MAIN)
#define ARM_AEXT2_V8M_MAIN_DSP ARM_AEXT2_V8M_MAIN
+#define ARM_AEXT_V8R ARM_AEXT_V8A
+#define ARM_AEXT2_V8R ARM_AEXT2_V8AR
/* Processors with specific extensions in the co-processor space. */
#define ARM_ARCH_XSCALE ARM_FEATURE_LOW (ARM_AEXT_V5TE, ARM_CEXT_XSCALE)
@@ -280,11 +286,13 @@
ARM_AEXT2_V8M_MAIN)
#define ARM_ARCH_V8M_MAIN_DSP ARM_FEATURE_CORE (ARM_AEXT_V8M_MAIN_DSP, \
ARM_AEXT2_V8M_MAIN_DSP)
+#define ARM_ARCH_V8R ARM_FEATURE_CORE (ARM_AEXT_V8R, ARM_AEXT2_V8R)
/* Some useful combinations: */
#define ARM_ARCH_NONE ARM_FEATURE_LOW (0, 0)
#define FPU_NONE ARM_FEATURE_LOW (0, 0)
#define ARM_ANY ARM_FEATURE (-1, -1, 0) /* Any basic core. */
+#define FPU_ANY ARM_FEATURE_COPROC (-1) /* Any FPU. */
#define ARM_FEATURE_ALL ARM_FEATURE (-1, -1, -1)/* All CPU and FPU features. */
#define FPU_ANY_HARD ARM_FEATURE_COPROC (FPU_FPA | FPU_VFP_HARD | FPU_MAVERICK)
/* Extensions containing some Thumb-2 instructions. If any is present, Thumb
diff --git a/ld/ChangeLog b/ld/ChangeLog
index da03e3a..b92a82b 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,543 @@
+2017-06-26 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/ld-mips-elf/lsi-4010-isa.d: New test.
+ * ld/testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
+
+2017-06-26 Maciej W. Rozycki <macro@imgtec.com>
+
+ * testsuite/ld-elf/sizeofa.d: Also accept the OBJECT type for
+ the symbols examined.
+ * testsuite/ld-elf/sizeofc.d: Likewise.
+ * testsuite/ld-elf/startofa.d: Likewise.
+ * testsuite/ld-elf/startofc.d: Likewise.
+
+2017-06-26 Alan Modra <amodra@gmail.com>
+
+ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Skip
+ --just-syms bfds when looking for a place to attach .note.gnu.build-id
+ and .eh_frame_hdr sections. Delete dead code.
+
+2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com>
+
+ * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 11): New test.
+ (EABI attribute merging 12): Likewise.
+ * testsuite/ld-arm/attr-merge-11a.s: New file.
+ * testsuite/ld-arm/attr-merge-11b.s: New file.
+ * testsuite/ld-arm/attr-merge-11.attr: New file.
+ * testsuite/ld-arm/attr-merge-12a.s: New file.
+ * testsuite/ld-arm/attr-merge-12b.s: New file.
+ * testsuite/ld-arm/attr-merge-12.attr: New file.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-i386/i386.exp: Run weakundef1 tests.
+ * testsuite/ld-i386/weakundef1.c: New file.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21090
+ * testsuite/ld-elfvsb/elfvsb.exp (visibility_run): Pass
+ $NOPIE_CFLAGS if non-PIE is required.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21090
+ * testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and
+ $NOPIE_LDFLAGS to "Run pr19031".
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21090
+ * testsuite/ld-gc/gc.exp: Compile tmpdir/pr14265.o with
+ $NOPIE_CFLAGS.
+ * testsuite/ld-i386/i386.exp: Pass $NOPIE_CFLAGS and
+ $NOPIE_LDFLAGS if non-PIE is required.
+ * testsuite/ld-i386/no-plt.exp (NOPIE_CFLAGS): New.
+ (NOPIE_LDFLAGS): Likewise.
+ Pass $NOPIE_LDFLAGS if non-PIE is required.
+ * testsuite/ld-shared/shared.exp: Compile tmpdir/sh1np.o with
+ $NOPIE_CFLAGS.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * NEWS: Mention -z shstk and GNU_PROPERTY_X86_FEATURE_1_SHSTK.
+ * emulparams/cet.sh (PARSE_AND_LIST_OPTIONS_CET): Add "-z shstk".
+ (PARSE_AND_LIST_ARGS_CASE_Z_CET): Support "-z shstk".
+ * ld.texinfo: Document -z shstk.
+ * testsuite/ld-i386/i386.exp: Run SHSTK tests.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+ * testsuite/ld-i386/property-x86-shstk.s: New file.
+ * testsuite/ld-i386/property-x86-shstk1a.d: Likewise.
+ * testsuite/ld-i386/property-x86-shstk1b.d: Likewise.
+ * testsuite/ld-i386/property-x86-shstk2.d: Likewise.
+ * testsuite/ld-i386/property-x86-shstk3a.d: Likewise.
+ * testsuite/ld-i386/property-x86-shstk3b.d: Likewise.
+ * testsuite/ld-i386/property-x86-shstk4.d: Likewise.
+ * testsuite/ld-i386/property-x86-shstk5.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk.s: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk1a-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk1a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk1b-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk1b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk2-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk2.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk4-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk4.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk5-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-shstk5.d: Likewise.
+
+2017-06-22 H.J. Lu <hongjiu.lu@intel.com>
+
+ * Makefile.am (ELF_X86_DEPS): Add $(srcdir)/emulparams/cet.sh.
+ * Makefile.in: Regenerated.
+ * NEWS: Mention GNU_PROPERTY_X86_FEATURE_1_IBT, -z ibtplt
+ and -z ibt.
+ * emulparams/cet.sh: New file.
+ * testsuite/ld-i386/ibt-plt-1.d: Likewise.
+ * testsuite/ld-i386/ibt-plt-1.s: Likewise.
+ * testsuite/ld-i386/ibt-plt-2.s: Likewise.
+ * testsuite/ld-i386/ibt-plt-2a.d: Likewise.
+ * testsuite/ld-i386/ibt-plt-2b.d: Likewise.
+ * testsuite/ld-i386/ibt-plt-2c.d: Likewise.
+ * testsuite/ld-i386/ibt-plt-2d.d: Likewise.
+ * testsuite/ld-i386/ibt-plt-3.s: Likewise.
+ * testsuite/ld-i386/ibt-plt-3a.d: Likewise.
+ * testsuite/ld-i386/ibt-plt-3b.d: Likewise.
+ * testsuite/ld-i386/ibt-plt-3c.d: Likewise.
+ * testsuite/ld-i386/ibt-plt-3d.d: Likewise.
+ * testsuite/ld-i386/plt-main-ibt.dd: Likewise.
+ * testsuite/ld-i386/plt-pie-ibt.dd: Likewise.
+ * testsuite/ld-i386/property-x86-empty.s: Likewise.
+ * testsuite/ld-i386/property-x86-ibt.s: Likewise.
+ * testsuite/ld-i386/property-x86-ibt1a.d: Likewise.
+ * testsuite/ld-i386/property-x86-ibt1b.d: Likewise.
+ * testsuite/ld-i386/property-x86-ibt2.d: Likewise.
+ * testsuite/ld-i386/property-x86-ibt3a.d: Likewise.
+ * testsuite/ld-i386/property-x86-ibt3b.d: Likewise.
+ * testsuite/ld-i386/property-x86-ibt4.d: Likewise.
+ * testsuite/ld-i386/property-x86-ibt5.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-1.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-1.s: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2.s: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2b-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2b.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-2d.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3.s: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3b-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3b.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
+ * testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
+ * testsuite/ld-x86-64/plt-main-ibt-now.rd: Likewise.
+ * testsuite/ld-x86-64/plt-main-ibt-x32.dd: Likewise.
+ * testsuite/ld-x86-64/plt-main-ibt.dd: Likewise.
+ * testsuite/ld-x86-64/property-x86-empty.s: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt.s: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt1b-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt1b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt2-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt2.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt4-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt4.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt5-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-ibt5.d: Likewise.
+ * emulparams/elf32_x86_64.sh: Source emulparams/cet.sh.
+ (TINY_READONLY_SECTION): Add .plt.sec.
+ * emulparams/elf_i386.sh: Likewise.
+ * emulparams/elf_x86_64.sh: Source emulparams/cet.sh.
+ * ld.texinfo: Document -z ibtplt and -z ibt.
+ * testsuite/ld-i386/i386.exp: Run IBT and IBT PLT tests.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+ * testsuite/ld-x86-64/pr21481b.S (check): Updated for x32.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21090
+ * testsuite/ld-elf/shared.exp: Pass $NOPIE_CFLAGS and
+ $NOPIE_LDFLAGS if non-PIE is required.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21090
+ * testsuite/ld-scripts/crossref.exp: Also pass $NOPIE_CFLAGS
+ to CC.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21090
+ * testsuite/ld-size/size.exp: Pass $NOPIE_LDFLAGS to size-4a,
+ size-4b, size-5a, size-5b, size-6 and size-8 tests.
+ * testsuite/ld-srec/srec.exp (NOPIE_CFLAGS): New.
+ (NOPIE_LDFLAGS): Likewise.
+ (CC): Add $NOPIE_CFLAGS $NOPIE_LDFLAGS.
+ (CXX): Likewise.
+ * testsuite/ld-x86-64/no-plt.exp (NOPIE_CFLAGS): New.
+ (NOPIE_LDFLAGS): Likewise.
+ Pass $NOPIE_LDFLAGS to "No PLT (dynamic 1a)",
+ "No PLT (dynamic 1c)" and "Run pr20253-2f".
+ * testsuite/ld-x86-64/x86-64.exp: Pass $NOPIE_LDFLAGS to
+ "Build gotpcrel1" and "Run pr19031".
+
+2017-06-21 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-powerpc/powerpc.exp: Run TOCSAVE tests.
+ * testsuite/ld-powerpc/tocsave1.s,
+ * testsuite/ld-powerpc/tocsave1a.d,
+ * testsuite/ld-powerpc/tocsave1s.d,
+ * testsuite/ld-powerpc/tocsave2.s,
+ * testsuite/ld-powerpc/tocsave2a.d,
+ * testsuite/ld-powerpc/tocsave2s.d,
+ * testsuite/ld-powerpc/tocsavelib.s: New files.
+
+2017-06-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
+
+ * Makefile.in: Add s390.em as build dependency.
+ * emulparams/elf64_s390.sh (EXTRA_EM_FILE): Add s390.em.
+ * emultempl/s390.em: New file.
+ * gen-doc.texi: Add documentation for --s390-pgste option.
+ * ld.texinfo: Likewise.
+
+2017-06-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21626
+ * testsuite/ld-i386/i386.exp: Run ld/21626 tests.
+ * testsuite/ld-x86-64/x86-64.exp: Likewise.
+
+2017-06-18 Alan Modra <amodra@gmail.com>
+
+ * testsuite/lib/ld-lib.exp (is_underscore_target): New.
+ * testsuite/ld-elf/elf.exp (ASFLAGS): Define UNDERSCORE.
+ * testsuite/ld-elf/pr21562a.s: If UNDERSCORE defined,
+ reference sym with prefix.
+ * testsuite/ld-elf/pr21562b.s: Likewise.
+ * testsuite/ld-elf/sizeof.s: Likewise.
+ * testsuite/ld-elf/startof.s: Likewise.
+ * testsuite/ld-elf/pr14156a.d: Adjust for extra symbols.
+ * testsuite/ld-elf/pr21562a.d: Remove underscore target from
+ xfails, and match prefixed symbol.
+ * testsuite/ld-elf/pr21562b.d: Likewise.
+ * testsuite/ld-elf/pr21562c.d: Likewise.
+ * testsuite/ld-elf/pr21562d.d: Likewise.
+ * testsuite/ld-elf/pr21562e.d: Likewise.
+ * testsuite/ld-elf/pr21562f.d: Likewise.
+ * testsuite/ld-elf/pr21562g.d: Likewise.
+ * testsuite/ld-elf/pr21562h.d: Likewise.
+ * testsuite/ld-elf/pr21562i.d: Likewise.
+ * testsuite/ld-elf/pr21562j.d: Likewise.
+ * testsuite/ld-elf/pr21562k.d: Likewise.
+ * testsuite/ld-elf/pr21562l.d: Likewise.
+ * testsuite/ld-elf/pr21562m.d: Likewise.
+ * testsuite/ld-elf/pr21562n.d: Likewise.
+ * testsuite/ld-elf/sizeofa.d: Likewise.
+ * testsuite/ld-elf/sizeofb.d: Likewise.
+ * testsuite/ld-elf/sizeofc.d: Likewise.
+ * testsuite/ld-elf/startofa.d: Likewise.
+ * testsuite/ld-elf/startofb.d: Likewise.
+ * testsuite/ld-elf/startofc.d: Likewise.
+
+2017-06-16 Alan Modra <amodra@gmail.com>
+
+ PR ld/20022
+ PR ld/21557
+ PR ld/21562
+ PR ld/21571
+ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't set
+ __start/__stop syms here.
+ * ldlang.c (lang_set_startof): Delete.
+ (start_stop_syms, start_stop_count, start_stop_alloc): New vars.
+ (lang_define_start_stop, lang_init_start_stop, foreach_start_stop,
+ undef_start_stop, lang_undef_start_stop, lang_init_startof_sizeof,
+ set_start_stop, lang_finalize_start_stop): New functions.
+ (lang_process): Call _start_stop functions.
+ * testsuite/ld-elf/pr21562a.d: Use xfail rather than notarget.
+ Correct typos and list of xfail targets.
+ * testsuite/ld-elf/pr21562b.d: Likewise.
+ * testsuite/ld-elf/pr21562c.d: Likewise.
+ * testsuite/ld-elf/pr21562d.d: Likewise.
+ * testsuite/ld-elf/pr21562e.d: Likewise.
+ * testsuite/ld-elf/pr21562f.d: Likewise.
+ * testsuite/ld-elf/pr21562g.d: Likewise.
+ * testsuite/ld-elf/pr21562h.d: Likewise.
+ * testsuite/ld-elf/pr21562i.d: Likewise.
+ * testsuite/ld-elf/pr21562j.d: Likewise.
+ * testsuite/ld-elf/pr21562k.d: Likewise.
+ * testsuite/ld-elf/pr21562l.d: Likewise.
+ * testsuite/ld-elf/pr21562m.d: Likewise.
+ * testsuite/ld-elf/pr21562n.d: Likewise.
+ * testsuite/ld-elf/sizeofa.d: Likewise. Adjust to pass for generic ELF.
+ * testsuite/ld-elf/sizeofb.d: Likewise.
+ * testsuite/ld-elf/startofa.d: Likewise.
+ * testsuite/ld-elf/startofb.d: Likewise.
+
+2017-06-16 Jiong Wang <jiong.wang@arm.com>
+
+ * testsuite/ld-aarch64/aarch64-elf.exp: Update test name
+ * testsuite/ld-aarch64/pcrel.s: Add new testcases.
+ * testsuite/ld-aarch64/pcrel_pic_undefined.d: Update the expected
+ warnings.
+ * testsuite/ld-aarch64/pcrel_pic_defined_local.d: Rename ...
+ * testsuite/ld-aarch64/pcrel_pic_defined.d: ... to this.
+ Update expected warnings.
+
+2017-06-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ * exsup.c (elf_shlib_list_options): Display "-z stack-size=SIZE"
+ instead of "-z stacksize=SIZE".
+
+2017-06-15 Jiong Wang <jiong.wang@arm.com>
+
+ * testsuite/ld-aarch64/copy-reloc-exe-2.s: New test source file.
+ * testsuite/ld-aarch64/copy-reloc-2.d: New test.
+ * testsuite/ld-aarch64/copy-reloc-exe-eliminate.s: New test source file.
+ * testsuite/ld-aarch64/copy-reloc-eliminate.d: New test.
+ * testsuite/ld-aarch64/copy-reloc-so.s: Define new global objects.
+ * testsuite/ld-aarch64/aarch64-elf.exp: Run new tests.
+
+2017-06-14 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21580
+ * testsuite/ld-nds32/diff.d: Adjust expected output.
+
+2017-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/20022
+ * testsuite/ld-gc/pr20022.d: Skip on targets without dynamic
+ relocations in .text section.
+
+2017-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-elf/pr21562a.d: Skip on targets with leading char
+ in in symbol name or without --gc-sections.
+ * testsuite/ld-elf/pr21562b.d: Likewise.
+ * testsuite/ld-elf/pr21562c.d: Likewise.
+ * testsuite/ld-elf/pr21562d.d: Likewise.
+ * testsuite/ld-elf/pr21562i.d: Likewise.
+ * testsuite/ld-elf/pr21562j.d: Likewise.
+ * testsuite/ld-elf/pr21562k.d: Likewise.
+ * testsuite/ld-elf/pr21562l.d: Likewise.
+ * testsuite/ld-elf/pr21562m.d: Likewise.
+ * testsuite/ld-elf/pr21562n.d: Likewise.
+ * testsuite/ld-elf/pr21562e.d: Skip on targets with leading char
+ in symbol name.
+ * testsuite/ld-elf/pr21562f.d: Likewise.
+ * testsuite/ld-elf/pr21562g.d: Likewise.
+ * testsuite/ld-elf/pr21562h.d: Likewise.
+
+2017-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-gc/pr20022a.s: Add size to bar.
+
+2017-06-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-elf/sizeofa.d: Skip on targets with leading char
+ in symbol name.
+ * testsuite/ld-elf/sizeofb.d: Likewise.
+ * testsuite/ld-elf/startofa.d: Likewise.
+ * testsuite/ld-elf/startofb.d: Likewise.
+
+2017-06-14 Georg-Johann Lay <gjl@gcc.gnu.org>
+
+ PR ld/21583
+ * scripttempl/avr.sc (.jumptables): Move down in text section.
+ (.hightext): New in text.
+
+2017-06-14 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * configure.tgt (epiphany-*-elf): Accept epiphany-*-*.
+
+2017-06-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * ldlang.c (lang_set_startof): Skip if config.build_constructors
+ is FALSE.
+ * testsuite/ld-elf/sizeofc.d: New file.
+ * testsuite/ld-elf/startofc.d: Likewise.
+
+2017-06-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-elf/sizeof.d: Renamed to ...
+ * testsuite/ld-elf/sizeofa.d: This. Updated.
+ * testsuite/ld-elf/startof.d: Renamed to ...
+ * testsuite/ld-elf/startofa.d: This. Updated.
+ * testsuite/ld-elf/sizeofb.d: New file.
+ * testsuite/ld-elf/startofb.d: Likewise.
+
+2017-06-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/20022
+ PR ld/21557
+ PR ld/21562
+ PR ld/21571
+ * ld.texinfo: Update __start_SECNAME/__stop_SECNAME symbols.
+ * ldlang.c (lang_insert_orphan): Move handling of __start_SECNAME
+ and __stop_SECNAME symbols to ...
+ (lang_set_startof): Here. Also define __start_SECNAME and
+ __stop_SECNAME for -Ur.
+ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Mark
+ referenced __start_SECNAME and __stop_SECNAME symbols as hidden
+ and set start_stop for garbage collection.
+ * testsuite/ld-elf/pr21562a.d: New file.
+ * testsuite/ld-elf/pr21562a.s: Likewise.
+ * testsuite/ld-elf/pr21562a.t: Likewise.
+ * testsuite/ld-elf/pr21562b.d: Likewise.
+ * testsuite/ld-elf/pr21562b.s: Likewise.
+ * testsuite/ld-elf/pr21562b.t: Likewise.
+ * testsuite/ld-elf/pr21562c.d: Likewise.
+ * testsuite/ld-elf/pr21562c.t: Likewise.
+ * testsuite/ld-elf/pr21562d.d: Likewise.
+ * testsuite/ld-elf/pr21562d.t: Likewise.
+ * testsuite/ld-elf/pr21562e.d: Likewise.
+ * testsuite/ld-elf/pr21562f.d: Likewise.
+ * testsuite/ld-elf/pr21562g.d: Likewise.
+ * testsuite/ld-elf/pr21562h.d: Likewise.
+ * testsuite/ld-elf/pr21562i.d: Likewise.
+ * testsuite/ld-elf/pr21562j.d: Likewise.
+ * testsuite/ld-elf/pr21562k.d: Likewise.
+ * testsuite/ld-elf/pr21562l.d: Likewise.
+ * testsuite/ld-elf/pr21562m.d: Likewise.
+ * testsuite/ld-elf/pr21562n.d: Likewise.
+ * testsuite/ld-gc/pr20022.d: Likewise.
+ * testsuite/ld-gc/pr20022a.s: Likewise.
+ * testsuite/ld-gc/pr20022b.s: Likewise.
+ * testsuite/ld-gc/gc.exp: Run PR ld/20022 tests.
+ * testsuite/ld-gc/pr19161.d: Also accept local __start_SECNAME
+ symbol.
+ * testsuite/ld-gc/start.d: Likewise.
+ * testsuite/ld-x86-64/lea1a.d: Updated.
+ * testsuite/ld-x86-64/lea1b.d: Updated.
+ * testsuite/ld-x86-64/lea1d.d: Updated.
+ * testsuite/ld-x86-64/lea1e.d: Likewise.
+
+2017-06-13 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-elf/sizeof.d: New file.
+ * testsuite/ld-elf/sizeof.s: Likewise.
+ * testsuite/ld-elf/startof.d: Likewise.
+ * testsuite/ld-elf/startof.s: Likewise.
+
+2017-06-13 Renlin Li <renlin.li@arm.com>
+
+ * testsuite/ld-elf/shared.exp (build_tests): Add --no-dynamic-linker
+ option to rdynamic-1 and dynamic-1 tests.
+
+2017-06-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-x86-64/property-x86-3-x32.d: New file.
+ * testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-4b-x32.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-3.d: Also pass
+ -defsym __64_bit__=1 to asssembler.
+ * testsuite/ld-x86-64/property-x86-4a.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-4b.d: Likewise.
+ * testsuite/ld-x86-64/property-x86-3.s: Align to 4 bytes if
+ __64_bit__ isn't defined.
+ * testsuite/ld-x86-64/property-x86-4a.s: Likewise.
+ * testsuite/ld-x86-64/property-x86-4b.s: Likewise.
+ * testsuite/ld-x86-64/x86-64.exp: Run property-x86-3-x32,
+ property-x86-4a-x32 and property-x86-4b-x32.
+
+2017-06-08 Cupertino Miranda <cmiranda@synopsys.com>
+
+ * testsuite/ld-arc/tls_ie-01.d: Changed expected result.
+
+2017-06-08 H.J. Lu <hongjiu.lu@intel.com>
+
+ * testsuite/ld-ifunc/ifunc-1-local-x86.d: Pass
+ "-Map tmpdir/ifunc-1-local-x86.map" to ld and check
+ ifunc-1-local-x86.map.
+ * testsuite/ld-ifunc/ifunc-1-x86.d: Pass
+ "-Map tmpdir/ifunc-1-x86.map" to ld and check ifunc-1-x86.map.
+ * testsuite/ld-ifunc/ifunc-1-local-x86.map: New file.
+ * testsuite/ld-ifunc/ifunc-1-x86.map: Likewise.
+
+2017-06-07 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-unique/pr21529.d: xfail aarch64, arm, hppa, ia64,
+ nds32, and score. Match any output.
+
+2017-06-06 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ld.h (struct args_type): Fix typo in comment.
+
+2017-06-06 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ld.h (struct args_type): Add force_group_allocation field.
+ * ldgram.y: Add support for FORCE_GROUP_ALLOCATION.
+ * ldlex.h: Likewise.
+ * ldlex.l: Likewise.
+ * lexsup.c: Likewise.
+ * ldlang.c (unique_section_p): Check resolve_section_groups flag
+ not the relaxable link flag.
+ (lang_add_section): Discard section groups when we're resolving
+ groups. Clear the SEC_LINK_ONCE flag if we're resolving section
+ groups.
+ * ldmain.c (main): Initialise resolve_section_groups flag in
+ link_info based on command line flags.
+ * testsuite/ld-elf/group11.d: New file.
+ * testsuite/ld-elf/group12.d: New file.
+ * testsuite/ld-elf/group12.ld: New file.
+ * NEWS: Mention new features.
+ * ld.texinfo (Options): Document --force-group-allocation.
+ (Miscellaneous Commands): Document FORCE_GROUP_ALLOCATION.
+
+2017-06-05 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21529
+ * testsuite/ld-unique/pr21529.d: New file.
+ * testsuite/ld-unique/pr21529.s: Likewise.
+ * testsuite/ld-unique/unique.exp: Run *.d.
+
+2017-06-05 Alan Modra <amodra@gmail.com>
+
+ * ldmain.c (main): Correct setting of link_indo.new_dtags.
+ * testsuite/ld-elf/now-3.d: Pass --disable-new-dtags to ld
+ * testsuite/ld-elf/now-4.d: Likewise.
+ * testsuite/ld-elf/rpath-1.d: Likewise.
+ * testsuite/ld-elf/rpath-2.d: Likewise.
+
+2017-06-05 Slava Barinov <v.barinov@samsung.com>
+
+ * configure.ac: Add --enable-new-dtags option.
+ * ldmain.c (main): Set link_info.new_dtags to 1 if when
+ --enable-new-dtags is switched on.
+ * configure: Regenerate.
+ * config.in: Regenerate.
+
+2017-06-02 H.J. Lu <hongjiu.lu@intel.com>
+
+ * emulparams/call_nop.sh: Remove -z prefix-nop.
+ * ld.texinfo: Likewise.
+ * testsuite/ld-i386/call3c.d: Check for linker error.
+ * testsuite/ld-x86-64/call1c.d: Likewise.
+
+2017-06-01 Alan Modra <amodra@gmail.com>
+
+ * emultempl/ppc64elf.em (params): Init plt_localentry0 field.
+ (enum ppc64_opt): New, replacing OPTION_* defines. Add
+ OPTION_PLT_LOCALENTRY, and OPTION_NO_PLT_LOCALENTRY.
+ (PARSE_AND_LIST_*): Support --plt-localentry and --no-plt-localentry.
+ * testsuite/ld-powerpc/elfv2so.d: Update.
+ * testsuite/ld-powerpc/powerpc.exp (TLS opt 5): Use --no-plt-localentry.
+ * testsuite/ld-powerpc/tlsopt5.d: Update.
+
2017-05-31 Alan Modra <amodra@gmail.com>
* emultempl/ppc64elf.em (plt-static-chain help): Fix quoting.
@@ -787,9 +1327,9 @@
2017-02-27 Georg-Johann Lay <gjl@gcc.gnu.org>
PR target/20849
- * scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
- (.rodata): New section.
- (.data): Remove .rodata*.
+ * scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
+ (.rodata): New section.
+ (.data): Remove .rodata*.
2017-02-25 Alan Modra <amodra@gmail.com>
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 3aa7e80..fcd4c36 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -677,7 +677,8 @@ ELF_X86_DEPS = $(ELF_DEPS) $(srcdir)/emulparams/plt_unwind.sh \
$(srcdir)/emulparams/extern_protected_data.sh \
$(srcdir)/emulparams/dynamic_undefined_weak.sh \
$(srcdir)/emulparams/reloc_overflow.sh \
- $(srcdir)/emulparams/call_nop.sh
+ $(srcdir)/emulparams/call_nop.sh \
+ $(srcdir)/emulparams/cet.sh
@TDIRS@
@@ -922,7 +923,7 @@ eavrxmega7.c: $(srcdir)/emulparams/avrxmega7.sh \
${GEN_DEPENDS}
eavrtiny.c: $(srcdir)/emulparams/avrtiny.sh \
- $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avrtiny.sc \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
${GEN_DEPENDS}
ecoff_i860.c: $(srcdir)/emulparams/coff_i860.sh \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index f485f4f..ba25177 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -932,7 +932,8 @@ ELF_X86_DEPS = $(ELF_DEPS) $(srcdir)/emulparams/plt_unwind.sh \
$(srcdir)/emulparams/extern_protected_data.sh \
$(srcdir)/emulparams/dynamic_undefined_weak.sh \
$(srcdir)/emulparams/reloc_overflow.sh \
- $(srcdir)/emulparams/call_nop.sh
+ $(srcdir)/emulparams/call_nop.sh \
+ $(srcdir)/emulparams/cet.sh
# We need this for automake to use YLWRAP.
@@ -2486,7 +2487,7 @@ eavrxmega7.c: $(srcdir)/emulparams/avrxmega7.sh \
${GEN_DEPENDS}
eavrtiny.c: $(srcdir)/emulparams/avrtiny.sh \
- $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avrtiny.sc \
+ $(srcdir)/emultempl/avrelf.em $(ELF_DEPS) $(srcdir)/scripttempl/avr.sc \
${GEN_DEPENDS}
ecoff_i860.c: $(srcdir)/emulparams/coff_i860.sh \
@@ -3501,6 +3502,7 @@ eelf64_ia64_vms.c: $(srcdir)/emulparams/elf64_ia64_vms.sh \
$(srcdir)/scripttempl/ia64vms.sc ${GEN_DEPENDS}
eelf64_s390.c: $(srcdir)/emulparams/elf64_s390.sh \
+ $(srcdir)/emultempl/s390.em \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
eelf64_sparc.c: $(srcdir)/emulparams/elf64_sparc.sh \
diff --git a/ld/NEWS b/ld/NEWS
index 52daa6b..e9ef713 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,21 @@
-*- text -*-
+* Support for -z shstk in the x86 ELF linker to generate
+ GNU_PROPERTY_X86_FEATURE_1_SHSTK in ELF GNU program properties.
+
+* Add support for GNU_PROPERTY_X86_FEATURE_1_SHSTK in ELF GNU program
+ properties in the x86 ELF linker.
+
+* Add support for GNU_PROPERTY_X86_FEATURE_1_IBT in ELF GNU program
+ properties in the x86 ELF linker.
+
+* Support for -z ibtplt in the x86 ELF linker to generate IBT-enabled
+ PLT.
+
+* Support for -z ibt in the x86 ELF linker to generate IBT-enabled
+ PLT as well as GNU_PROPERTY_X86_FEATURE_1_IBT in ELF GNU program
+ properties.
+
* Add support for ELF SHF_GNU_MBIND and PT_GNU_MBIND_XXX.
* Add support for ELF GNU program properties.
@@ -15,6 +31,11 @@
* Orphan sections placed after an empty section that has an AT(LMA) will now
take an load memory address starting from LMA.
+* Section groups can now be resolved (the group deleted and the group members
+ placed like normal sections) at partial link time either using the new linker
+ option --force-group-allocation or by placing FORCE_GROUP_ALLOCATION into the
+ linker script.
+
Changes in 2.28:
* The EXCLUDE_FILE linker script construct can now be applied outside of the
diff --git a/ld/config.in b/ld/config.in
index 2c6d698..5d91380 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -13,6 +13,10 @@
/* Define to 1 if you want to enable -z relro in ELF linker by default. */
#undef DEFAULT_LD_Z_RELRO
+/* Define to 1 if you want to set DT_RUNPATH instead of DT_RPATH by default.
+ */
+#undef DEFAULT_NEW_DTAGS
+
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
diff --git a/ld/configure b/ld/configure
index dd94301..919fbc2 100755
--- a/ld/configure
+++ b/ld/configure
@@ -788,6 +788,7 @@ with_sysroot
enable_gold
enable_got
enable_compressed_debug_sections
+enable_new_dtags
enable_relro
enable_werror
enable_build_warnings
@@ -1447,6 +1448,7 @@ Optional Features:
multigot)
--enable-compressed-debug-sections={all,ld,none}
compress debug sections by default]
+ --enable-new-dtags set DT_RUNPATH instead of DT_RPATH by default]
--enable-relro enable -z relro in ELF linker by default
--enable-werror treat compile warnings as errors
--enable-build-warnings enable build-time compiler warnings
@@ -11720,7 +11722,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11723 "configure"
+#line 11725 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11826,7 +11828,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11829 "configure"
+#line 11831 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15540,6 +15542,17 @@ if test "${enable_compressed_debug_sections+set}" = set; then :
esac
fi
+# Decide setting DT_RUNPATH instead of DT_RPATH by default
+ac_default_new_dtags=unset
+# Provide a configure time option to override our default.
+# Check whether --enable-new_dtags was given.
+if test "${enable_new_dtags+set}" = set; then :
+ enableval=$enable_new_dtags; case "${enableval}" in
+ yes) ac_default_new_dtags=1 ;;
+ no) ac_default_new_dtags=0 ;;
+esac
+fi
+
# Decide if -z relro should be enabled in ELF linker by default.
ac_default_ld_z_relro=unset
# Provide a configure time option to override our default.
@@ -17196,6 +17209,15 @@ $as_echo "#define DEFAULT_FLAG_COMPRESS_DEBUG 1" >>confdefs.h
fi
+if test "${ac_default_new_dtags}" = unset; then
+ ac_default_new_dtags=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_NEW_DTAGS $ac_default_new_dtags
+_ACEOF
+
+
if test "${ac_default_ld_z_relro}" = unset; then
ac_default_ld_z_relro=0
fi
diff --git a/ld/configure.ac b/ld/configure.ac
index f3a7f54..4e2dc86 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -155,6 +155,17 @@ AC_ARG_ENABLE(compressed_debug_sections,
,no, | ,none,) ac_default_compressed_debug_sections=no ;;
esac])dnl
+# Decide setting DT_RUNPATH instead of DT_RPATH by default
+ac_default_new_dtags=unset
+# Provide a configure time option to override our default.
+AC_ARG_ENABLE(new_dtags,
+ AS_HELP_STRING([--enable-new-dtags],
+ [set DT_RUNPATH instead of DT_RPATH by default])],
+[case "${enableval}" in
+ yes) ac_default_new_dtags=1 ;;
+ no) ac_default_new_dtags=0 ;;
+esac])dnl
+
# Decide if -z relro should be enabled in ELF linker by default.
ac_default_ld_z_relro=unset
# Provide a configure time option to override our default.
@@ -383,6 +394,13 @@ if test x$ac_default_compressed_debug_sections = xyes ; then
AC_DEFINE(DEFAULT_FLAG_COMPRESS_DEBUG, 1, [Define if you want compressed debug sections by default.])
fi
+if test "${ac_default_new_dtags}" = unset; then
+ ac_default_new_dtags=0
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_NEW_DTAGS,
+ $ac_default_new_dtags,
+ [Define to 1 if you want to set DT_RUNPATH instead of DT_RPATH by default.])
+
if test "${ac_default_ld_z_relro}" = unset; then
ac_default_ld_z_relro=0
fi
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 1b981d4..47c719c 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -206,7 +206,7 @@ d30v-*-*) targ_emul=d30velf; targ_extra_emuls="d30v_e d30v_o"
;;
dlx-*-elf*) targ_emul=elf32_dlx
;;
-epiphany-*-elf) targ_emul=elf32epiphany
+epiphany-*-*) targ_emul=elf32epiphany
targ_extra_emuls="elf32epiphany_4x4"
;;
fido*-*-elf*) targ_emul=m68kelf ;;
diff --git a/ld/emulparams/avr1.sh b/ld/emulparams/avr1.sh
index 2f6af99..0fa6eed 100644
--- a/ld/emulparams/avr1.sh
+++ b/ld/emulparams/avr1.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=8K
DATA_ORIGIN=0x800060
DATA_LENGTH=0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr2.sh b/ld/emulparams/avr2.sh
index cb35bb9..e0bdc21a 100644
--- a/ld/emulparams/avr2.sh
+++ b/ld/emulparams/avr2.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=8K
DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr25.sh b/ld/emulparams/avr25.sh
index 2965347..4a6e0a3 100644
--- a/ld/emulparams/avr25.sh
+++ b/ld/emulparams/avr25.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=8K
DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr3.sh b/ld/emulparams/avr3.sh
index a0b86c4..f02dd39 100644
--- a/ld/emulparams/avr3.sh
+++ b/ld/emulparams/avr3.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=128K
DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr31.sh b/ld/emulparams/avr31.sh
index 6e1ee0a..0bf3c0f 100644
--- a/ld/emulparams/avr31.sh
+++ b/ld/emulparams/avr31.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=128K
DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr35.sh b/ld/emulparams/avr35.sh
index abc6790..fe83dc8 100644
--- a/ld/emulparams/avr35.sh
+++ b/ld/emulparams/avr35.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=64K
DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr4.sh b/ld/emulparams/avr4.sh
index deaf3e7..ccda23f 100644
--- a/ld/emulparams/avr4.sh
+++ b/ld/emulparams/avr4.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=8K
DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr5.sh b/ld/emulparams/avr5.sh
index 2d0fc4f..64e9d66 100644
--- a/ld/emulparams/avr5.sh
+++ b/ld/emulparams/avr5.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=128K
DATA_ORIGIN=0x800060
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr51.sh b/ld/emulparams/avr51.sh
index 2069dfe..b097771 100644
--- a/ld/emulparams/avr51.sh
+++ b/ld/emulparams/avr51.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=128K
DATA_ORIGIN=0x800100
DATA_LENGTH=0xff00
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avr6.sh b/ld/emulparams/avr6.sh
index c1a4fab..10efa6f 100644
--- a/ld/emulparams/avr6.sh
+++ b/ld/emulparams/avr6.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=1024K
DATA_ORIGIN=0x800200
DATA_LENGTH=0xfe00
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avrtiny.sh b/ld/emulparams/avrtiny.sh
index b4ed14b..4aca22b 100644
--- a/ld/emulparams/avrtiny.sh
+++ b/ld/emulparams/avrtiny.sh
@@ -1,13 +1,19 @@
ARCH=avr:100
MACHINE=
-SCRIPT_NAME=avrtiny
+SCRIPT_NAME=avr
OUTPUT_FORMAT="elf32-avr"
MAXPAGESIZE=1
EMBEDDED=yes
TEMPLATE_NAME=elf32
-TEXT_ORIGIN=0x0
TEXT_LENGTH=4K
DATA_ORIGIN=0x0800040
DATA_LENGTH=0x100
+RODATA_PM_OFFSET=0x4000
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=config
+
+FUSE_LENGTH=2
+LOCK_LENGTH=2
+SIGNATURE_LENGTH=4
diff --git a/ld/emulparams/avrxmega1.sh b/ld/emulparams/avrxmega1.sh
index 95e8aac..722ee18 100644
--- a/ld/emulparams/avrxmega1.sh
+++ b/ld/emulparams/avrxmega1.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=1024K
DATA_ORIGIN=0x802000
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avrxmega2.sh b/ld/emulparams/avrxmega2.sh
index f282a69..d9211b2 100644
--- a/ld/emulparams/avrxmega2.sh
+++ b/ld/emulparams/avrxmega2.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=1024K
DATA_ORIGIN=0x802000
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avrxmega3.sh b/ld/emulparams/avrxmega3.sh
index 7c5a1e5..b33f895 100644
--- a/ld/emulparams/avrxmega3.sh
+++ b/ld/emulparams/avrxmega3.sh
@@ -11,3 +11,11 @@ DATA_ORIGIN=0x802000
DATA_LENGTH=0xffa0
RODATA_PM_OFFSET=0x8000
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avrxmega4.sh b/ld/emulparams/avrxmega4.sh
index 829c8b7..02ef7d7 100644
--- a/ld/emulparams/avrxmega4.sh
+++ b/ld/emulparams/avrxmega4.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=1024K
DATA_ORIGIN=0x802000
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avrxmega5.sh b/ld/emulparams/avrxmega5.sh
index 0a09aee..93b69da 100644
--- a/ld/emulparams/avrxmega5.sh
+++ b/ld/emulparams/avrxmega5.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=1024K
DATA_ORIGIN=0x802000
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avrxmega6.sh b/ld/emulparams/avrxmega6.sh
index 3c3a468..f7dae40 100644
--- a/ld/emulparams/avrxmega6.sh
+++ b/ld/emulparams/avrxmega6.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=1024K
DATA_ORIGIN=0x802000
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/avrxmega7.sh b/ld/emulparams/avrxmega7.sh
index b84a0ba..578f52a 100644
--- a/ld/emulparams/avrxmega7.sh
+++ b/ld/emulparams/avrxmega7.sh
@@ -10,3 +10,11 @@ TEXT_LENGTH=1024K
DATA_ORIGIN=0x802000
DATA_LENGTH=0xffa0
EXTRA_EM_FILE=avrelf
+
+FUSE_NAME=fuse
+
+EEPROM_LENGTH=64K
+FUSE_LENGTH=1K
+LOCK_LENGTH=1K
+SIGNATURE_LENGTH=1K
+USER_SIGNATURE_LENGTH=1K
diff --git a/ld/emulparams/call_nop.sh b/ld/emulparams/call_nop.sh
index fee4a81..d45806c 100644
--- a/ld/emulparams/call_nop.sh
+++ b/ld/emulparams/call_nop.sh
@@ -10,11 +10,6 @@ PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP='
link_info.call_nop_as_suffix = FALSE;
link_info.call_nop_byte = 0x67;
}
- else if (strcmp (optarg + 9, "prefix-nop") == 0)
- {
- link_info.call_nop_as_suffix = FALSE;
- link_info.call_nop_byte = 0x90;
- }
else if (strcmp (optarg + 9, "suffix-nop") == 0)
{
link_info.call_nop_as_suffix = TRUE;
diff --git a/ld/emulparams/cet.sh b/ld/emulparams/cet.sh
new file mode 100644
index 0000000..1973413
--- /dev/null
+++ b/ld/emulparams/cet.sh
@@ -0,0 +1,17 @@
+PARSE_AND_LIST_OPTIONS_CET='
+ fprintf (file, _("\
+ -z ibtplt Generate IBT-enabled PLT entries\n\
+ -z ibt Generate GNU_PROPERTY_X86_FEATURE_1_IBT\n\
+ -z shstk Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK\n"));
+'
+PARSE_AND_LIST_ARGS_CASE_Z_CET='
+ else if (strcmp (optarg, "ibtplt") == 0)
+ link_info.ibtplt = TRUE;
+ else if (strcmp (optarg, "ibt") == 0)
+ link_info.ibt = TRUE;
+ else if (strcmp (optarg, "shstk") == 0)
+ link_info.shstk = TRUE;
+'
+
+PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_CET"
+PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_CET"
diff --git a/ld/emulparams/elf32_x86_64.sh b/ld/emulparams/elf32_x86_64.sh
index 9b85239..06a0f3c 100644
--- a/ld/emulparams/elf32_x86_64.sh
+++ b/ld/emulparams/elf32_x86_64.sh
@@ -3,6 +3,7 @@
. ${srcdir}/emulparams/dynamic_undefined_weak.sh
. ${srcdir}/emulparams/reloc_overflow.sh
. ${srcdir}/emulparams/call_nop.sh
+. ${srcdir}/emulparams/cet.sh
SCRIPT_NAME=elf
ELFSIZE=32
OUTPUT_FORMAT="elf32-x86-64"
@@ -24,6 +25,7 @@ IREL_IN_PLT=
# Reuse TINY_READONLY_SECTION which is placed right after .plt section.
TINY_READONLY_SECTION="
.plt.got ${RELOCATING-0} : { *(.plt.got) }
+.plt.sec ${RELOCATING-0} : { *(.plt.sec) }
"
if [ "x${host}" = "x${target}" ]; then
diff --git a/ld/emulparams/elf64_s390.sh b/ld/emulparams/elf64_s390.sh
index fc9f06a..5309774 100644
--- a/ld/emulparams/elf64_s390.sh
+++ b/ld/emulparams/elf64_s390.sh
@@ -12,6 +12,7 @@ TEMPLATE_NAME=elf32
GENERATE_SHLIB_SCRIPT=yes
GENERATE_PIE_SCRIPT=yes
NO_SMALL_DATA=yes
+EXTRA_EM_FILE=s390
IREL_IN_PLT=
# Treat a host that matches the target with the possible exception of "x"
diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh
index b08e661..6997d40 100644
--- a/ld/emulparams/elf_i386.sh
+++ b/ld/emulparams/elf_i386.sh
@@ -2,6 +2,7 @@
. ${srcdir}/emulparams/extern_protected_data.sh
. ${srcdir}/emulparams/dynamic_undefined_weak.sh
. ${srcdir}/emulparams/call_nop.sh
+. ${srcdir}/emulparams/cet.sh
SCRIPT_NAME=elf
OUTPUT_FORMAT="elf32-i386"
CHECK_RELOCS_AFTER_OPEN_INPUT=yes
@@ -20,6 +21,7 @@ IREL_IN_PLT=
# Reuse TINY_READONLY_SECTION which is placed right after .plt section.
TINY_READONLY_SECTION="
.plt.got ${RELOCATING-0} : { *(.plt.got) }
+.plt.sec ${RELOCATING-0} : { *(.plt.sec) }
"
# Linux modify the default library search path to first include
diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh
index ca6d06c..ad25526 100644
--- a/ld/emulparams/elf_x86_64.sh
+++ b/ld/emulparams/elf_x86_64.sh
@@ -3,6 +3,7 @@
. ${srcdir}/emulparams/dynamic_undefined_weak.sh
. ${srcdir}/emulparams/reloc_overflow.sh
. ${srcdir}/emulparams/call_nop.sh
+. ${srcdir}/emulparams/cet.sh
SCRIPT_NAME=elf
ELFSIZE=64
OUTPUT_FORMAT="elf64-x86-64"
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 0260b7a..d2551b6 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1216,6 +1216,8 @@ gld${EMULATION_NAME}_after_open (void)
{
struct bfd_link_needed_list *needed, *l;
struct elf_link_hash_table *htab;
+ asection *s;
+ bfd *abfd;
after_open_default ();
@@ -1239,13 +1241,12 @@ gld${EMULATION_NAME}_after_open (void)
if (emit_note_gnu_build_id != NULL)
{
- bfd *abfd;
-
/* Find an ELF input. */
for (abfd = link_info.input_bfds;
abfd != (bfd *) NULL; abfd = abfd->link.next)
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
- && bfd_count_sections (abfd) != 0)
+ && bfd_count_sections (abfd) != 0
+ && !((lang_input_statement_type *) abfd->usrdata)->flags.just_syms)
break;
/* PR 10555: If there are no ELF input files do not try to
@@ -1278,14 +1279,17 @@ gld${EMULATION_NAME}_after_open (void)
if (!link_info.traditional_format)
{
- bfd *abfd, *elfbfd = NULL;
+ bfd *elfbfd = NULL;
bfd_boolean warn_eh_frame = FALSE;
- asection *s;
int seen_type = 0;
for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
{
int type = 0;
+
+ if (((lang_input_statement_type *) abfd->usrdata)->flags.just_syms)
+ continue;
+
for (s = abfd->sections; s && type < COMPACT_EH_HDR; s = s->next)
{
const char *name = bfd_get_section_name (abfd, s);
@@ -1324,9 +1328,6 @@ gld${EMULATION_NAME}_after_open (void)
if (seen_type == COMPACT_EH_HDR)
link_info.eh_frame_hdr_type = COMPACT_EH_HDR;
-
- if (bfd_count_sections (abfd) == 0)
- continue;
}
if (elfbfd)
{
diff --git a/ld/emultempl/ppc64elf.em b/ld/emultempl/ppc64elf.em
index f1d5274..58cb798 100644
--- a/ld/emultempl/ppc64elf.em
+++ b/ld/emultempl/ppc64elf.em
@@ -38,7 +38,7 @@ static struct ppc64_elf_params params = { NULL,
&ppc_layout_sections_again,
1, -1, 0,
${DEFAULT_PLT_STATIC_CHAIN-0}, -1, 0,
- 0, -1, -1, 0};
+ -1, 0, -1, -1, 0};
/* Fake input file for stubs. */
static lang_input_statement_type *stub_file;
@@ -683,27 +683,32 @@ fi
# parse_args and list_options functions.
#
PARSE_AND_LIST_PROLOGUE=${PARSE_AND_LIST_PROLOGUE}'
-#define OPTION_STUBGROUP_SIZE 321
-#define OPTION_PLT_STATIC_CHAIN (OPTION_STUBGROUP_SIZE + 1)
-#define OPTION_NO_PLT_STATIC_CHAIN (OPTION_PLT_STATIC_CHAIN + 1)
-#define OPTION_PLT_THREAD_SAFE (OPTION_NO_PLT_STATIC_CHAIN + 1)
-#define OPTION_NO_PLT_THREAD_SAFE (OPTION_PLT_THREAD_SAFE + 1)
-#define OPTION_PLT_ALIGN (OPTION_NO_PLT_THREAD_SAFE + 1)
-#define OPTION_NO_PLT_ALIGN (OPTION_PLT_ALIGN + 1)
-#define OPTION_STUBSYMS (OPTION_NO_PLT_ALIGN + 1)
-#define OPTION_NO_STUBSYMS (OPTION_STUBSYMS + 1)
-#define OPTION_SAVRES (OPTION_NO_STUBSYMS + 1)
-#define OPTION_NO_SAVRES (OPTION_SAVRES + 1)
-#define OPTION_DOTSYMS (OPTION_NO_SAVRES + 1)
-#define OPTION_NO_DOTSYMS (OPTION_DOTSYMS + 1)
-#define OPTION_NO_TLS_OPT (OPTION_NO_DOTSYMS + 1)
-#define OPTION_TLS_GET_ADDR_OPT (OPTION_NO_TLS_OPT + 1)
-#define OPTION_NO_TLS_GET_ADDR_OPT (OPTION_TLS_GET_ADDR_OPT + 1)
-#define OPTION_NO_OPD_OPT (OPTION_NO_TLS_GET_ADDR_OPT + 1)
-#define OPTION_NO_TOC_OPT (OPTION_NO_OPD_OPT + 1)
-#define OPTION_NO_MULTI_TOC (OPTION_NO_TOC_OPT + 1)
-#define OPTION_NO_TOC_SORT (OPTION_NO_MULTI_TOC + 1)
-#define OPTION_NON_OVERLAPPING_OPD (OPTION_NO_TOC_SORT + 1)
+enum ppc64_opt
+{
+ OPTION_STUBGROUP_SIZE = 321,
+ OPTION_PLT_STATIC_CHAIN,
+ OPTION_NO_PLT_STATIC_CHAIN,
+ OPTION_PLT_THREAD_SAFE,
+ OPTION_NO_PLT_THREAD_SAFE,
+ OPTION_PLT_ALIGN,
+ OPTION_NO_PLT_ALIGN,
+ OPTION_PLT_LOCALENTRY,
+ OPTION_NO_PLT_LOCALENTRY,
+ OPTION_STUBSYMS,
+ OPTION_NO_STUBSYMS,
+ OPTION_SAVRES,
+ OPTION_NO_SAVRES,
+ OPTION_DOTSYMS,
+ OPTION_NO_DOTSYMS,
+ OPTION_NO_TLS_OPT,
+ OPTION_TLS_GET_ADDR_OPT,
+ OPTION_NO_TLS_GET_ADDR_OPT,
+ OPTION_NO_OPD_OPT,
+ OPTION_NO_TOC_OPT,
+ OPTION_NO_MULTI_TOC,
+ OPTION_NO_TOC_SORT,
+ OPTION_NON_OVERLAPPING_OPD
+};
'
PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
@@ -714,6 +719,8 @@ PARSE_AND_LIST_LONGOPTS=${PARSE_AND_LIST_LONGOPTS}'
{ "no-plt-thread-safe", no_argument, NULL, OPTION_NO_PLT_THREAD_SAFE },
{ "plt-align", optional_argument, NULL, OPTION_PLT_ALIGN },
{ "no-plt-align", no_argument, NULL, OPTION_NO_PLT_ALIGN },
+ { "plt-localentry", optional_argument, NULL, OPTION_PLT_LOCALENTRY },
+ { "no-plt-localentry", no_argument, NULL, OPTION_NO_PLT_LOCALENTRY },
{ "emit-stub-syms", no_argument, NULL, OPTION_STUBSYMS },
{ "no-emit-stub-syms", no_argument, NULL, OPTION_NO_STUBSYMS },
{ "dotsyms", no_argument, NULL, OPTION_DOTSYMS },
@@ -760,6 +767,12 @@ PARSE_AND_LIST_OPTIONS=${PARSE_AND_LIST_OPTIONS}'
--no-plt-align Dont'\''t align individual PLT call stubs.\n"
));
fprintf (file, _("\
+ --plt-localentry Optimize calls to ELFv2 localentry:0 functions.\n"
+ ));
+ fprintf (file, _("\
+ --no-plt-localentry Don'\''t optimize ELFv2 calls.\n"
+ ));
+ fprintf (file, _("\
--emit-stub-syms Label linker stubs with a symbol.\n"
));
fprintf (file, _("\
@@ -852,6 +865,14 @@ PARSE_AND_LIST_ARGS_CASES=${PARSE_AND_LIST_ARGS_CASES}'
params.plt_stub_align = 0;
break;
+ case OPTION_PLT_LOCALENTRY:
+ params.plt_localentry0 = 1;
+ break;
+
+ case OPTION_NO_PLT_LOCALENTRY:
+ params.plt_localentry0 = 0;
+ break;
+
case OPTION_STUBSYMS:
params.emit_stub_syms = 1;
break;
diff --git a/ld/emultempl/s390.em b/ld/emultempl/s390.em
new file mode 100644
index 0000000..536104e
--- /dev/null
+++ b/ld/emultempl/s390.em
@@ -0,0 +1,64 @@
+# This shell script emits a C file. -*- C -*-
+# Copyright (C) 2017 Free Software Foundation, 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 3 of the license, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not,
+# see <http://www.gnu.org/licenses/>.
+#
+
+# This file is sourced from elf-generic.em, and defines S/390
+# specific routines.
+#
+fragment <<EOF
+
+#include "ldctor.h"
+#include "elf-s390.h"
+
+static struct s390_elf_params params = { 0 };
+
+/* This is a convenient point to tell BFD about target specific flags.
+ After the output has been created, but before inputs are read. */
+static void
+s390_elf_create_output_section_statements (void)
+{
+ if (!bfd_elf_s390_set_options (&link_info, &params))
+ einfo ("%F%P: can not init BFD: %E\n");
+}
+
+EOF
+
+# Define some shell vars to insert bits of code into the standard elf
+# parse_args and list_options functions.
+#
+PARSE_AND_LIST_PROLOGUE='
+#define OPTION_PGSTE 301
+'
+
+PARSE_AND_LIST_LONGOPTS='
+ { "s390-pgste", no_argument, NULL, OPTION_PGSTE},
+'
+
+PARSE_AND_LIST_OPTIONS='
+ fprintf (file, _(" --s390-pgste Tell the kernel to "
+ "allocate 4k page tables\n"));
+'
+
+PARSE_AND_LIST_ARGS_CASES='
+ case OPTION_PGSTE:
+ params.pgste = 1;
+ break;
+'
+
+LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=s390_elf_create_output_section_statements
diff --git a/ld/gen-doc.texi b/ld/gen-doc.texi
index 27b8198..6b31a6b 100644
--- a/ld/gen-doc.texi
+++ b/ld/gen-doc.texi
@@ -21,6 +21,7 @@
@set POWERPC
@set POWERPC64
@set Renesas
+@set S/390
@set SPU
@set TICOFF
@set WIN32
diff --git a/ld/ld.h b/ld/ld.h
index 104bb8e..162e156 100644
--- a/ld/ld.h
+++ b/ld/ld.h
@@ -172,6 +172,11 @@ typedef struct
/* If set, display the target memory usage (per memory region). */
bfd_boolean print_memory_usage;
+ /* Should we force section groups to be resolved? Controlled with
+ --force-group-allocation on the command line or FORCE_GROUP_ALLOCATION
+ in the linker script. */
+ bfd_boolean force_group_allocation;
+
/* Big or little endian as set on command line. */
enum endian_enum endian;
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 9a72cb9..bb5f719 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -34,6 +34,7 @@
@set POWERPC
@set POWERPC64
@set Renesas
+@set S/390
@set SPU
@set TICOFF
@set WIN32
@@ -158,6 +159,9 @@ in the section entitled ``GNU Free Documentation License''.
@ifset POWERPC64
* PowerPC64 ELF64:: ld and PowerPC64 64-bit ELF Support
@end ifset
+@ifset S/390
+* S/390 ELF:: ld and S/390 ELF Support
+@end ifset
@ifset SPU
* SPU ELF:: ld and SPU ELF Support
@end ifset
@@ -1250,19 +1254,31 @@ relocation overflow check if there will be no dynamic relocation
overflow at run-time. Supported for x86_64.
@item call-nop=prefix-addr
-@itemx call-nop=prefix-nop
@itemx call-nop=suffix-nop
@itemx call-nop=prefix-@var{byte}
@itemx call-nop=suffix-@var{byte}
Specify the 1-byte @code{NOP} padding when transforming indirect call
to a locally defined function, foo, via its GOT slot.
@option{call-nop=prefix-addr} generates @code{0x67 call foo}.
-@option{call-nop=prefix-nop} generates @code{0x90 call foo}.
@option{call-nop=suffix-nop} generates @code{call foo 0x90}.
@option{call-nop=prefix-@var{byte}} generates @code{@var{byte} call foo}.
@option{call-nop=suffix-@var{byte}} generates @code{call foo @var{byte}}.
Supported for i386 and x86_64.
+@item ibtplt
+Generate Intel Indirect Branch Tracking (IBT) enabled PLT entries.
+Supported for Linux/i386 and Linux/x86_64.
+
+@item IBT
+Generate GNU_PROPERTY_X86_FEATURE_1_IBT in .note.gnu.property section
+to indicate compatibility with IBT. This also implies @option{ibtplt}.
+Supported for Linux/i386 and Linux/x86_64.
+
+@item shstk
+Generate GNU_PROPERTY_X86_FEATURE_1_SHSTK in .note.gnu.property section
+to indicate compatibility with Intel Shadow Stack. Supported for
+Linux/i386 and Linux/x86_64.
+
@end table
Other keywords are ignored for Solaris compatibility.
@@ -1486,6 +1502,18 @@ and also prevents any possible confusion over resolving to the wrong
duplicate when there are many dynamic modules with specialized search
paths for runtime symbol resolution.
+@cindex group allocation in linker script
+@cindex section groups
+@cindex COMDAT
+@kindex --force-group-allocation
+@item --force-group-allocation
+This option causes the linker to place section group members like
+normal input sections, and to delete the section groups. This is the
+default behaviour for a final link but this option can be used to
+change the behaviour of a relocatable link (@samp{-r}). The script
+command @code{FORCE_GROUP_ALLOCATION} has the same
+effect. @xref{Miscellaneous Commands}.
+
@cindex symbols, from command line
@kindex --defsym=@var{symbol}=@var{exp}
@item --defsym=@var{symbol}=@var{expression}
@@ -3728,6 +3756,17 @@ This command has the same effect as the @samp{--no-define-common}
command-line option: to make @code{ld} omit the assignment of addresses
to common symbols even for a non-relocatable output file.
+@item FORCE_GROUP_ALLOCATION
+@kindex FORCE_GROUP_ALLOCATION
+@cindex group allocation in linker script
+@cindex section groups
+@cindex COMDAT
+This command has the same effect as the
+@samp{--force-group-allocation} command-line option: to make
+@command{ld} place section group members like normal input sections,
+and to delete the section groups even if a relocatable output file is
+specified (@samp{-r}).
+
@item INSERT [ AFTER | BEFORE ] @var{output_section}
@kindex INSERT
@cindex insert user script into default script
@@ -4636,6 +4675,14 @@ SECTIONS @{
@end group
@end smallexample
+If an output section's name is the same as the input section's name
+and is representable as a C identifier, then the linker will
+automatically @pxref{PROVIDE} two symbols: __start_SECNAME and
+__stop_SECNAME, where SECNAME is the name of the section. These
+indicate the start address and end address of the output section
+respectively. Note: most section names are not representable as
+C identifiers because they contain a @samp{.} character.
+
@node Output Section Data
@subsection Output Section Data
@cindex data
@@ -5820,14 +5867,6 @@ The command line options @samp{--orphan-handling} and @samp{--unique}
(@pxref{Options,,Command Line Options}) can be used to control which
output sections an orphan is placed in.
-If an orphaned section's name is representable as a C identifier then
-the linker will automatically @pxref{PROVIDE} two symbols:
-__start_SECNAME and __stop_SECNAME, where SECNAME is the name of the
-section. These indicate the start address and end address of the
-orphaned section respectively. Note: most section names are not
-representable as C identifiers because they contain a @samp{.}
-character.
-
@node Location Counter
@subsection The Location Counter
@kindex .
@@ -6530,6 +6569,9 @@ functionality are not listed.
@ifset POWERPC64
* PowerPC64 ELF64:: @command{ld} and PowerPC64 64-bit ELF Support
@end ifset
+@ifset S/390
+* S/390 ELF:: @command{ld} and S/390 ELF Support
+@end ifset
@ifset SPU
* SPU ELF:: @command{ld} and SPU ELF Support
@end ifset
@@ -7565,6 +7607,30 @@ default behaviour.
@end ifclear
@end ifset
+@ifset S/390
+@ifclear GENERIC
+@raisesections
+@end ifclear
+
+@node S/390 ELF
+@section @command{ld} and S/390 ELF Support
+
+@cindex S/390 ELF options
+@table @option
+
+@cindex S/390
+@kindex --s390-pgste
+@item --s390-pgste
+This option marks the result file with a @code{PT_S390_PGSTE}
+segment. The Linux kernel is supposed to allocate 4k page tables for
+binaries marked that way.
+@end table
+
+@ifclear GENERIC
+@lowersections
+@end ifclear
+@end ifset
+
@ifset SPU
@ifclear GENERIC
@raisesections
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 849f272..4c1efdc 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -131,7 +131,7 @@ static int error_index;
%token SORT_BY_INIT_PRIORITY
%token '{' '}'
%token SIZEOF_HEADERS OUTPUT_FORMAT FORCE_COMMON_ALLOCATION OUTPUT_ARCH
-%token INHIBIT_COMMON_ALLOCATION
+%token INHIBIT_COMMON_ALLOCATION FORCE_GROUP_ALLOCATION
%token SEGMENT_START
%token INCLUDE
%token MEMORY
@@ -336,6 +336,8 @@ ifile_p1:
{ ldfile_set_output_arch ($3, bfd_arch_unknown); }
| FORCE_COMMON_ALLOCATION
{ command_line.force_common_definition = TRUE ; }
+ | FORCE_GROUP_ALLOCATION
+ { command_line.force_group_allocation = TRUE ; }
| INHIBIT_COMMON_ALLOCATION
{ command_line.inhibit_common_definition = TRUE ; }
| INPUT '(' input_list ')'
diff --git a/ld/ldlang.c b/ld/ldlang.c
index ed7e552..726bc8e 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -207,7 +207,7 @@ unique_section_p (const asection *sec,
struct unique_sections *unam;
const char *secnam;
- if (bfd_link_relocatable (&link_info)
+ if (!link_info.resolve_section_groups
&& sec->owner != NULL
&& bfd_is_group_section (sec->owner, sec))
return !(os != NULL
@@ -1829,8 +1829,6 @@ lang_insert_orphan (asection *s,
lang_statement_list_type *add_child)
{
lang_statement_list_type add;
- const char *ps;
- lang_assignment_statement_type *start_assign;
lang_output_section_statement_type *os;
lang_output_section_statement_type **os_tail;
@@ -1852,29 +1850,6 @@ lang_insert_orphan (asection *s,
os = lang_enter_output_section_statement (secname, address, normal_section,
NULL, NULL, NULL, constraint, 0);
- ps = NULL;
- start_assign = NULL;
- if (config.build_constructors && *os_tail == os)
- {
- /* If the name of the section is representable in C, then create
- symbols to mark the start and the end of the section. */
- for (ps = secname; *ps != '\0'; ps++)
- if (!ISALNUM ((unsigned char) *ps) && *ps != '_')
- break;
- if (*ps == '\0')
- {
- char *symname;
-
- symname = (char *) xmalloc (ps - secname + sizeof "__start_" + 1);
- symname[0] = bfd_get_symbol_leading_char (link_info.output_bfd);
- sprintf (symname + (symname[0] != 0), "__start_%s", secname);
- start_assign
- = lang_add_assignment (exp_provide (symname,
- exp_nameop (NAME, "."),
- FALSE));
- }
- }
-
if (add_child == NULL)
add_child = &os->children;
lang_add_section (add_child, s, NULL, os);
@@ -1894,27 +1869,6 @@ lang_insert_orphan (asection *s,
lang_leave_output_section_statement (NULL, DEFAULT_MEMORY_REGION, NULL,
NULL);
- if (start_assign != NULL)
- {
- char *symname;
- lang_assignment_statement_type *stop_assign;
- bfd_vma dot;
-
- symname = (char *) xmalloc (ps - secname + sizeof "__stop_" + 1);
- symname[0] = bfd_get_symbol_leading_char (link_info.output_bfd);
- sprintf (symname + (symname[0] != 0), "__stop_%s", secname);
- stop_assign
- = lang_add_assignment (exp_provide (symname,
- exp_nameop (NAME, "."),
- FALSE));
- /* Evaluate the expression to define the symbol if referenced,
- before sizing dynamic sections. */
- dot = os->bfd_section->vma;
- exp_fold_tree (start_assign->exp, os->bfd_section, &dot);
- dot += TO_ADDR (s->size);
- exp_fold_tree (stop_assign->exp, os->bfd_section, &dot);
- }
-
/* Restore the global list pointer. */
if (after != NULL)
pop_stat_ptr ();
@@ -2349,6 +2303,12 @@ lang_add_section (lang_statement_list_type *ptr,
if (strcmp (output->name, DISCARD_SECTION_NAME) == 0)
discard = TRUE;
+ /* Discard the group descriptor sections when we're finally placing the
+ sections from within the group. */
+ if ((section->flags & SEC_GROUP) == SEC_GROUP
+ && link_info.resolve_section_groups)
+ discard = TRUE;
+
/* Discard debugging sections if we are stripping debugging
information. */
if ((link_info.strip == strip_debugger || link_info.strip == strip_all)
@@ -2389,8 +2349,14 @@ lang_add_section (lang_statement_list_type *ptr,
already been processed. One reason to do this is that on pe
format targets, .text$foo sections go into .text and it's odd
to see .text with SEC_LINK_ONCE set. */
-
- if (!bfd_link_relocatable (&link_info))
+ if ((flags & (SEC_LINK_ONCE | SEC_GROUP)) == (SEC_LINK_ONCE | SEC_GROUP))
+ {
+ if (link_info.resolve_section_groups)
+ flags &= ~(SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_RELOC);
+ else
+ flags &= ~(SEC_LINK_DUPLICATES | SEC_RELOC);
+ }
+ else if (!bfd_link_relocatable (&link_info))
flags &= ~(SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_RELOC);
switch (output->sectype)
@@ -5912,53 +5878,174 @@ section_for_dot (void)
return bfd_abs_section_ptr;
}
-/* Fix any .startof. or .sizeof. symbols. When the assemblers see the
- operator .startof. (section_name), it produces an undefined symbol
- .startof.section_name. Similarly, when it sees
- .sizeof. (section_name), it produces an undefined symbol
- .sizeof.section_name. For all the output sections, we look for
- such symbols, and set them to the correct value. */
+/* Array of __start/__stop/.startof./.sizeof/ symbols. */
+
+static struct bfd_link_hash_entry **start_stop_syms;
+static size_t start_stop_count = 0;
+static size_t start_stop_alloc = 0;
+
+/* Give start/stop SYMBOL for SEC a preliminary definition, and add it
+ to start_stop_syms. */
+
+static void
+lang_define_start_stop (const char *symbol, asection *sec)
+{
+ struct bfd_link_hash_entry *h;
+
+ h = bfd_define_start_stop (link_info.output_bfd, &link_info, symbol, sec);
+ if (h != NULL)
+ {
+ if (start_stop_count == start_stop_alloc)
+ {
+ start_stop_alloc = 2 * start_stop_alloc + 10;
+ start_stop_syms
+ = xrealloc (start_stop_syms,
+ start_stop_alloc * sizeof (*start_stop_syms));
+ }
+ start_stop_syms[start_stop_count++] = h;
+ }
+}
+
+/* Check for input sections whose names match references to
+ __start_SECNAME or __stop_SECNAME symbols. Give the symbols
+ preliminary definitions. */
static void
-lang_set_startof (void)
+lang_init_start_stop (void)
{
+ bfd *abfd;
asection *s;
+ char leading_char = bfd_get_symbol_leading_char (link_info.output_bfd);
- if (bfd_link_relocatable (&link_info))
+ for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ const char *ps;
+ const char *secname = s->name;
+
+ for (ps = secname; *ps != '\0'; ps++)
+ if (!ISALNUM ((unsigned char) *ps) && *ps != '_')
+ break;
+ if (*ps == '\0')
+ {
+ char *symbol = (char *) xmalloc (10 + strlen (secname));
+
+ symbol[0] = leading_char;
+ sprintf (symbol + (leading_char != 0), "__start_%s", secname);
+ lang_define_start_stop (symbol, s);
+
+ symbol[1] = leading_char;
+ memcpy (symbol + 1 + (leading_char != 0), "__stop", 6);
+ lang_define_start_stop (symbol + 1, s);
+
+ free (symbol);
+ }
+ }
+}
+
+/* Iterate over start_stop_syms. */
+
+static void
+foreach_start_stop (void (*func) (struct bfd_link_hash_entry *))
+{
+ size_t i;
+
+ for (i = 0; i < start_stop_count; ++i)
+ func (start_stop_syms[i]);
+}
+
+/* __start and __stop symbols are only supposed to be defined by the
+ linker for orphan sections, but we now extend that to sections that
+ map to an output section of the same name. The symbols were
+ defined early for --gc-sections, before we mapped input to output
+ sections, so undo those that don't satisfy this rule. */
+
+static void
+undef_start_stop (struct bfd_link_hash_entry *h)
+{
+ if (h->ldscript_def)
return;
+ if (h->u.def.section->output_section == NULL
+ || h->u.def.section->output_section->owner != link_info.output_bfd
+ || strcmp (h->u.def.section->name,
+ h->u.def.section->output_section->name) != 0)
+ {
+ h->type = bfd_link_hash_undefined;
+ h->u.undef.abfd = NULL;
+ }
+}
+
+static void
+lang_undef_start_stop (void)
+{
+ foreach_start_stop (undef_start_stop);
+}
+
+/* Check for output sections whose names match references to
+ .startof.SECNAME or .sizeof.SECNAME symbols. Give the symbols
+ preliminary definitions. */
+
+static void
+lang_init_startof_sizeof (void)
+{
+ asection *s;
+
for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
{
- const char *secname;
- char *buf;
- struct bfd_link_hash_entry *h;
+ const char *secname = s->name;
+ char *symbol = (char *) xmalloc (10 + strlen (secname));
- secname = bfd_get_section_name (link_info.output_bfd, s);
- buf = (char *) xmalloc (10 + strlen (secname));
+ sprintf (symbol, ".startof.%s", secname);
+ lang_define_start_stop (symbol, s);
- sprintf (buf, ".startof.%s", secname);
- h = bfd_link_hash_lookup (link_info.hash, buf, FALSE, FALSE, TRUE);
- if (h != NULL && h->type == bfd_link_hash_undefined)
- {
- h->type = bfd_link_hash_defined;
- h->u.def.value = 0;
- h->u.def.section = s;
- }
+ memcpy (symbol + 1, ".size", 5);
+ lang_define_start_stop (symbol + 1, s);
+ free (symbol);
+ }
+}
+
+/* Set .startof., .sizeof., __start and __stop symbols final values. */
+
+static void
+set_start_stop (struct bfd_link_hash_entry *h)
+{
+ if (h->ldscript_def
+ || h->type != bfd_link_hash_defined)
+ return;
- sprintf (buf, ".sizeof.%s", secname);
- h = bfd_link_hash_lookup (link_info.hash, buf, FALSE, FALSE, TRUE);
- if (h != NULL && h->type == bfd_link_hash_undefined)
+ if (h->root.string[0] == '.')
+ {
+ /* .startof. or .sizeof. symbol.
+ .startof. already has final value. */
+ if (h->root.string[2] == 'i')
{
- h->type = bfd_link_hash_defined;
- h->u.def.value = TO_ADDR (s->size);
+ /* .sizeof. */
+ h->u.def.value = TO_ADDR (h->u.def.section->size);
h->u.def.section = bfd_abs_section_ptr;
}
+ }
+ else
+ {
+ /* __start or __stop symbol. */
+ int has_lead = bfd_get_symbol_leading_char (link_info.output_bfd) != 0;
- free (buf);
+ h->u.def.section = h->u.def.section->output_section;
+ if (h->root.string[4 + has_lead] == 'o')
+ {
+ /* __stop_ */
+ h->u.def.value = TO_ADDR (h->u.def.section->size);
+ }
}
}
static void
+lang_finalize_start_stop (void)
+{
+ foreach_start_stop (set_start_stop);
+}
+
+static void
lang_end (void)
{
struct bfd_link_hash_entry *h;
@@ -7024,6 +7111,12 @@ lang_process (void)
files. */
ldctor_build_sets ();
+ /* Give initial values for __start and __stop symbols, so that ELF
+ gc_sections will keep sections referenced by these symbols. Must
+ be done before lang_do_assignments below. */
+ if (config.build_constructors)
+ lang_init_start_stop ();
+
/* PR 13683: We must rerun the assignments prior to running garbage
collection in order to make sure that all symbol aliases are resolved. */
lang_do_assignments (lang_mark_phase_enum);
@@ -7078,6 +7171,17 @@ lang_process (void)
/* Copy forward lma regions for output sections in same lma region. */
lang_propagate_lma_regions ();
+ /* Defining __start/__stop symbols early for --gc-sections to work
+ around a glibc build problem can result in these symbols being
+ defined when they should not be. Fix them now. */
+ if (config.build_constructors)
+ lang_undef_start_stop ();
+
+ /* Define .startof./.sizeof. symbols with preliminary values before
+ dynamic symbols are created. */
+ if (!bfd_link_relocatable (&link_info))
+ lang_init_startof_sizeof ();
+
/* Do anything special before sizing sections. This is where ELF
and other back-ends size dynamic sections. */
ldemul_before_allocation ();
@@ -7097,8 +7201,8 @@ lang_process (void)
everything is. This is where relaxation is done. */
ldemul_after_allocation ();
- /* Fix any .startof. or .sizeof. symbols. */
- lang_set_startof ();
+ /* Fix any __start, __stop, .startof. or .sizeof. symbols. */
+ lang_finalize_start_stop ();
/* Do all the assignments, now that we know the final resting places
of all the symbols. */
diff --git a/ld/ldlex.h b/ld/ldlex.h
index dac152b..5aa7f6b 100644
--- a/ld/ldlex.h
+++ b/ld/ldlex.h
@@ -146,6 +146,7 @@ enum option_values
OPTION_PRINT_MEMORY_USAGE,
OPTION_REQUIRE_DEFINED_SYMBOL,
OPTION_ORPHAN_HANDLING,
+ OPTION_FORCE_GROUP_ALLOCATION,
};
/* The initial parser states. */
diff --git a/ld/ldlex.l b/ld/ldlex.l
index acba1a2..ba618ec 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -274,6 +274,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^\\]([*?.$_a-zA-Z0-9\[\]\-\!\^\\]|::)*
<BOTH,SCRIPT>"CREATE_OBJECT_SYMBOLS" { RTOKEN(CREATE_OBJECT_SYMBOLS);}
<BOTH,SCRIPT>"CONSTRUCTORS" { RTOKEN( CONSTRUCTORS);}
<BOTH,SCRIPT>"FORCE_COMMON_ALLOCATION" { RTOKEN(FORCE_COMMON_ALLOCATION);}
+<BOTH,SCRIPT>"FORCE_GROUP_ALLOCATION" { RTOKEN(FORCE_GROUP_ALLOCATION);}
<BOTH,SCRIPT>"INHIBIT_COMMON_ALLOCATION" { RTOKEN(INHIBIT_COMMON_ALLOCATION);}
<BOTH,SCRIPT>"SECTIONS" { RTOKEN(SECTIONS);}
<BOTH,SCRIPT>"INSERT" { RTOKEN(INSERT_K);}
diff --git a/ld/ldmain.c b/ld/ldmain.c
index e049de3..ee5ab11 100644
--- a/ld/ldmain.c
+++ b/ld/ldmain.c
@@ -298,6 +298,9 @@ main (int argc, char **argv)
#ifdef DEFAULT_FLAG_COMPRESS_DEBUG
link_info.compress_debug = COMPRESS_DEBUG_GABI_ZLIB;
#endif
+#ifdef DEFAULT_NEW_DTAGS
+ link_info.new_dtags = DEFAULT_NEW_DTAGS;
+#endif
ldfile_add_arch ("");
emulation = get_emulation (argc, argv);
@@ -383,6 +386,12 @@ main (int argc, char **argv)
info_msg ("\n==================================================\n");
}
+ if (command_line.force_group_allocation
+ || !bfd_link_relocatable (&link_info))
+ link_info.resolve_section_groups = TRUE;
+ else
+ link_info.resolve_section_groups = FALSE;
+
if (command_line.print_output_format)
info_msg ("%s\n", lang_get_output_target ());
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 0b7d497..08106bc 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -112,6 +112,9 @@ static const struct ld_option ld_options[] =
'd', NULL, N_("Force common symbols to be defined"), ONE_DASH },
{ {"dp", no_argument, NULL, 'd'},
'\0', NULL, NULL, ONE_DASH },
+ { {"force-group-allocation", no_argument, NULL,
+ OPTION_FORCE_GROUP_ALLOCATION},
+ '\0', NULL, N_("Force group members out of groups"), TWO_DASHES },
{ {"entry", required_argument, NULL, 'e'},
'e', N_("ADDRESS"), N_("Set start address"), TWO_DASHES },
{ {"export-dynamic", no_argument, NULL, OPTION_EXPORT_DYNAMIC},
@@ -767,6 +770,9 @@ parse_args (unsigned argc, char **argv)
case 'd':
command_line.force_common_definition = TRUE;
break;
+ case OPTION_FORCE_GROUP_ALLOCATION:
+ command_line.force_group_allocation = TRUE;
+ break;
case OPTION_DEFSYM:
lex_string = optarg;
lex_redirect (optarg, "--defsym", ++defsym_count);
@@ -1786,7 +1792,7 @@ elf_shlib_list_options (FILE *file)
fprintf (file, _("\
-z nocommon Generate common symbols with STT_OBJECT type\n"));
fprintf (file, _("\
- -z stacksize=SIZE Set size of stack segment\n"));
+ -z stack-size=SIZE Set size of stack segment\n"));
fprintf (file, _("\
-z text Treat DT_TEXTREL in shared object as error\n"));
fprintf (file, _("\
diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc
index 144d32d..07553b4 100644
--- a/ld/scripttempl/avr.sc
+++ b/ld/scripttempl/avr.sc
@@ -27,29 +27,21 @@ OUTPUT_ARCH(${ARCH})
__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH;
__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH;
-__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K;
-__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K;
-__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K;
-__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K;
-__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K;
-EOF
-
-if test -n "$RODATA_PM_OFFSET"; then
- cat <<EOF
-__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : $RODATA_PM_OFFSET;
-EOF
-fi
-
-cat <<EOF
+${EEPROM_LENGTH+__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : $EEPROM_LENGTH;}
+__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : $FUSE_LENGTH;
+__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : $LOCK_LENGTH;
+__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : $SIGNATURE_LENGTH;
+${USER_SIGNATURE_LENGTH+__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : $USER_SIGNATURE_LENGTH;}
+${RODATA_PM_OFFSET+__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : $RODATA_PM_OFFSET;}
MEMORY
{
text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
- eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__
- fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
+${EEPROM_LENGTH+ eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__}
+ $FUSE_NAME (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
- user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__
+${USER_SIGNATURE_LENGTH+ user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__}
}
SECTIONS
@@ -140,11 +132,6 @@ SECTIONS
${RELOCATING+. = ALIGN(2);}
- /* For future tablejump instruction arrays for 3 byte pc devices.
- We don't relax jump/call instructions within these sections. */
- *(.jumptables)
- ${RELOCATING+ *(.jumptables*)}
-
/* For code that needs to reside in the lower 128k progmem. */
*(.lowtext)
${RELOCATING+ *(.lowtext*)}
@@ -204,6 +191,18 @@ SECTIONS
KEEP (*(.fini1))
*(.fini0) /* Infinite loop after program termination. */
KEEP (*(.fini0))
+
+ /* For code that needs not to reside in the lower progmem. */
+ *(.hightext)
+ ${RELOCATING+ *(.hightext*)}
+
+ ${RELOCATING+. = ALIGN(2);}
+
+ /* For tablejump instruction arrays. We don't relax
+ JMP / CALL instructions within these sections. */
+ *(.jumptables)
+ ${RELOCATING+ *(.jumptables*)}
+
${RELOCATING+ _etext = . ; }
} ${RELOCATING+ > text}
EOF
@@ -271,6 +270,10 @@ cat <<EOF
${RELOCATING+ _end = . ; }
${RELOCATING+ PROVIDE (__heap_start = .) ; }
} ${RELOCATING+ > data}
+EOF
+
+if test -n "${EEPROM_LENGTH}"; then
+cat <<EOF
.eeprom ${RELOCATING-0}:
{
@@ -278,6 +281,11 @@ cat <<EOF
KEEP(*(.eeprom*))
${RELOCATING+ __eeprom_end = . ; }
} ${RELOCATING+ > eeprom}
+EOF
+fi
+
+if test "$FUSE_NAME" = "fuse" ; then
+cat <<EOF
.fuse ${RELOCATING-0}:
{
@@ -286,6 +294,10 @@ cat <<EOF
KEEP(*(.hfuse))
KEEP(*(.efuse))
} ${RELOCATING+ > fuse}
+EOF
+fi
+
+cat <<EOF
.lock ${RELOCATING-0}:
{
@@ -296,6 +308,19 @@ cat <<EOF
{
KEEP(*(.signature*))
} ${RELOCATING+ > signature}
+EOF
+
+if test "$FUSE_NAME" = "config" ; then
+cat <<EOF
+
+ .config ${RELOCATING-0}:
+ {
+ KEEP(*(.config*))
+ } ${RELOCATING+ > config}
+EOF
+fi
+
+cat <<EOF
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
diff --git a/ld/scripttempl/avrtiny.sc b/ld/scripttempl/avrtiny.sc
deleted file mode 100644
index 5a6d4ae..0000000
--- a/ld/scripttempl/avrtiny.sc
+++ /dev/null
@@ -1,262 +0,0 @@
-# Copyright (C) 2014-2017 Free Software Foundation, Inc.
-#
-# Copying and distribution of this file, with or without modification,
-# are permitted in any medium without royalty provided the copyright
-# notice and this notice are preserved.
-
-cat <<EOF
-/* Copyright (C) 2014-2017 Free Software Foundation, Inc.
-
- Copying and distribution of this script, with or without modification,
- are permitted in any medium without royalty provided the copyright
- notice and this notice are preserved. */
-
-OUTPUT_FORMAT("${OUTPUT_FORMAT}","${OUTPUT_FORMAT}","${OUTPUT_FORMAT}")
-OUTPUT_ARCH(${ARCH})
-
-__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH;
-__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH;
-__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 2;
-__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 2;
-__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 4;
-__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x4000;
-
-MEMORY
-{
- text (rx) : ORIGIN = $TEXT_ORIGIN, LENGTH = __TEXT_REGION_LENGTH__
- data (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = __DATA_REGION_LENGTH__
-
- /* Provide offsets for config, lock and signature to match
- production file format. Ignore offsets in datasheet. */
-
- config (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
- lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
- signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
-}
-
-SECTIONS
-{
- /* Read-only sections, merged into text segment: */
- ${TEXT_DYNAMIC+${DYNAMIC}}
- .hash ${RELOCATING-0} : { *(.hash) }
- .dynsym ${RELOCATING-0} : { *(.dynsym) }
- .dynstr ${RELOCATING-0} : { *(.dynstr) }
- .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
- .gnu.version_d ${RELOCATING-0} : { *(.gnu.version_d) }
- .gnu.version_r ${RELOCATING-0} : { *(.gnu.version_r) }
-
- .rel.init ${RELOCATING-0} : { *(.rel.init) }
- .rela.init ${RELOCATING-0} : { *(.rela.init) }
- .rel.text ${RELOCATING-0} :
- {
- *(.rel.text)
- ${RELOCATING+*(.rel.text.*)}
- ${RELOCATING+*(.rel.gnu.linkonce.t*)}
- }
- .rela.text ${RELOCATING-0} :
- {
- *(.rela.text)
- ${RELOCATING+*(.rela.text.*)}
- ${RELOCATING+*(.rela.gnu.linkonce.t*)}
- }
- .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
- .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
- .rel.rodata ${RELOCATING-0} :
- {
- *(.rel.rodata)
- ${RELOCATING+*(.rel.rodata.*)}
- ${RELOCATING+*(.rel.gnu.linkonce.r*)}
- }
- .rela.rodata ${RELOCATING-0} :
- {
- *(.rela.rodata)
- ${RELOCATING+*(.rela.rodata.*)}
- ${RELOCATING+*(.rela.gnu.linkonce.r*)}
- }
- .rel.data ${RELOCATING-0} :
- {
- *(.rel.data)
- ${RELOCATING+*(.rel.data.*)}
- ${RELOCATING+*(.rel.gnu.linkonce.d*)}
- }
- .rela.data ${RELOCATING-0} :
- {
- *(.rela.data)
- ${RELOCATING+*(.rela.data.*)}
- ${RELOCATING+*(.rela.gnu.linkonce.d*)}
- }
- .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
- .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
- .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
- .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
- .rel.got ${RELOCATING-0} : { *(.rel.got) }
- .rela.got ${RELOCATING-0} : { *(.rela.got) }
- .rel.bss ${RELOCATING-0} : { *(.rel.bss) }
- .rela.bss ${RELOCATING-0} : { *(.rela.bss) }
- .rel.plt ${RELOCATING-0} : { *(.rel.plt) }
- .rela.plt ${RELOCATING-0} : { *(.rela.plt) }
-
- /* Internal text space or external memory. */
- .text ${RELOCATING-0} :
- {
- *(.vectors)
- KEEP(*(.vectors))
-
- /* For data that needs to reside in the lower 64k of progmem. */
- ${RELOCATING+ *(.progmem.gcc*)}
-
- /* PR 13812: Placing the trampolines here gives a better chance
- that they will be in range of the code that uses them. */
- ${RELOCATING+. = ALIGN(2);}
- ${CONSTRUCTING+ __trampolines_start = . ; }
- /* The jump trampolines for the 16-bit limited relocs will reside here. */
- *(.trampolines)
- ${RELOCATING+ *(.trampolines*)}
- ${CONSTRUCTING+ __trampolines_end = . ; }
-
- /* avr-libc expects these data to reside in lower 64K. */
- ${RELOCATING+ *libprintf_flt.a:*(.progmem.data)}
- ${RELOCATING+ *libc.a:*(.progmem.data)}
-
- ${RELOCATING+ *(.progmem*)}
-
- ${RELOCATING+. = ALIGN(2);}
-
- /* For future tablejump instruction arrays for 3 byte pc devices.
- We don't relax jump/call instructions within these sections. */
- *(.jumptables)
- ${RELOCATING+ *(.jumptables*)}
-
- /* For code that needs to reside in the lower 128k progmem. */
- *(.lowtext)
- ${RELOCATING+ *(.lowtext*)}
-
- ${CONSTRUCTING+ __ctors_start = . ; }
- ${CONSTRUCTING+ *(.ctors) }
- ${CONSTRUCTING+ __ctors_end = . ; }
- ${CONSTRUCTING+ __dtors_start = . ; }
- ${CONSTRUCTING+ *(.dtors) }
- ${CONSTRUCTING+ __dtors_end = . ; }
- KEEP(SORT(*)(.ctors))
- KEEP(SORT(*)(.dtors))
-
- /* From this point on, we don't bother about wether the insns are
- below or above the 16 bits boundary. */
- *(.init0) /* Start here after reset. */
- KEEP (*(.init0))
- *(.init1)
- KEEP (*(.init1))
- *(.init2) /* Clear __zero_reg__, set up stack pointer. */
- KEEP (*(.init2))
- *(.init3)
- KEEP (*(.init3))
- *(.init4) /* Initialize data and BSS. */
- KEEP (*(.init4))
- *(.init5)
- KEEP (*(.init5))
- *(.init6) /* C++ constructors. */
- KEEP (*(.init6))
- *(.init7)
- KEEP (*(.init7))
- *(.init8)
- KEEP (*(.init8))
- *(.init9) /* Call main(). */
- KEEP (*(.init9))
- *(.text)
- ${RELOCATING+. = ALIGN(2);}
- ${RELOCATING+ *(.text.*)}
- ${RELOCATING+. = ALIGN(2);}
- *(.fini9) /* _exit() starts here. */
- KEEP (*(.fini9))
- *(.fini8)
- KEEP (*(.fini8))
- *(.fini7)
- KEEP (*(.fini7))
- *(.fini6) /* C++ destructors. */
- KEEP (*(.fini6))
- *(.fini5)
- KEEP (*(.fini5))
- *(.fini4)
- KEEP (*(.fini4))
- *(.fini3)
- KEEP (*(.fini3))
- *(.fini2)
- KEEP (*(.fini2))
- *(.fini1)
- KEEP (*(.fini1))
- *(.fini0) /* Infinite loop after program termination. */
- KEEP (*(.fini0))
- ${RELOCATING+ _etext = . ; }
- } ${RELOCATING+ > text}
-
- .rodata ${RELOCATING+ ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ } ${RELOCATING-0} :
- {
- *(.rodata)
- ${RELOCATING+ *(.rodata*)}
- *(.gnu.linkonce.r*)
- } ${RELOCATING+AT> text}
-
- .data ${RELOCATING-0} :
- {
- ${RELOCATING+ PROVIDE (__data_start = .) ; }
- *(.data)
- ${RELOCATING+ *(.data*)}
- *(.gnu.linkonce.d*)
- ${RELOCATING+. = ALIGN(2);}
- ${RELOCATING+ _edata = . ; }
- ${RELOCATING+ PROVIDE (__data_end = .) ; }
- } ${RELOCATING+ > data ${RELOCATING+AT> text}}
-
- .bss ${RELOCATING+ ADDR(.data) + SIZEOF (.data)} ${RELOCATING-0} :${RELOCATING+ AT (ADDR (.bss))}
- {
- ${RELOCATING+ PROVIDE (__bss_start = .) ; }
- *(.bss)
- ${RELOCATING+ *(.bss*)}
- *(COMMON)
- ${RELOCATING+ PROVIDE (__bss_end = .) ; }
- } ${RELOCATING+ > data}
-
- ${RELOCATING+ __data_load_start = LOADADDR(.data); }
- ${RELOCATING+ __data_load_end = __data_load_start + SIZEOF(.data); }
-
- /* Global data not cleared after reset. */
- .noinit ${RELOCATING+ ADDR(.bss) + SIZEOF (.bss)} ${RELOCATING-0} : ${RELOCATING+ AT (ADDR (.noinit))}
- {
- ${RELOCATING+ PROVIDE (__noinit_start = .) ; }
- *(.noinit*)
- ${RELOCATING+ PROVIDE (__noinit_end = .) ; }
- ${RELOCATING+ _end = . ; }
- ${RELOCATING+ PROVIDE (__heap_start = .) ; }
- } ${RELOCATING+ > data}
-
- .lock ${RELOCATING-0}:
- {
- KEEP(*(.lock*))
- } ${RELOCATING+ > lock}
-
- .signature ${RELOCATING-0}:
- {
- KEEP(*(.signature*))
- } ${RELOCATING+ > signature}
-
- .config ${RELOCATING-0}:
- {
- KEEP(*(.config*))
- } ${RELOCATING+ > config}
-
- /* Stabs debugging sections. */
- .stab 0 : { *(.stab) }
- .stabstr 0 : { *(.stabstr) }
- .stab.excl 0 : { *(.stab.excl) }
- .stab.exclstr 0 : { *(.stab.exclstr) }
- .stab.index 0 : { *(.stab.index) }
- .stab.indexstr 0 : { *(.stab.indexstr) }
- .comment 0 : { *(.comment) }
- .note.gnu.build-id : { *(.note.gnu.build-id) }
-EOF
-
-. $srcdir/scripttempl/DWARF.sc
-
-cat <<EOF
-}
-EOF
diff --git a/ld/testsuite/ld-aarch64/aarch64-elf.exp b/ld/testsuite/ld-aarch64/aarch64-elf.exp
index ca21e17..b9c9885 100644
--- a/ld/testsuite/ld-aarch64/aarch64-elf.exp
+++ b/ld/testsuite/ld-aarch64/aarch64-elf.exp
@@ -195,7 +195,7 @@ run_dump_test_lp64 "local-addend-r"
# test error handling on pcrel relocation for shared libraries.
run_dump_test_lp64 "pcrel_pic_undefined"
-run_dump_test_lp64 "pcrel_pic_defined_local"
+run_dump_test_lp64 "pcrel_pic_defined"
run_dump_test "limit-b"
run_dump_test "limit-bl"
@@ -335,6 +335,10 @@ set aarch64elflinktests {
{} "copy-reloc-so.so"}
{"ld-aarch64/exe with copy relocation" "-e0 tmpdir/copy-reloc-so.so" "" ""
{copy-reloc-exe.s} {{objdump -R copy-reloc.d}} "copy-reloc"}
+ {"ld-aarch64/exe with copy relocation 2" "-e0 tmpdir/copy-reloc-so.so" "" ""
+ {copy-reloc-exe-2.s} {{objdump -R copy-reloc-2.d}} "copy-reloc-2"}
+ {"ld-aarch64/exe with copy relocation elimination" "-e0 tmpdir/copy-reloc-so.so" "" ""
+ {copy-reloc-exe-eliminate.s} {{objdump -R copy-reloc-eliminate.d}} "copy-reloc-elimination"}
{"ld-aarch64/so with global func" "-shared" "" "" {func-in-so.s}
{} "func-in-so.so"}
{"ld-aarch64/func sym hash opt for exe"
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-2.d b/ld/testsuite/ld-aarch64/copy-reloc-2.d
new file mode 100644
index 0000000..87ddccd
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-2.d
@@ -0,0 +1,7 @@
+.*
+DYNAMIC RELOCATION RECORDS
+OFFSET.*TYPE.*VALUE.*
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]
+.*R_AARCH64_COPY.*global_[abcd]
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d b/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d
new file mode 100644
index 0000000..9657d65
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-eliminate.d
@@ -0,0 +1,4 @@
+.*
+DYNAMIC RELOCATION RECORDS
+OFFSET.*TYPE.*VALUE.*
+.*R_AARCH64_ABS64.*global_a
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-exe-2.s b/ld/testsuite/ld-aarch64/copy-reloc-exe-2.s
new file mode 100644
index 0000000..d83658c
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-exe-2.s
@@ -0,0 +1,32 @@
+ # expect copy relocation for all these scenarios.
+ .global p
+ .global q
+ .global r
+ .section .data.rel.ro,"aw",%progbits
+ .align 3
+ .type p, %object
+ .size p, 8
+p:
+ .xword global_a
+
+ .type q, %object
+ .size q, 8
+q:
+ .xword global_b
+
+ .type r, %object
+ .size r, 8
+r:
+ # Any pc-rel relocation as no dynamic linker support on AArch64.
+ .xword global_c - .
+
+ .text
+ .global main
+main:
+ # Symbols are referenced by any other relocation against read-only
+ # section.
+ movz x0, :abs_g0_nc:global_a
+ adrp x1, global_b
+ # pc-rel.
+ adrp x2, global_d
+ add x2, x2, #:lo12:global_c
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s b/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s
new file mode 100644
index 0000000..33227aa
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/copy-reloc-exe-eliminate.s
@@ -0,0 +1,7 @@
+ .global p
+ .section .data.rel.ro,"aw",%progbits
+ .align 3
+ .type p, %object
+ .size p, 8
+p:
+ .xword global_a
diff --git a/ld/testsuite/ld-aarch64/copy-reloc-so.s b/ld/testsuite/ld-aarch64/copy-reloc-so.s
index 07ec44a..af40f69 100644
--- a/ld/testsuite/ld-aarch64/copy-reloc-so.s
+++ b/ld/testsuite/ld-aarch64/copy-reloc-so.s
@@ -1,6 +1,25 @@
.global global_a
.type global_a, %object
.size global_a, 4
+
+ .global global_b
+ .type global_b, %object
+ .size global_b, 4
+
+ .global global_c
+ .type global_c, %object
+ .size global_c, 4
+
+ .global global_d
+ .type global_d, %object
+ .size global_d, 4
+
.data
global_a:
.word 0xcafedead
+global_b:
+ .word 0xcafecafe
+global_c:
+ .word 0xdeadcafe
+global_d:
+ .word 0xdeaddead
diff --git a/ld/testsuite/ld-aarch64/pcrel.s b/ld/testsuite/ld-aarch64/pcrel.s
index df542ef..c5e18d0 100644
--- a/ld/testsuite/ld-aarch64/pcrel.s
+++ b/ld/testsuite/ld-aarch64/pcrel.s
@@ -1,3 +1,4 @@
+ .hidden global_b
.text
.align 2
main:
@@ -18,3 +19,8 @@ main:
.word global_a - .
.xword global_a - .
+ # Defined global symbol may bind externally because of copy relocation,
+ # while defined hidden symbol binds locally. LD should be able to
+ # differenciate this.
+ adrp x0, :pg_hi21:global_b
+ .xword global_b - .
diff --git a/ld/testsuite/ld-aarch64/pcrel_pic_defined.d b/ld/testsuite/ld-aarch64/pcrel_pic_defined.d
new file mode 100644
index 0000000..743e810
--- /dev/null
+++ b/ld/testsuite/ld-aarch64/pcrel_pic_defined.d
@@ -0,0 +1,10 @@
+#name: PC-Rel relocation against defined
+#source: pcrel.s
+#ld: -shared -e0 -defsym global_a=0x1000 -defsym global_b=0x2000
+#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21_NC against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_ADR_PREL_LO21 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_LD_PREL_LO19 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_PREL16 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_PREL32 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_PREL64 against symbol `global_a.*bind externally.*fPIC.*
diff --git a/ld/testsuite/ld-aarch64/pcrel_pic_defined_local.d b/ld/testsuite/ld-aarch64/pcrel_pic_defined_local.d
deleted file mode 100644
index 832652f..0000000
--- a/ld/testsuite/ld-aarch64/pcrel_pic_defined_local.d
+++ /dev/null
@@ -1,5 +0,0 @@
-#name: PC-Rel relocation against defined
-#source: pcrel.s
-#objdump: -r
-#ld: -shared -e0 -defsym global_a=0x1000
-#...
diff --git a/ld/testsuite/ld-aarch64/pcrel_pic_undefined.d b/ld/testsuite/ld-aarch64/pcrel_pic_undefined.d
index de7f020..f7f048d 100644
--- a/ld/testsuite/ld-aarch64/pcrel_pic_undefined.d
+++ b/ld/testsuite/ld-aarch64/pcrel_pic_undefined.d
@@ -1,10 +1,10 @@
#name: PC-Rel relocation against undefined
#source: pcrel.s
-#ld: -shared -e0
-#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21_NC against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_ADR_PREL_LO21 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_LD_PREL_LO19 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_PREL16 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_PREL32 against external symbol.*fPIC.*
-#warning: .*: relocation R_AARCH64_PREL64 against external symbol.*fPIC.*
+#ld: -shared -e0 -defsym global_b=0x2000
+#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_ADR_PREL_PG_HI21_NC against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_ADR_PREL_LO21 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_LD_PREL_LO19 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_PREL16 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_PREL32 against symbol `global_a.*bind externally.*fPIC.*
+#warning: .*: relocation R_AARCH64_PREL64 against symbol `global_a.*bind externally.*fPIC.*
diff --git a/ld/testsuite/ld-arc/tls_ie-01.d b/ld/testsuite/ld-arc/tls_ie-01.d
index 304973c..62b3932 100644
--- a/ld/testsuite/ld-arc/tls_ie-01.d
+++ b/ld/testsuite/ld-arc/tls_ie-01.d
@@ -1,10 +1,10 @@
#source: tls_ie-01.s
#as: -mcpu=arc700
-#ld:
+#ld: -static
#objdump: -s -j .got
#xfail: arc*-*-elf*
[^:]+: file format elf32-littlearc
Contents of section \.got:
- [0-9a-f]+ 00000000 04000000 .+
+ [0-9a-f]+ 08000000 0c000000 +.+
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 2e19332..b15316c 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -412,6 +412,12 @@ set armeabitests_common {
{"EABI attribute merging 10" "-r" "" "" {attr-merge-10a.s attr-merge-10b.s}
{{readelf -A attr-merge-10.attr}}
"attr-merge-10"}
+ {"EABI attribute merging 11" "-r" "" "" {attr-merge-11a.s attr-merge-11b.s}
+ {{readelf -A attr-merge-11.attr}}
+ "attr-merge-11"}
+ {"EABI attribute merging 12" "-r" "" "" {attr-merge-12a.s attr-merge-12b.s}
+ {{readelf -A attr-merge-12.attr}}
+ "attr-merge-12"}
{"EABI attribute merging 10 (DSP)" "-r" "" "" {attr-merge-10a.s attr-merge-10b-dsp.s}
{{readelf -A attr-merge-10-dsp.attr}}
"attr-merge-10-dsp"}
diff --git a/ld/testsuite/ld-arm/attr-merge-11.attr b/ld/testsuite/ld-arm/attr-merge-11.attr
new file mode 100644
index 0000000..0ca6dd3
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-11.attr
@@ -0,0 +1,9 @@
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_name: "8-A"
+ Tag_CPU_arch: v8
+ Tag_CPU_arch_profile: Realtime
+ Tag_ARM_ISA_use: Yes
+ Tag_THUMB_ISA_use: Thumb-2
+ Tag_MPextension_use: Allowed
+ Tag_Virtualization_use: TrustZone and Virtualization Extensions
diff --git a/ld/testsuite/ld-arm/attr-merge-11a.s b/ld/testsuite/ld-arm/attr-merge-11a.s
new file mode 100644
index 0000000..210fbdc
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-11a.s
@@ -0,0 +1,5 @@
+ .arch armv8-a
+
+ @ Tag_CPU_arch & Tag_CPU_arch_profile = v8 || v8-R
+ .eabi_attribute Tag_CPU_arch, 14
+ .eabi_attribute Tag_CPU_arch_profile, 'S'
diff --git a/ld/testsuite/ld-arm/attr-merge-11b.s b/ld/testsuite/ld-arm/attr-merge-11b.s
new file mode 100644
index 0000000..1bd37c8
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-11b.s
@@ -0,0 +1,5 @@
+ .arch armv8-r
+
+ @ Tag_CPU_arch & Tag_CPU_arch_profile = v8-R
+ .eabi_attribute Tag_CPU_arch, 15
+ .eabi_attribute Tag_CPU_arch_profile, 'R'
diff --git a/ld/testsuite/ld-arm/attr-merge-12.attr b/ld/testsuite/ld-arm/attr-merge-12.attr
new file mode 100644
index 0000000..77596ba
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-12.attr
@@ -0,0 +1,9 @@
+Attribute Section: aeabi
+File Attributes
+ Tag_CPU_name: "8-R"
+ Tag_CPU_arch: v8-R
+ Tag_CPU_arch_profile: Realtime
+ Tag_ARM_ISA_use: Yes
+ Tag_THUMB_ISA_use: Thumb-2
+ Tag_MPextension_use: Allowed
+ Tag_Virtualization_use: TrustZone and Virtualization Extensions
diff --git a/ld/testsuite/ld-arm/attr-merge-12a.s b/ld/testsuite/ld-arm/attr-merge-12a.s
new file mode 100644
index 0000000..27a7c35
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-12a.s
@@ -0,0 +1,5 @@
+ .arch armv8-r
+
+ @ Tag_CPU_arch & Tag_CPU_arch_profile = v7-R
+ .eabi_attribute Tag_CPU_arch, 10
+ .eabi_attribute Tag_CPU_arch_profile, 'R'
diff --git a/ld/testsuite/ld-arm/attr-merge-12b.s b/ld/testsuite/ld-arm/attr-merge-12b.s
new file mode 100644
index 0000000..1bd37c8
--- /dev/null
+++ b/ld/testsuite/ld-arm/attr-merge-12b.s
@@ -0,0 +1,5 @@
+ .arch armv8-r
+
+ @ Tag_CPU_arch & Tag_CPU_arch_profile = v8-R
+ .eabi_attribute Tag_CPU_arch, 15
+ .eabi_attribute Tag_CPU_arch_profile, 'R'
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index f889070..80a8c42 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -178,6 +178,10 @@ if { [check_shared_lib_support] } then {
{pr20995a.s} {{readelf {-S --wide} pr20995.r}} "pr20995-2"]]
}
+if [is_underscore_target] {
+ set ASFLAGS "$ASFLAGS --defsym UNDERSCORE=1"
+}
+
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
diff --git a/ld/testsuite/ld-elf/group11.d b/ld/testsuite/ld-elf/group11.d
new file mode 100644
index 0000000..245cf440
--- /dev/null
+++ b/ld/testsuite/ld-elf/group11.d
@@ -0,0 +1,6 @@
+#source: group1a.s
+#source: group1b.s
+#ld: -r --force-group-allocation
+#readelf: -g
+
+There are no section groups in this file.
diff --git a/ld/testsuite/ld-elf/group12.d b/ld/testsuite/ld-elf/group12.d
new file mode 100644
index 0000000..3fa7be8
--- /dev/null
+++ b/ld/testsuite/ld-elf/group12.d
@@ -0,0 +1,6 @@
+#source: group1a.s
+#source: group1b.s
+#ld: -r -T group12.ld
+#readelf: -g
+
+There are no section groups in this file.
diff --git a/ld/testsuite/ld-elf/group12.ld b/ld/testsuite/ld-elf/group12.ld
new file mode 100644
index 0000000..4a36ee5
--- /dev/null
+++ b/ld/testsuite/ld-elf/group12.ld
@@ -0,0 +1,14 @@
+FORCE_GROUP_ALLOCATION
+
+PHDRS
+{
+ header PT_PHDR PHDRS ;
+ image PT_LOAD PHDRS;
+}
+
+SECTIONS
+{
+ . = 0x1000;
+ .text : { *(.text) *(.rodata.brlt) } :image :header
+ /DISCARD/ : { *(.dropme) *(.reginfo) *(.MIPS.abiflags) }
+}
diff --git a/ld/testsuite/ld-elf/now-3.d b/ld/testsuite/ld-elf/now-3.d
index 687885a..fa98065 100644
--- a/ld/testsuite/ld-elf/now-3.d
+++ b/ld/testsuite/ld-elf/now-3.d
@@ -1,6 +1,6 @@
#source: start.s
#readelf: -d -W
-#ld: -shared -z now
+#ld: -shared -z now --disable-new-dtags
#target: *-*-linux* *-*-gnu*
#failif
diff --git a/ld/testsuite/ld-elf/now-4.d b/ld/testsuite/ld-elf/now-4.d
index 8d9d02f..421063d 100644
--- a/ld/testsuite/ld-elf/now-4.d
+++ b/ld/testsuite/ld-elf/now-4.d
@@ -1,6 +1,6 @@
#source: start.s
#readelf: -d -W
-#ld: -shared -z now
+#ld: -shared -z now --disable-new-dtags
#target: *-*-linux* *-*-gnu*
#...
diff --git a/ld/testsuite/ld-elf/pr14156a.d b/ld/testsuite/ld-elf/pr14156a.d
index efdc846..ffc6bfc 100644
--- a/ld/testsuite/ld-elf/pr14156a.d
+++ b/ld/testsuite/ld-elf/pr14156a.d
@@ -10,6 +10,7 @@
#...
[0-9a-f]+ T foo
[0-9a-f]+ t foo1
+#...
[0-9a-f]+ t foo2
[0-9a-f]+ t foo3
[0-9a-f]+ t last
diff --git a/ld/testsuite/ld-elf/pr21562a.d b/ld/testsuite/ld-elf/pr21562a.d
new file mode 100644
index 0000000..ecf013f
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562a.d
@@ -0,0 +1,12 @@
+#ld: -shared -z defs --gc-sections
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562a.s b/ld/testsuite/ld-elf/pr21562a.s
new file mode 100644
index 0000000..a9ac1fb
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562a.s
@@ -0,0 +1,12 @@
+ .section scnfoo,"aw",%progbits
+ .zero 0x10
+
+ .globl bar
+ .data
+ .type bar, %object
+bar:
+ .ifdef UNDERSCORE
+ .dc.a ___start_scnfoo
+ .else
+ .dc.a __start_scnfoo
+ .endif
diff --git a/ld/testsuite/ld-elf/pr21562a.t b/ld/testsuite/ld-elf/pr21562a.t
new file mode 100644
index 0000000..5e05ab3
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562a.t
@@ -0,0 +1,3 @@
+SECTIONS {
+ scnfoo : { *(scnfoo) }
+}
diff --git a/ld/testsuite/ld-elf/pr21562b.d b/ld/testsuite/ld-elf/pr21562b.d
new file mode 100644
index 0000000..063a141
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562b.d
@@ -0,0 +1,12 @@
+#ld: -shared -z defs --gc-sections
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562b.s b/ld/testsuite/ld-elf/pr21562b.s
new file mode 100644
index 0000000..d79694c
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562b.s
@@ -0,0 +1,12 @@
+ .section scnfoo,"aw",%progbits
+ .zero 0x10
+
+ .globl bar
+ .data
+ .type bar, %object
+bar:
+ .ifdef UNDERSCORE
+ .dc.a ___stop_scnfoo
+ .else
+ .dc.a __stop_scnfoo
+ .endif
diff --git a/ld/testsuite/ld-elf/pr21562b.t b/ld/testsuite/ld-elf/pr21562b.t
new file mode 100644
index 0000000..b30b521
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562b.t
@@ -0,0 +1,5 @@
+SECTIONS {
+ PROVIDE (__start_scnfoo = .);
+ scnfoo : { *(scnfoo) }
+ PROVIDE (__stop_scnfoo = .);
+}
diff --git a/ld/testsuite/ld-elf/pr21562c.d b/ld/testsuite/ld-elf/pr21562c.d
new file mode 100644
index 0000000..1d72a0d
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562c.d
@@ -0,0 +1,13 @@
+#source: pr21562a.s
+#ld: -shared -z defs --gc-sections -T pr21562a.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562c.t b/ld/testsuite/ld-elf/pr21562c.t
new file mode 100644
index 0000000..f9cb901
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562c.t
@@ -0,0 +1,7 @@
+SECTIONS {
+ .foo : {
+ PROVIDE (__start_scnfoo = .);
+ *(scnfoo)
+ PROVIDE (__stop_scnfoo = .);
+ }
+}
diff --git a/ld/testsuite/ld-elf/pr21562d.d b/ld/testsuite/ld-elf/pr21562d.d
new file mode 100644
index 0000000..f752a24
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562d.d
@@ -0,0 +1,13 @@
+#source: pr21562b.s
+#ld: -shared -z defs --gc-sections -T pr21562a.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562d.t b/ld/testsuite/ld-elf/pr21562d.t
new file mode 100644
index 0000000..c0cea61
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562d.t
@@ -0,0 +1,5 @@
+SECTIONS {
+ PROVIDE (__start_scnfoo = .);
+ .foo : { *(scnfoo) }
+ PROVIDE (__stop_scnfoo = .);
+}
diff --git a/ld/testsuite/ld-elf/pr21562e.d b/ld/testsuite/ld-elf/pr21562e.d
new file mode 100644
index 0000000..769f2f8
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562e.d
@@ -0,0 +1,10 @@
+#source: pr21562a.s
+#ld: -shared -z defs
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562f.d b/ld/testsuite/ld-elf/pr21562f.d
new file mode 100644
index 0000000..cb81c2a
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562f.d
@@ -0,0 +1,10 @@
+#source: pr21562b.s
+#ld: -shared -z defs
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562g.d b/ld/testsuite/ld-elf/pr21562g.d
new file mode 100644
index 0000000..9926416
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562g.d
@@ -0,0 +1,10 @@
+#source: pr21562a.s
+#ld: -shared -z defs -T pr21562a.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562h.d b/ld/testsuite/ld-elf/pr21562h.d
new file mode 100644
index 0000000..1e723ba
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562h.d
@@ -0,0 +1,10 @@
+#source: pr21562b.s
+#ld: -shared -z defs -T pr21562a.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562i.d b/ld/testsuite/ld-elf/pr21562i.d
new file mode 100644
index 0000000..f5b59c5
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562i.d
@@ -0,0 +1,13 @@
+#source: pr21562a.s
+#ld: -shared -z defs --gc-sections -T pr21562b.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562j.d b/ld/testsuite/ld-elf/pr21562j.d
new file mode 100644
index 0000000..70e311e
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562j.d
@@ -0,0 +1,13 @@
+#source: pr21562b.s
+#ld: -shared -z defs --gc-sections -T pr21562b.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562k.d b/ld/testsuite/ld-elf/pr21562k.d
new file mode 100644
index 0000000..4c62eb7
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562k.d
@@ -0,0 +1,13 @@
+#source: pr21562a.s
+#ld: -shared -z defs --gc-sections -T pr21562c.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562l.d b/ld/testsuite/ld-elf/pr21562l.d
new file mode 100644
index 0000000..b0ba90d
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562l.d
@@ -0,0 +1,13 @@
+#source: pr21562b.s
+#ld: -shared -z defs --gc-sections -T pr21562c.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562m.d b/ld/testsuite/ld-elf/pr21562m.d
new file mode 100644
index 0000000..fbcf76f
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562m.d
@@ -0,0 +1,13 @@
+#source: pr21562a.s
+#ld: -shared -z defs --gc-sections -T pr21562d.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/pr21562n.d b/ld/testsuite/ld-elf/pr21562n.d
new file mode 100644
index 0000000..2453169
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr21562n.d
@@ -0,0 +1,13 @@
+#source: pr21562b.s
+#ld: -shared -z defs --gc-sections -T pr21562d.t
+#readelf: -s -S --wide
+#target: *-*-linux* *-*-gnu*
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+# generic linker targets don't support --gc-sections, nor do a bunch of others
+
+#...
+ \[[ 0-9]+\] \.foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/rpath-1.d b/ld/testsuite/ld-elf/rpath-1.d
index 918a326..38d6eab 100644
--- a/ld/testsuite/ld-elf/rpath-1.d
+++ b/ld/testsuite/ld-elf/rpath-1.d
@@ -1,6 +1,6 @@
#source: start.s
#readelf: -d -W
-#ld: -shared -rpath .
+#ld: -shared -rpath=. --disable-new-dtags
#target: *-*-linux* *-*-gnu*
#failif
diff --git a/ld/testsuite/ld-elf/rpath-2.d b/ld/testsuite/ld-elf/rpath-2.d
index 17be86d..d4c75ff 100644
--- a/ld/testsuite/ld-elf/rpath-2.d
+++ b/ld/testsuite/ld-elf/rpath-2.d
@@ -1,6 +1,6 @@
#source: start.s
#readelf: -d -W
-#ld: -shared -rpath .
+#ld: -shared -rpath=. --disable-new-dtags
#target: *-*-linux* *-*-gnu*
#...
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 070b51a..8b139ec 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -31,6 +31,9 @@ if ![check_shared_lib_support] {
return
}
+# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
+global NOPIE_CFLAGS NOPIE_LDFLAGS
+
# This target requires extra GAS options when building code for shared
# libraries.
set AFLAGS_PIC ""
@@ -382,10 +385,10 @@ set build_tests {
"" ""
{pr2404b.c} {} "libpr2404b.a"}
{"Build rdynamic-1"
- "-Wl,-export-dynamic,--gc-sections" "-ffunction-sections"
+ "-Wl,--no-dynamic-linker,-export-dynamic,--gc-sections" "-ffunction-sections"
{rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
{"Build dynamic-1"
- "-Wl,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
+ "-Wl,--no-dynamic-linker,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
{dynamic-1.c} {{readelf {-s} dynamic-1.rd}} "dynamic-1"}
{"Build libpr16496a.so"
"-shared -Wl,--version-script=pr16496a.map" "-fPIC"
@@ -554,8 +557,8 @@ set dlopen_run_tests [list \
"-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
{dl6amain.c} "dl6a1" "dl6a.out" ] \
[list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
- {dl6amain.c} "dl6a2" "dl6b.out" ] \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
+ {dl6amain.c} "dl6a2" "dl6b.out" "$NOPIE_CFLAGS" ] \
[list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \
"-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \
{dl6amain.c} "dl6a3" "dl6b.out" ] \
@@ -563,14 +566,14 @@ set dlopen_run_tests [list \
"-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \
{dl6amain.c} "dl6a4" "dl6a.out" ] \
[list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
- {dl6amain.c} "dl6a5" "dl6b.out" ] \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
+ {dl6amain.c} "dl6a5" "dl6b.out" "$NOPIE_CFLAGS" ] \
[list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
- {dl6amain.c} "dl6a6" "dl6b.out" ] \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
+ {dl6amain.c} "dl6a6" "dl6b.out" "$NOPIE_CFLAGS" ] \
[list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
- {dl6amain.c} "dl6a7" "dl6a.out" ] \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
+ {dl6amain.c} "dl6a7" "dl6a.out" "$NOPIE_CFLAGS" ] \
[list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \
"-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
{dl6bmain.c} "dl6b1" "dl6a.out" ] \
diff --git a/ld/testsuite/ld-elf/sizeof.s b/ld/testsuite/ld-elf/sizeof.s
new file mode 100644
index 0000000..c275549
--- /dev/null
+++ b/ld/testsuite/ld-elf/sizeof.s
@@ -0,0 +1,15 @@
+ .section scnfoo,"aw",%progbits
+ .zero 0x10
+
+ .globl bar
+ .data
+ .align 8
+ .type bar, %object
+ .size bar, 8
+bar:
+ .ifdef UNDERSCORE
+ .dc.a ___stop_scnfoo
+ .else
+ .dc.a __stop_scnfoo
+ .endif
+ .dc.a .sizeof. (scnfoo)
diff --git a/ld/testsuite/ld-elf/sizeofa.d b/ld/testsuite/ld-elf/sizeofa.d
new file mode 100644
index 0000000..572ffbd
--- /dev/null
+++ b/ld/testsuite/ld-elf/sizeofa.d
@@ -0,0 +1,12 @@
+#source: sizeof.s
+#ld: -Ur
+#readelf: -sW
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +(LOC|GLOB)AL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.sizeof.scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/sizeofb.d b/ld/testsuite/ld-elf/sizeofb.d
new file mode 100644
index 0000000..ac4a6a4
--- /dev/null
+++ b/ld/testsuite/ld-elf/sizeofb.d
@@ -0,0 +1,13 @@
+#source: sizeof.s
+#ld: -shared
+#readelf: -sW
+#target: *-*-linux* *-*-gnu*
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?stop_scnfoo
+#...
+ +[0-9]+: 0+10 + +0 +NOTYPE +LOCAL +DEFAULT +ABS +.sizeof.scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/sizeofc.d b/ld/testsuite/ld-elf/sizeofc.d
new file mode 100644
index 0000000..5078741
--- /dev/null
+++ b/ld/testsuite/ld-elf/sizeofc.d
@@ -0,0 +1,12 @@
+#source: sizeof.s
+#ld: -r
+#readelf: -sW
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +___?stop_scnfoo
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.sizeof.scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/startof.s b/ld/testsuite/ld-elf/startof.s
new file mode 100644
index 0000000..a1bb465
--- /dev/null
+++ b/ld/testsuite/ld-elf/startof.s
@@ -0,0 +1,15 @@
+ .section scnfoo,"aw",%progbits
+ .zero 0x10
+
+ .globl bar
+ .data
+ .align 8
+ .type bar, %object
+ .size bar, 8
+bar:
+ .ifdef UNDERSCORE
+ .dc.a ___start_scnfoo
+ .else
+ .dc.a __start_scnfoo
+ .endif
+ .dc.a .startof. (scnfoo)
diff --git a/ld/testsuite/ld-elf/startofa.d b/ld/testsuite/ld-elf/startofa.d
new file mode 100644
index 0000000..07d5dda
--- /dev/null
+++ b/ld/testsuite/ld-elf/startofa.d
@@ -0,0 +1,12 @@
+#source: startof.s
+#ld: -Ur
+#readelf: -sW
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +(LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo|GLOBAL +DEFAULT +UND +.startof.scnfoo)
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +(UND +.startof.scnfoo|[0-9]+ +___?start_scnfoo)
+#pass
diff --git a/ld/testsuite/ld-elf/startofb.d b/ld/testsuite/ld-elf/startofb.d
new file mode 100644
index 0000000..5d659bb
--- /dev/null
+++ b/ld/testsuite/ld-elf/startofb.d
@@ -0,0 +1,13 @@
+#source: startof.s
+#ld: -shared
+#readelf: -sW
+#target: *-*-linux* *-*-gnu*
+
+Symbol table '\.dynsym' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +.startof.scnfoo
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elf/startofc.d b/ld/testsuite/ld-elf/startofc.d
new file mode 100644
index 0000000..0250892
--- /dev/null
+++ b/ld/testsuite/ld-elf/startofc.d
@@ -0,0 +1,12 @@
+#source: startof.s
+#ld: -r
+#readelf: -sW
+
+Symbol table '\.symtab' contains [0-9]+ entries:
+ +Num: +Value +Size Type +Bind +Vis +Ndx Name
+ +0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +.startof.scnfoo
+#...
+ +[0-9]+: +[a-f0-9]+ +0 +(NOTYPE|OBJECT) +GLOBAL +DEFAULT +UND +___?start_scnfoo
+#pass
diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp
index a2c3ef7..7552f7a 100644
--- a/ld/testsuite/ld-elfvsb/elfvsb.exp
+++ b/ld/testsuite/ld-elfvsb/elfvsb.exp
@@ -236,6 +236,7 @@ proc visibility_run {visibility} {
global support_protected
global shared_needs_pic
global PLT_CFLAGS
+ global NOPIE_CFLAGS
global COMPRESS_LDFLAG
if [ string match $visibility "hidden" ] {
@@ -285,8 +286,8 @@ proc visibility_run {visibility} {
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
- if { ![ld_compile "$CC -g $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
- || ![ld_compile "$CC -g $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
+ if { ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
+ || ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unresolved "visibility ($visibility) (non PIC)"
} else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o xcoff
diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp
index ba5c46b..083b77c 100644
--- a/ld/testsuite/ld-gc/gc.exp
+++ b/ld/testsuite/ld-gc/gc.exp
@@ -26,6 +26,9 @@ if ![check_gc_sections_available] {
set cflags "-ffunction-sections -fdata-sections"
set objfile "tmpdir/gc.o"
+# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
+global NOPIE_CFLAGS NOPIE_LDFLAGS
+
if [istarget powerpc64*-*-*] {
# otherwise with -mcmodel=medium gcc we get XPASSes.
set cflags "$cflags -mminimal-toc"
@@ -119,6 +122,12 @@ if { [is_elf_format] && [check_shared_lib_support] } then {
run_dump_test "personality"
}
run_dump_test "pr18223"
+ if {![ld_assemble_flags $as $gasopt $srcdir/$subdir/pr20022a.s tmpdir/pr20022a.o]
+ || ![ld_link $ld tmpdir/pr20022.so "-shared --gc-sections tmpdir/pr20022a.o"] } then {
+ fail pr20022
+ } else {
+ run_dump_test "pr20022"
+ }
}
if { [is_remote host] || [which $CC] != 0 } {
@@ -138,7 +147,7 @@ if { [is_remote host] || [which $CC] != 0 } {
}
if { [is_remote host] || [which $CC] != 0 } {
- ld_compile "$CC $CFLAGS $cflags" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o
+ ld_compile "$CC $CFLAGS $cflags $NOPIE_CFLAGS" $srcdir/$subdir/pr14265.c tmpdir/pr14265.o
run_dump_test "pr14265"
}
diff --git a/ld/testsuite/ld-gc/pr19161.d b/ld/testsuite/ld-gc/pr19161.d
index c36e663..baee8da 100644
--- a/ld/testsuite/ld-gc/pr19161.d
+++ b/ld/testsuite/ld-gc/pr19161.d
@@ -6,5 +6,5 @@
#xfail: mips64vr-*-* msp430-*-* powerpc*-*-eabivle rl78-*-* rx-*-* sh*-*-*
#...
-0*[1-9a-f]+[0-9a-f]*[ ](D)[ ]_*__start_my_section
+0*[1-9a-f]+[0-9a-f]*[ ](d|D)[ ]_*__start_my_section
#...
diff --git a/ld/testsuite/ld-gc/pr20022.d b/ld/testsuite/ld-gc/pr20022.d
new file mode 100644
index 0000000..906f73d
--- /dev/null
+++ b/ld/testsuite/ld-gc/pr20022.d
@@ -0,0 +1,13 @@
+#source: pr20022b.s
+#ld: --gc-sections -e _start tmpdir/pr20022.so
+#readelf: -SsW
+#target: *-*-linux* *-*-gnu*
+#notarget: *-*-*aout *-*-*oldld frv-*-linux* metag-*-linux*
+#notarget: mips*-*-*
+# Skip on targets without dynamic relocations in .text section.
+
+#...
+ \[[ 0-9]+\] _foo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +[0-9a-f]+[ \t]+.*
+#...
+ +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start__foo
+#pass
diff --git a/ld/testsuite/ld-gc/pr20022a.s b/ld/testsuite/ld-gc/pr20022a.s
new file mode 100644
index 0000000..5c0e19f
--- /dev/null
+++ b/ld/testsuite/ld-gc/pr20022a.s
@@ -0,0 +1,9 @@
+ .data
+ .globl bar
+ .type bar,%object
+bar:
+ .dc.a __start__foo
+ .size bar, .-bar
+ .section _foo,"aw",%progbits
+foo:
+ .ascii "This is bar"
diff --git a/ld/testsuite/ld-gc/pr20022b.s b/ld/testsuite/ld-gc/pr20022b.s
new file mode 100644
index 0000000..2306c59
--- /dev/null
+++ b/ld/testsuite/ld-gc/pr20022b.s
@@ -0,0 +1,8 @@
+ .text
+ .globl _start
+_start:
+ .dc.a __start__foo
+ .dc.a bar
+ .section _foo,"aw",%progbits
+foo:
+ .ascii "This is foo"
diff --git a/ld/testsuite/ld-gc/start.d b/ld/testsuite/ld-gc/start.d
index 18e74c1..9113b48 100644
--- a/ld/testsuite/ld-gc/start.d
+++ b/ld/testsuite/ld-gc/start.d
@@ -5,5 +5,5 @@
#notarget: *-*-*aout *-*-*oldld frv-*-linux* metag-*-linux*
#...
-[0-9a-f]+ D +__start__foo
+[0-9a-f]+ d +__start__foo
#...
diff --git a/ld/testsuite/ld-i386/call3c.d b/ld/testsuite/ld-i386/call3c.d
index 0fdbee4..f869dcc 100644
--- a/ld/testsuite/ld-i386/call3c.d
+++ b/ld/testsuite/ld-i386/call3c.d
@@ -1,14 +1,4 @@
#source: call3.s
#as: --32 -mrelax-relocations=yes
#ld: -melf_i386 -z call-nop=prefix-nop
-#objdump: -dw
-
-.*: +file format .*
-
-
-Disassembly of section .text:
-
-#...
-[ ]*[a-f0-9]+: 90 nop
-[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * call +[a-f0-9]+ <foo>
-#pass
+#error: invalid number for -z call-nop=prefix-: nop
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp
index a92bd91..6c53046 100644
--- a/ld/testsuite/ld-i386/i386.exp
+++ b/ld/testsuite/ld-i386/i386.exp
@@ -420,6 +420,20 @@ run_dump_test "pr20515"
run_dump_test "property-x86-3"
run_dump_test "property-x86-4a"
run_dump_test "property-x86-4b"
+run_dump_test "property-x86-ibt1a"
+run_dump_test "property-x86-ibt1b"
+run_dump_test "property-x86-ibt2"
+run_dump_test "property-x86-ibt3a"
+run_dump_test "property-x86-ibt3b"
+run_dump_test "property-x86-ibt4"
+run_dump_test "property-x86-ibt5"
+run_dump_test "property-x86-shstk1a"
+run_dump_test "property-x86-shstk1b"
+run_dump_test "property-x86-shstk2"
+run_dump_test "property-x86-shstk3a"
+run_dump_test "property-x86-shstk3b"
+run_dump_test "property-x86-shstk4"
+run_dump_test "property-x86-shstk5"
if { !([istarget "i?86-*-linux*"]
|| [istarget "i?86-*-gnu*"]
@@ -718,7 +732,7 @@ if { [isnative]
] \
[list \
"Build gotpc1" \
- "-Wl,--as-needed tmpdir/gotpc1.o tmpdir/got1d.so" \
+ "$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/gotpc1.o tmpdir/got1d.so" \
"" \
{ dummy.s } \
{{objdump {-dw} got1.dd}} \
@@ -972,15 +986,16 @@ if { [isnative]
] \
[list \
"Run pr19031" \
- "tmpdir/pr19031.so" \
+ "$NOPIE_LDFLAGS tmpdir/pr19031.so" \
"" \
{ pr19031b.S pr19031c.c } \
"pr19031" \
"pr19031.out" \
+ "$NOPIE_CFLAGS" \
] \
[list \
"Run got1" \
- "tmpdir/got1d.so" \
+ "$NOPIE_LDFLAGS tmpdir/got1d.so" \
"" \
{ got1a.S got1b.c got1c.c } \
"got1" \
@@ -1093,13 +1108,15 @@ if { [isnative]
] \
]
- undefined_weak "" ""
- undefined_weak "-fPIE" ""
+ undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
+ undefined_weak "-fPIE" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" "-pie"
- undefined_weak "-fPIE" "-z nodynamic-undefined-weak"
+ undefined_weak "-fPIE" "-z nodynamic-undefined-weak $NOPIE_LDFLAGS"
undefined_weak "-fPIE" "-pie -z nodynamic-undefined-weak"
}
+global NOPIE_CFLAGS NOPIE_LDFLAGS
+
# Must be native with the C compiler and working IFUNC support,
if { [isnative]
&& [check_ifunc_available]
@@ -1156,6 +1173,92 @@ if { [isnative]
"pass.out" \
] \
]
+
+ if { [istarget "i?86-*-linux*"] } {
+ run_cc_link_tests [list \
+ [list \
+ "Build pr21168.so with -z ibtplt" \
+ "-shared -Wl,-z,ibtplt" \
+ "" \
+ { pr21168b.S } \
+ "" \
+ "pr21168-ibt.so" \
+ ] \
+ [list \
+ "Build ifunc-1a with -z ibtplt" \
+ "-Wl,-z,ibtplt $NOPIE_LDFLAGS tmpdir/ifunc-1a.o \
+ tmpdir/ifunc-1b.o tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \
+ "" \
+ { dummy.c } \
+ {{objdump {-dw} plt-main-ibt.dd}} \
+ "ifunc-1a-ibt" \
+ ] \
+ [list \
+ "Build ifunc-1a with PIE -z ibtplt" \
+ "-Wl,-z,ibtplt -pie tmpdir/ifunc-1a.o \
+ tmpdir/ifunc-1b.o tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \
+ "" \
+ { dummy.c } \
+ {{objdump {-dw} plt-pie-ibt.dd}} \
+ "ifunc-1a-pie-ibt" \
+ ] \
+ ]
+
+ run_ld_link_exec_tests [list \
+ [list \
+ "Run ifunc-1a with -z ibtplt" \
+ "-Wl,-z,ibtplt $NOPIE_LDFLAGS tmpdir/ifunc-1a.o \
+ tmpdir/ifunc-1b.o tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \
+ "" \
+ { dummy.c } \
+ "ifunc-1a-ibt" \
+ "pass.out" \
+ ] \
+ [list \
+ "Run ifunc-1a with PIE -z ibtplt" \
+ "-Wl,-z,ibtplt -pie tmpdir/ifunc-1a.o \
+ tmpdir/ifunc-1b.o tmpdir/ifunc-1c.o tmpdir/ifunc-1d.o" \
+ "" \
+ { dummy.c } \
+ "ifunc-1a-pie-ibt" \
+ "pass.out" \
+ ] \
+ [list \
+ "Run pr21168 with -z ibtplt" \
+ "tmpdir/pr21168a.o tmpdir/pr21168-ibt.so" \
+ "" \
+ { dummy.c } \
+ "pr21168-ibt" \
+ "pass.out" \
+ ] \
+ ]
+ }
+}
+
+# Must be native with the C compiler.
+if { [isnative]
+ && [istarget "i?86-*-*"]
+ && [which $CC] != 0 } {
+ run_ld_link_exec_tests [list \
+ [list \
+ "Run weakundef1 without PIE" \
+ "$NOPIE_LDFLAGS" \
+ "" \
+ { weakundef1.c } \
+ "weakundef1pie" \
+ "pass.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run weakundef1 with PIE" \
+ "-pie" \
+ "" \
+ { weakundef1.c } \
+ "weakundef1pie" \
+ "pass.out" \
+ "-fPIE" \
+ ] \
+ ]
}
if { !([istarget "i?86-*-linux*"]
@@ -1182,9 +1285,36 @@ run_ld_link_tests [list \
{{objdump -dwr plt-pic2.dd}} \
"plt-pic2.so" \
] \
+ [list \
+ "Build pr21626.so" \
+ "-shared -melf_i386" \
+ "" \
+ "--32" \
+ {property-x86-3.s} \
+ "" \
+ "pr21626.so" \
+ ] \
+ [list \
+ "Build pr21626" \
+ "-melf_i386 tmpdir/pr21626.so" \
+ "" \
+ "--32" \
+ {start.s foo.s} \
+ "" \
+ "pr21626" \
+ ] \
]
# Linux only tests
run_dump_test "pltgot-1"
run_dump_test "pltgot-2"
run_dump_test "pr20830"
+run_dump_test "ibt-plt-1"
+run_dump_test "ibt-plt-2a"
+run_dump_test "ibt-plt-2b"
+run_dump_test "ibt-plt-2c"
+run_dump_test "ibt-plt-2d"
+run_dump_test "ibt-plt-3a"
+run_dump_test "ibt-plt-3b"
+run_dump_test "ibt-plt-3c"
+run_dump_test "ibt-plt-3d"
diff --git a/ld/testsuite/ld-i386/ibt-plt-1.d b/ld/testsuite/ld-i386/ibt-plt-1.d
new file mode 100644
index 0000000..1c90591
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-1.d
@@ -0,0 +1,51 @@
+#as: --32
+#ld: -shared -m elf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+1b0 <.plt>:
+ +[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
+ +[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 00 00 00 00 push \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 1b0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 08 00 00 00 push \$0x8
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 1b0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1e0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+0+1f0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+Disassembly of section .text:
+
+0+200 <foo>:
+ +[a-f0-9]+: 53 push %ebx
+ +[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx>
+ +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx
+ +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+ +[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt>
+ +[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt>
+ +[a-f0-9]+: 83 c4 08 add \$0x8,%esp
+ +[a-f0-9]+: 5b pop %ebx
+ +[a-f0-9]+: c3 ret
+
+0+21e <__x86.get_pc_thunk.bx>:
+ +[a-f0-9]+: 8b 1c 24 mov \(%esp\),%ebx
+ +[a-f0-9]+: c3 ret
+#pass
diff --git a/ld/testsuite/ld-i386/ibt-plt-1.s b/ld/testsuite/ld-i386/ibt-plt-1.s
new file mode 100644
index 0000000..80e2311
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-1.s
@@ -0,0 +1,54 @@
+ .text
+ .p2align 4,,15
+ .globl foo
+ .type foo, @function
+foo:
+.LFB0:
+ .cfi_startproc
+ pushl %ebx
+ .cfi_def_cfa_offset 8
+ .cfi_offset 3, -8
+ call __x86.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ subl $8, %esp
+ .cfi_def_cfa_offset 16
+ call bar2@PLT
+ call bar1@PLT
+ addl $8, %esp
+ .cfi_def_cfa_offset 8
+ popl %ebx
+ .cfi_restore 3
+ .cfi_def_cfa_offset 4
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
+ .section .note.GNU-stack,"",@progbits
+
+ .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
+ .globl __x86.get_pc_thunk.bx
+ .hidden __x86.get_pc_thunk.bx
+ .type __x86.get_pc_thunk.bx, @function
+__x86.get_pc_thunk.bx:
+.LFB1:
+ .cfi_startproc
+ movl (%esp), %ebx
+ ret
+ .cfi_endproc
+.LFE1:
+
+ .section ".note.gnu.property", "a"
+ .p2align 2
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 2
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1
+4:
+ .p2align 2
+5:
diff --git a/ld/testsuite/ld-i386/ibt-plt-2.s b/ld/testsuite/ld-i386/ibt-plt-2.s
new file mode 100644
index 0000000..500fdd2
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-2.s
@@ -0,0 +1,54 @@
+ .text
+ .p2align 4,,15
+ .globl foo
+ .type foo, @function
+foo:
+.LFB0:
+ .cfi_startproc
+ pushl %ebx
+ .cfi_def_cfa_offset 8
+ .cfi_offset 3, -8
+ call __x86.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ subl $8, %esp
+ .cfi_def_cfa_offset 16
+ call bar2@PLT
+ call bar1@PLT
+ addl $8, %esp
+ .cfi_def_cfa_offset 8
+ popl %ebx
+ .cfi_restore 3
+ .cfi_def_cfa_offset 4
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
+ .section .note.GNU-stack,"",@progbits
+
+ .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
+ .globl __x86.get_pc_thunk.bx
+ .hidden __x86.get_pc_thunk.bx
+ .type __x86.get_pc_thunk.bx, @function
+__x86.get_pc_thunk.bx:
+.LFB1:
+ .cfi_startproc
+ movl (%esp), %ebx
+ ret
+ .cfi_endproc
+.LFE1:
+
+ .section ".note.gnu.property", "a"
+ .p2align 2
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+ .p2align 2
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x0
+4:
+ .p2align 2
+5:
diff --git a/ld/testsuite/ld-i386/ibt-plt-2a.d b/ld/testsuite/ld-i386/ibt-plt-2a.d
new file mode 100644
index 0000000..4881dea
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-2a.d
@@ -0,0 +1,52 @@
+#source: ibt-plt-2.s
+#as: --32
+#ld: -shared -m elf_i386 -z ibtplt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+1b0 <.plt>:
+ +[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
+ +[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 00 00 00 00 push \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 1b0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 08 00 00 00 push \$0x8
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 1b0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1e0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+0+1f0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+Disassembly of section .text:
+
+0+200 <foo>:
+ +[a-f0-9]+: 53 push %ebx
+ +[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx>
+ +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx
+ +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+ +[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt>
+ +[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt>
+ +[a-f0-9]+: 83 c4 08 add \$0x8,%esp
+ +[a-f0-9]+: 5b pop %ebx
+ +[a-f0-9]+: c3 ret
+
+0+21e <__x86.get_pc_thunk.bx>:
+ +[a-f0-9]+: 8b 1c 24 mov \(%esp\),%ebx
+ +[a-f0-9]+: c3 ret
+#pass
diff --git a/ld/testsuite/ld-i386/ibt-plt-2b.d b/ld/testsuite/ld-i386/ibt-plt-2b.d
new file mode 100644
index 0000000..740b889
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-2b.d
@@ -0,0 +1,9 @@
+#source: ibt-plt-2.s
+#as: --32
+#ld: -shared -m elf_i386 -z ibtplt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature:
diff --git a/ld/testsuite/ld-i386/ibt-plt-2c.d b/ld/testsuite/ld-i386/ibt-plt-2c.d
new file mode 100644
index 0000000..2ba1d78
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-2c.d
@@ -0,0 +1,52 @@
+#source: ibt-plt-2.s
+#as: --32
+#ld: -shared -m elf_i386 -z ibt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+1b0 <.plt>:
+ +[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
+ +[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 00 00 00 00 push \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 1b0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 08 00 00 00 push \$0x8
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 1b0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1e0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+0+1f0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+Disassembly of section .text:
+
+0+200 <foo>:
+ +[a-f0-9]+: 53 push %ebx
+ +[a-f0-9]+: e8 18 00 00 00 call 21e <__x86.get_pc_thunk.bx>
+ +[a-f0-9]+: 81 c3 22 11 00 00 add \$0x1122,%ebx
+ +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+ +[a-f0-9]+: e8 dc ff ff ff call 1f0 <bar2@plt>
+ +[a-f0-9]+: e8 c7 ff ff ff call 1e0 <bar1@plt>
+ +[a-f0-9]+: 83 c4 08 add \$0x8,%esp
+ +[a-f0-9]+: 5b pop %ebx
+ +[a-f0-9]+: c3 ret
+
+0+21e <__x86.get_pc_thunk.bx>:
+ +[a-f0-9]+: 8b 1c 24 mov \(%esp\),%ebx
+ +[a-f0-9]+: c3 ret
+#pass
diff --git a/ld/testsuite/ld-i386/ibt-plt-2d.d b/ld/testsuite/ld-i386/ibt-plt-2d.d
new file mode 100644
index 0000000..3e02a62
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-2d.d
@@ -0,0 +1,9 @@
+#source: ibt-plt-2.s
+#as: --32
+#ld: -shared -m elf_i386 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-i386/ibt-plt-3.s b/ld/testsuite/ld-i386/ibt-plt-3.s
new file mode 100644
index 0000000..b52f2e7
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-3.s
@@ -0,0 +1,38 @@
+ .text
+ .p2align 4,,15
+ .globl foo
+ .type foo, @function
+foo:
+.LFB0:
+ .cfi_startproc
+ pushl %ebx
+ .cfi_def_cfa_offset 8
+ .cfi_offset 3, -8
+ call __x86.get_pc_thunk.bx
+ addl $_GLOBAL_OFFSET_TABLE_, %ebx
+ subl $8, %esp
+ .cfi_def_cfa_offset 16
+ call bar2@PLT
+ call bar1@PLT
+ addl $8, %esp
+ .cfi_def_cfa_offset 8
+ popl %ebx
+ .cfi_restore 3
+ .cfi_def_cfa_offset 4
+ ret
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
+ .section .note.GNU-stack,"",@progbits
+
+ .section .text.__x86.get_pc_thunk.bx,"axG",@progbits,__x86.get_pc_thunk.bx,comdat
+ .globl __x86.get_pc_thunk.bx
+ .hidden __x86.get_pc_thunk.bx
+ .type __x86.get_pc_thunk.bx, @function
+__x86.get_pc_thunk.bx:
+.LFB1:
+ .cfi_startproc
+ movl (%esp), %ebx
+ ret
+ .cfi_endproc
+.LFE1:
diff --git a/ld/testsuite/ld-i386/ibt-plt-3a.d b/ld/testsuite/ld-i386/ibt-plt-3a.d
new file mode 100644
index 0000000..c2ce3fd
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-3a.d
@@ -0,0 +1,52 @@
+#source: ibt-plt-3.s
+#as: --32
+#ld: -shared -m elf_i386 -z ibtplt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+190 <.plt>:
+ +[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
+ +[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 00 00 00 00 push \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 190 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 08 00 00 00 push \$0x8
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 190 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1c0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+0+1d0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+Disassembly of section .text:
+
+0+1e0 <foo>:
+ +[a-f0-9]+: 53 push %ebx
+ +[a-f0-9]+: e8 18 00 00 00 call 1fe <__x86.get_pc_thunk.bx>
+ +[a-f0-9]+: 81 c3 06 11 00 00 add \$0x1106,%ebx
+ +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+ +[a-f0-9]+: e8 dc ff ff ff call 1d0 <bar2@plt>
+ +[a-f0-9]+: e8 c7 ff ff ff call 1c0 <bar1@plt>
+ +[a-f0-9]+: 83 c4 08 add \$0x8,%esp
+ +[a-f0-9]+: 5b pop %ebx
+ +[a-f0-9]+: c3 ret
+
+0+1fe <__x86.get_pc_thunk.bx>:
+ +[a-f0-9]+: 8b 1c 24 mov \(%esp\),%ebx
+ +[a-f0-9]+: c3 ret
+#pass
diff --git a/ld/testsuite/ld-i386/ibt-plt-3b.d b/ld/testsuite/ld-i386/ibt-plt-3b.d
new file mode 100644
index 0000000..d9b5be2
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-3b.d
@@ -0,0 +1,5 @@
+#source: ibt-plt-3.s
+#as: --32
+#ld: -shared -m elf_i386 -z ibtplt
+#readelf: -n
+
diff --git a/ld/testsuite/ld-i386/ibt-plt-3c.d b/ld/testsuite/ld-i386/ibt-plt-3c.d
new file mode 100644
index 0000000..c2ce3fd
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-3c.d
@@ -0,0 +1,52 @@
+#source: ibt-plt-3.s
+#as: --32
+#ld: -shared -m elf_i386 -z ibtplt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+190 <.plt>:
+ +[a-f0-9]+: ff b3 04 00 00 00 pushl 0x4\(%ebx\)
+ +[a-f0-9]+: ff a3 08 00 00 00 jmp \*0x8\(%ebx\)
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%eax\)
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 00 00 00 00 push \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 190 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: 68 08 00 00 00 push \$0x8
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 190 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1c0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 0c 00 00 00 jmp \*0xc\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+0+1d0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fb endbr32
+ +[a-f0-9]+: ff a3 10 00 00 00 jmp \*0x10\(%ebx\)
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%eax,%eax,1\)
+
+Disassembly of section .text:
+
+0+1e0 <foo>:
+ +[a-f0-9]+: 53 push %ebx
+ +[a-f0-9]+: e8 18 00 00 00 call 1fe <__x86.get_pc_thunk.bx>
+ +[a-f0-9]+: 81 c3 06 11 00 00 add \$0x1106,%ebx
+ +[a-f0-9]+: 83 ec 08 sub \$0x8,%esp
+ +[a-f0-9]+: e8 dc ff ff ff call 1d0 <bar2@plt>
+ +[a-f0-9]+: e8 c7 ff ff ff call 1c0 <bar1@plt>
+ +[a-f0-9]+: 83 c4 08 add \$0x8,%esp
+ +[a-f0-9]+: 5b pop %ebx
+ +[a-f0-9]+: c3 ret
+
+0+1fe <__x86.get_pc_thunk.bx>:
+ +[a-f0-9]+: 8b 1c 24 mov \(%esp\),%ebx
+ +[a-f0-9]+: c3 ret
+#pass
diff --git a/ld/testsuite/ld-i386/ibt-plt-3d.d b/ld/testsuite/ld-i386/ibt-plt-3d.d
new file mode 100644
index 0000000..3cf159a
--- /dev/null
+++ b/ld/testsuite/ld-i386/ibt-plt-3d.d
@@ -0,0 +1,9 @@
+#source: ibt-plt-3.s
+#as: --32
+#ld: -shared -m elf_i386 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-i386/no-plt.exp b/ld/testsuite/ld-i386/no-plt.exp
index a37b9c4..7839390 100644
--- a/ld/testsuite/ld-i386/no-plt.exp
+++ b/ld/testsuite/ld-i386/no-plt.exp
@@ -39,6 +39,9 @@ if { [which $CC] == 0 } {
return
}
+# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
+global NOPIE_CFLAGS NOPIE_LDFLAGS
+
run_cc_link_tests [list \
[list \
"Build no-plt-func1.o no-plt-main1.o" \
@@ -73,7 +76,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1a)" \
- "tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1a.o" \
"" \
{dummy.s} \
@@ -91,7 +94,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1c)" \
- "tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1a.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"" \
{dummy.s} \
@@ -136,7 +139,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1h)" \
- "tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
"" \
{dummy.s} \
@@ -145,7 +148,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1i)" \
- "tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-extern1b.o tmpdir/libno-plt-1a.so" \
"" \
{dummy.s} \
@@ -229,7 +232,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"No PLT (dynamic 1h)" \
- "tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1b.o" \
"" \
{dummy.s} \
@@ -238,7 +241,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"No PLT (dynamic 1i)" \
- "tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1b.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-extern1b.o tmpdir/libno-plt-1a.so" \
"" \
{dummy.s} \
@@ -291,7 +294,7 @@ if { [check_ifunc_available] } {
run_ld_link_exec_tests [list \
[list \
"Run pr20244-3a" \
- "tmpdir/pr20244-3a.o tmpdir/pr20244-3b.o \
+ "$NOPIE_LDFLAGS tmpdir/pr20244-3a.o tmpdir/pr20244-3b.o \
tmpdir/pr20244-3c.o tmpdir/pr20244-3d.o" \
"" \
{ dummy.c } \
@@ -352,7 +355,7 @@ if { [check_ifunc_available] } {
] \
[list \
"Run pr20253-1f" \
- "tmpdir/pr20253-1a.o" \
+ "$NOPIE_LDFLAGS tmpdir/pr20253-1a.o" \
"" \
{ pr20253-1b.S pr20253-1c.S pr20253-1d.S } \
"pr20253-1f" \
@@ -370,7 +373,7 @@ if { [check_ifunc_available] } {
] \
[list \
"Run pr20253-2a" \
- "tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
+ "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o tmpdir/pr20253-2b.o \
tmpdir/pr20253-2c.o tmpdir/pr20253-2d.o" \
"" \
{ dummy.s } \
@@ -388,7 +391,7 @@ if { [check_ifunc_available] } {
] \
[list \
"Run pr20253-2c" \
- "tmpdir/pr20253-2a.o" \
+ "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
"" \
{ pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
"pr20253-2c" \
diff --git a/ld/testsuite/ld-i386/plt-main-ibt.dd b/ld/testsuite/ld-i386/plt-main-ibt.dd
new file mode 100644
index 0000000..18240a2
--- /dev/null
+++ b/ld/testsuite/ld-i386/plt-main-ibt.dd
@@ -0,0 +1,7 @@
+#...
+Disassembly of section .plt.got:
+
+[a-f0-9]+ <[_a-z]+@plt>:
+[ ]*[a-f0-9]+: f3 0f 1e fb endbr32
+[ ]*[a-f0-9]+: ff 25 .. .. .. .. jmp +\*0x[a-f0-9]+
+#pass
diff --git a/ld/testsuite/ld-i386/plt-pie-ibt.dd b/ld/testsuite/ld-i386/plt-pie-ibt.dd
new file mode 100644
index 0000000..2dc016c
--- /dev/null
+++ b/ld/testsuite/ld-i386/plt-pie-ibt.dd
@@ -0,0 +1,7 @@
+#...
+Disassembly of section .plt.got:
+
+[a-f0-9]+ <[_a-z]+@plt>:
+[ ]*[a-f0-9]+: f3 0f 1e fb endbr32
+[ ]*[a-f0-9]+: ff a3 .. .. .. .. jmp +\*\-0x[a-f0-9]+\(%ebx\)
+#pass
diff --git a/ld/testsuite/ld-i386/property-x86-empty.s b/ld/testsuite/ld-i386/property-x86-empty.s
new file mode 100644
index 0000000..6a6b517
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-empty.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x0
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-i386/property-x86-ibt.s b/ld/testsuite/ld-i386/property-x86-ibt.s
new file mode 100644
index 0000000..84ee964
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-ibt.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-i386/property-x86-ibt1a.d b/ld/testsuite/ld-i386/property-x86-ibt1a.d
new file mode 100644
index 0000000..43b272f
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-ibt1a.d
@@ -0,0 +1,6 @@
+#source: property-x86-empty.s
+#source: property-x86-ibt.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
diff --git a/ld/testsuite/ld-i386/property-x86-ibt1b.d b/ld/testsuite/ld-i386/property-x86-ibt1b.d
new file mode 100644
index 0000000..83bf411
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-ibt1b.d
@@ -0,0 +1,6 @@
+#source: property-x86-ibt.s
+#source: property-x86-empty.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
diff --git a/ld/testsuite/ld-i386/property-x86-ibt2.d b/ld/testsuite/ld-i386/property-x86-ibt2.d
new file mode 100644
index 0000000..fbdf4c1
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-ibt2.d
@@ -0,0 +1,9 @@
+#source: property-x86-ibt.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-i386/property-x86-ibt3a.d b/ld/testsuite/ld-i386/property-x86-ibt3a.d
new file mode 100644
index 0000000..4bb35b0
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-ibt3a.d
@@ -0,0 +1,11 @@
+#source: property-x86-3.s
+#source: property-x86-ibt.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: i486, 586, SSE2, SSE3
+ x86 ISA needed: 586, SSE, SSE3, SSE4_1
diff --git a/ld/testsuite/ld-i386/property-x86-ibt3b.d b/ld/testsuite/ld-i386/property-x86-ibt3b.d
new file mode 100644
index 0000000..418d58a
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-ibt3b.d
@@ -0,0 +1,11 @@
+#source: property-x86-ibt.s
+#source: property-x86-3.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: i486, 586, SSE2, SSE3
+ x86 ISA needed: 586, SSE, SSE3, SSE4_1
diff --git a/ld/testsuite/ld-i386/property-x86-ibt4.d b/ld/testsuite/ld-i386/property-x86-ibt4.d
new file mode 100644
index 0000000..db14fb9
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-ibt4.d
@@ -0,0 +1,9 @@
+#source: property-x86-empty.s
+#as: --32
+#ld: -r -melf_i386 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-i386/property-x86-ibt5.d b/ld/testsuite/ld-i386/property-x86-ibt5.d
new file mode 100644
index 0000000..652f660
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-ibt5.d
@@ -0,0 +1,9 @@
+#source: start.s
+#as: --32
+#ld: -r -melf_i386 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-i386/property-x86-shstk.s b/ld/testsuite/ld-i386/property-x86-shstk.s
new file mode 100644
index 0000000..4c3218a
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-shstk.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-i386/property-x86-shstk1a.d b/ld/testsuite/ld-i386/property-x86-shstk1a.d
new file mode 100644
index 0000000..238cebe
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-shstk1a.d
@@ -0,0 +1,6 @@
+#source: property-x86-empty.s
+#source: property-x86-shstk.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
diff --git a/ld/testsuite/ld-i386/property-x86-shstk1b.d b/ld/testsuite/ld-i386/property-x86-shstk1b.d
new file mode 100644
index 0000000..faa2ea7
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-shstk1b.d
@@ -0,0 +1,6 @@
+#source: property-x86-shstk.s
+#source: property-x86-empty.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
diff --git a/ld/testsuite/ld-i386/property-x86-shstk2.d b/ld/testsuite/ld-i386/property-x86-shstk2.d
new file mode 100644
index 0000000..b39fa58
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-shstk2.d
@@ -0,0 +1,9 @@
+#source: property-x86-shstk.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-i386/property-x86-shstk3a.d b/ld/testsuite/ld-i386/property-x86-shstk3a.d
new file mode 100644
index 0000000..e261038
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-shstk3a.d
@@ -0,0 +1,11 @@
+#source: property-x86-3.s
+#source: property-x86-shstk.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: i486, 586, SSE2, SSE3
+ x86 ISA needed: 586, SSE, SSE3, SSE4_1
diff --git a/ld/testsuite/ld-i386/property-x86-shstk3b.d b/ld/testsuite/ld-i386/property-x86-shstk3b.d
new file mode 100644
index 0000000..25f3d23
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-shstk3b.d
@@ -0,0 +1,11 @@
+#source: property-x86-shstk.s
+#source: property-x86-3.s
+#as: --32
+#ld: -r -melf_i386
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: i486, 586, SSE2, SSE3
+ x86 ISA needed: 586, SSE, SSE3, SSE4_1
diff --git a/ld/testsuite/ld-i386/property-x86-shstk4.d b/ld/testsuite/ld-i386/property-x86-shstk4.d
new file mode 100644
index 0000000..d962eab
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-shstk4.d
@@ -0,0 +1,9 @@
+#source: property-x86-empty.s
+#as: --32
+#ld: -r -melf_i386 -z shstk
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-i386/property-x86-shstk5.d b/ld/testsuite/ld-i386/property-x86-shstk5.d
new file mode 100644
index 0000000..6d6371f
--- /dev/null
+++ b/ld/testsuite/ld-i386/property-x86-shstk5.d
@@ -0,0 +1,9 @@
+#source: start.s
+#as: --32
+#ld: -r -melf_i386 -z shstk
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-i386/weakundef1.c b/ld/testsuite/ld-i386/weakundef1.c
new file mode 100644
index 0000000..ca54a5e
--- /dev/null
+++ b/ld/testsuite/ld-i386/weakundef1.c
@@ -0,0 +1,16 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+extern int visibility_var_weak
+ __attribute__ ((weak, visibility ("hidden")));
+
+int
+main ()
+{
+ if (&visibility_var_weak != NULL)
+ abort ();
+
+ printf ("PASS\n");
+
+ return 0;
+}
diff --git a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
index 00bc474..c14cd28 100644
--- a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
+++ b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.d
@@ -1,6 +1,7 @@
-#ld: -shared
+#ld: -shared -Map tmpdir/ifunc-1-local-x86.map
#objdump: -dw
#target: x86_64-*-* i?86-*-*
+#map: ifunc-1-local-x86.map
#...
[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x160|\+0x170|\+0x1e0|)@plt>
diff --git a/ld/testsuite/ld-ifunc/ifunc-1-local-x86.map b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.map
new file mode 100644
index 0000000..557a446
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-1-local-x86.map
@@ -0,0 +1,3 @@
+#...
+Local IFUNC function `__GI_foo' in tmpdir/ifunc-1-local-x86.o
+#pass
diff --git a/ld/testsuite/ld-ifunc/ifunc-1-x86.d b/ld/testsuite/ld-ifunc/ifunc-1-x86.d
index f9dee1b..c245758 100644
--- a/ld/testsuite/ld-ifunc/ifunc-1-x86.d
+++ b/ld/testsuite/ld-ifunc/ifunc-1-x86.d
@@ -1,6 +1,7 @@
-#ld: -shared
+#ld: -shared -Map tmpdir/ifunc-1-x86.map
#objdump: -dw
#target: x86_64-*-* i?86-*-*
+#map: ifunc-1-x86.map
#...
[ \t0-9a-f]+:[ \t0-9a-f]+call[ \t0-9a-fq]+<\*ABS\*(\+0x170|\+0x190|\+0x210|)@plt>
diff --git a/ld/testsuite/ld-ifunc/ifunc-1-x86.map b/ld/testsuite/ld-ifunc/ifunc-1-x86.map
new file mode 100644
index 0000000..98bbb7a
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/ifunc-1-x86.map
@@ -0,0 +1,3 @@
+#...
+Local IFUNC function `__GI_foo' in tmpdir/ifunc-1-x86.o
+#pass
diff --git a/ld/testsuite/ld-mips-elf/lsi-4010-isa.d b/ld/testsuite/ld-mips-elf/lsi-4010-isa.d
new file mode 100644
index 0000000..5e78723
--- /dev/null
+++ b/ld/testsuite/ld-mips-elf/lsi-4010-isa.d
@@ -0,0 +1,23 @@
+#readelf: -Ah
+#name: LSI 4010 processor ISA level
+#source: empty.s
+#as: -EB -32 -m4010
+#ld: -EB -r
+
+ELF Header:
+#...
+ Flags: 0x1082[01]000, 4010(?:, o32)?, mips2
+#...
+
+MIPS ABI Flags Version: 0
+
+ISA: MIPS2
+GPR size: 32
+CPR1 size: 32
+CPR2 size: 0
+FP ABI: .*
+ISA Extension: LSI R4010
+ASEs:
+ None
+FLAGS 1: .*
+FLAGS 2: .*
diff --git a/ld/testsuite/ld-mips-elf/mips-elf.exp b/ld/testsuite/ld-mips-elf/mips-elf.exp
index e24c32c..66b2ae4 100644
--- a/ld/testsuite/ld-mips-elf/mips-elf.exp
+++ b/ld/testsuite/ld-mips-elf/mips-elf.exp
@@ -1176,3 +1176,6 @@ run_ld_link_tests [list \
{{objdump {-d --prefix-addresses} pr21334.dd} \
{readelf -A pr21334.gd}} \
"pr21334"]]
+
+# Check that the ISA level is consistently II for the LSI 4010.
+run_dump_test "lsi-4010-isa" [list [list ld $abi_ldflags(o32)]]
diff --git a/ld/testsuite/ld-nds32/diff.d b/ld/testsuite/ld-nds32/diff.d
index ef79586..1aff736 100644
--- a/ld/testsuite/ld-nds32/diff.d
+++ b/ld/testsuite/ld-nds32/diff.d
@@ -7,9 +7,9 @@
Disassembly of section .data:
00008000 <WORD> (7e 00 00 00|00 00 00 7e).*
-00008004 <HALF> (7e 00 7e fe|00 7e 7e fe).*
-00008006 <BYTE> 7e fe 00 fe.*
-00008007 <ULEB128> fe 00.*
+00008004 <HALF> (7e 00|00 7e).*
+00008006 <BYTE> 7e.*
+00008007 <ULEB128> fe.*
...
00008009 <ULEB128_2> fe 00.*
.*
diff --git a/ld/testsuite/ld-powerpc/elfv2so.d b/ld/testsuite/ld-powerpc/elfv2so.d
index d6f0b7d..f3962ac 100644
--- a/ld/testsuite/ld-powerpc/elfv2so.d
+++ b/ld/testsuite/ld-powerpc/elfv2so.d
@@ -57,6 +57,7 @@ Disassembly of section \.text:
.*: (7c 08 02 a6|a6 02 08 7c) mflr r0
.*: (42 9f 00 05|05 00 9f 42) bcl .*
.*: (7d 68 02 a6|a6 02 68 7d) mflr r11
+.*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\)
.*: (e8 4b ff f0|f0 ff 4b e8) ld r2,-16\(r11\)
.*: (7c 08 03 a6|a6 03 08 7c) mtlr r0
.*: (7d 8b 60 50|50 60 8b 7d) subf r12,r11,r12
@@ -67,7 +68,6 @@ Disassembly of section \.text:
.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
.*: (e9 6b 00 08|08 00 6b e9) ld r11,8\(r11\)
.*: (4e 80 04 20|20 04 80 4e) bctr
-.*: (60 00 00 00|00 00 00 60) nop
.* <f3@plt>:
.*: (4b ff ff c8|c8 ff ff 4b) b .* <__glink_PLTresolve>
diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
index 5350235..f709b1e 100644
--- a/ld/testsuite/ld-powerpc/powerpc.exp
+++ b/ld/testsuite/ld-powerpc/powerpc.exp
@@ -210,7 +210,7 @@ set ppc64elftests {
"tlsopt4"}
{"TLS DLL" "-shared -melf64ppc --version-script tlsdll.ver" "" "-a64" {tlsdll.s}
{} "tlsdll.so"}
- {"TLS opt 5" "-melf64ppc --gc-sections tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s}
+ {"TLS opt 5" "-melf64ppc --gc-sections --no-plt-localentry tmpdir/tlsdll.so" "" "-a64" {tlsopt5.s}
{{objdump -dr tlsopt5.d}}
"tlsopt5"}
{"sym@tocbase" "-shared -melf64ppc" "" "-a64" {symtocbase-1.s symtocbase-2.s}
@@ -231,6 +231,16 @@ set ppc64elftests {
{{ld tocopt7.out} {objdump -s tocopt7.d}} "tocopt7"}
{"TOC opt8" "-melf64ppc" "" "-a64 -mpower9" {tocopt8.s}
{{objdump -s tocopt8.d}} "tocopt8"}
+ {"tocsave lib" "-shared -melf64ppc" "" "-a64" {tocsavelib.s}
+ {} "tocsavelib.so"}
+ {"tocsave1 shared" "-melf64ppc" "tmpdir/tocsavelib.so" "-a64" {tocsave1.s}
+ {{objdump -dr tocsave1s.d}} "tocsave1s"}
+ {"tocsave1 static" "-melf64ppc" "tmpdir/tocsavelib.o" "-a64" {tocsave1.s}
+ {{objdump -dr tocsave1a.d}} "tocsave1a"}
+ {"tocsave2 shared" "-melf64ppc" "tmpdir/tocsavelib.so" "-a64" {tocsave2.s}
+ {{objdump -dr tocsave2s.d}} "tocsave2s"}
+ {"tocsave2 static" "-melf64ppc" "tmpdir/tocsavelib.o" "-a64" {tocsave2.s}
+ {{objdump -dr tocsave2a.d}} "tocsave2a"}
{"ambig shared v1" "-shared -melf64ppc" "" "-a64" {funv1.s} {} "funv1.so"}
{"ambig shared v2" "-shared -melf64ppc" "" "-a64" {funv2.s} {} "funv2.so"}
}
diff --git a/ld/testsuite/ld-powerpc/tlsopt5.d b/ld/testsuite/ld-powerpc/tlsopt5.d
index 7b17130..b356a2e 100644
--- a/ld/testsuite/ld-powerpc/tlsopt5.d
+++ b/ld/testsuite/ld-powerpc/tlsopt5.d
@@ -1,6 +1,6 @@
#source: tlsopt5.s
#as: -a64
-#ld: --gc-sections tlsdll.so
+#ld: --gc-sections --no-plt-localentry tlsdll.so
#objdump: -dr
#target: powerpc64*-*-*
@@ -38,6 +38,7 @@ Disassembly of section \.text:
.*: (a6 02 08 7c|7c 08 02 a6) mflr r0
.*: (05 00 9f 42|42 9f 00 05) bcl .*
.*: (a6 02 68 7d|7d 68 02 a6) mflr r11
+.*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\)
.*: (f0 ff 4b e8|e8 4b ff f0) ld r2,-16\(r11\)
.*: (a6 03 08 7c|7c 08 03 a6) mtlr r0
.*: (50 60 8b 7d|7d 8b 60 50) subf r12,r11,r12
@@ -48,7 +49,6 @@ Disassembly of section \.text:
.*: (a6 03 89 7d|7d 89 03 a6) mtctr r12
.*: (08 00 6b e9|e9 6b 00 08) ld r11,8\(r11\)
.*: (20 04 80 4e|4e 80 04 20) bctr
-.*: (00 00 00 60|60 00 00 00) nop
0000000010000390 <__tls_get_addr_opt@plt>:
.*: (c8 ff ff 4b|4b ff ff c8) b .*
diff --git a/ld/testsuite/ld-powerpc/tocsave1.s b/ld/testsuite/ld-powerpc/tocsave1.s
new file mode 100644
index 0000000..75de27a
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocsave1.s
@@ -0,0 +1,24 @@
+ .abiversion 1
+ .global _start
+ .type _start,@function
+ .section ".opd","aw",@progbits
+ .p2align 3
+_start:
+ .quad .L_start, .TOC.@tocbase, 0
+
+ .text
+.L_start:
+ nop
+.L1:
+# tocsave in a function prologue
+ .reloc .,R_PPC64_TOCSAVE,.L1
+ nop
+
+ nop
+# tocsave on a call
+ bl foo
+ .reloc .,R_PPC64_TOCSAVE,.L1
+ nop
+
+ blr
+ .size _start, .-.L_start
diff --git a/ld/testsuite/ld-powerpc/tocsave1a.d b/ld/testsuite/ld-powerpc/tocsave1a.d
new file mode 100644
index 0000000..9ae5ed5
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocsave1a.d
@@ -0,0 +1,15 @@
+
+.*: file format .*
+
+Disassembly of section \.text:
+
+.* <\._start>:
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (0d 00 00 48|48 00 00 0d) bl .* <foo>
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (20 00 80 4e|4e 80 00 20) blr
+
+.* <foo>:
+.*: (20 00 80 4e|4e 80 00 20) blr
diff --git a/ld/testsuite/ld-powerpc/tocsave1s.d b/ld/testsuite/ld-powerpc/tocsave1s.d
new file mode 100644
index 0000000..1e6eb9b
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocsave1s.d
@@ -0,0 +1,9 @@
+#...
+.* <\._start>:
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (28 00 41 f8|f8 41 00 28) std r2,40\(r1\)
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (.. .. .. 4b|4b .. .. ..) bl .* <.*\.plt_call\.foo>
+.*: (28 00 41 e8|e8 41 00 28) ld r2,40\(r1\)
+.*: (20 00 80 4e|4e 80 00 20) blr
+#pass
diff --git a/ld/testsuite/ld-powerpc/tocsave2.s b/ld/testsuite/ld-powerpc/tocsave2.s
new file mode 100644
index 0000000..94683c6
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocsave2.s
@@ -0,0 +1,24 @@
+ .abiversion 2
+ .global _start
+ .type _start,@function
+_start:
+ nop
+.L1:
+# Function prologue tocsave.
+ .reloc .,R_PPC64_TOCSAVE,.L1
+ nop
+
+ nop
+# Call with tocsave on nop
+ bl foo
+ .reloc .,R_PPC64_TOCSAVE,.L1
+ nop
+
+ nop
+# A call without tocsave (maybe in a different function, or after alloca
+# dynamic stack allocation loses r2 save in same function).
+ bl foo
+ nop
+
+ blr
+ .size _start, .-_start
diff --git a/ld/testsuite/ld-powerpc/tocsave2a.d b/ld/testsuite/ld-powerpc/tocsave2a.d
new file mode 100644
index 0000000..fbae8c0
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocsave2a.d
@@ -0,0 +1,18 @@
+
+.*: file format .*
+
+Disassembly of section \.text:
+
+.* <_start>:
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (19 00 00 48|48 00 00 19) bl .* <foo>
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (0d 00 00 48|48 00 00 0d) bl .* <foo>
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (20 00 80 4e|4e 80 00 20) blr
+
+.* <foo>:
+.*: (20 00 80 4e|4e 80 00 20) blr
diff --git a/ld/testsuite/ld-powerpc/tocsave2s.d b/ld/testsuite/ld-powerpc/tocsave2s.d
new file mode 100644
index 0000000..b44eae1
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocsave2s.d
@@ -0,0 +1,13 @@
+#...
+.* <_start>:
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (18 00 41 f8|f8 41 00 18) std r2,24\(r1\)
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (.. .. .. 4b|4b .. .. ..) bl .* <.*\.plt_call\.foo\+0x4>
+.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\)
+.*: (00 00 00 60|60 00 00 00) nop
+.*: (.. .. .. 4b|4b .. .. ..) bl .* <.*\.plt_call\.foo>
+.*: (18 00 41 e8|e8 41 00 18) ld r2,24\(r1\)
+.*: (20 00 80 4e|4e 80 00 20) blr
+.*: (00 00 00 60|60 00 00 00) nop
+#pass
diff --git a/ld/testsuite/ld-powerpc/tocsavelib.s b/ld/testsuite/ld-powerpc/tocsavelib.s
new file mode 100644
index 0000000..7375af2
--- /dev/null
+++ b/ld/testsuite/ld-powerpc/tocsavelib.s
@@ -0,0 +1,5 @@
+ .global foo
+ .type foo,@function
+foo:
+ blr
+ .size foo, .-foo
diff --git a/ld/testsuite/ld-scripts/crossref.exp b/ld/testsuite/ld-scripts/crossref.exp
index 4318e15..8ac0264 100644
--- a/ld/testsuite/ld-scripts/crossref.exp
+++ b/ld/testsuite/ld-scripts/crossref.exp
@@ -42,9 +42,10 @@ global CFLAGS
set old_CFLAGS "$CFLAGS"
# Pass -fplt to CC since -fno-plt doesn't work with NOCROSSREFS tests.
-global PLT_CFLAGS
+# Also add $NOPIE_CFLAGS since PIE doesn't work NOCROSSREFS tests.
+global PLT_CFLAGS NOPIE_CFLAGS
set old_CC "$CC"
-set CC "$CC $PLT_CFLAGS"
+set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS"
# Xtensa targets currently default to putting literal values in a separate
# section and that requires linker script support, so put literals in text.
diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
index 93181dc..723b51c 100644
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -225,8 +225,8 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results. Make sure that PLT is used since PLT is expected.
- global PLT_CFLAGS
- if { ![ld_compile "$CC $PLT_CFLAGS $CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
+ global PLT_CFLAGS NOPIE_CFLAGS
+ if { ![ld_compile "$CC $PLT_CFLAGS $NOPIE_CFLAGS $CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
|| ![ld_compile "$CC $PLT_CFLAGS $CFLAGS $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unresolved "shared (non PIC)"
} else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
diff --git a/ld/testsuite/ld-size/size.exp b/ld/testsuite/ld-size/size.exp
index d4c3b8f..c4fa2c8 100644
--- a/ld/testsuite/ld-size/size.exp
+++ b/ld/testsuite/ld-size/size.exp
@@ -234,7 +234,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"Run size-4a" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{size-4a.c size-4b.c} \
"size-4a" \
@@ -243,7 +243,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"Run size-4b" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{size-4b.c size-4a.c} \
"size-4b" \
@@ -252,7 +252,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"Run size-5a" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{size-5a.c size-5b.c} \
"size-5a" \
@@ -261,7 +261,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"Run size-5b" \
- "" \
+ "$NOPIE_LDFLAGS" \
"" \
{size-5b.c size-5a.c} \
"size-5b" \
@@ -270,7 +270,7 @@ run_ld_link_exec_tests [list \
] \
[list \
"Run size-6" \
- "-Wl,--no-as-needed tmpdir/libsize-6b.so" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/libsize-6b.so" \
"" \
{size-6a.c} \
"size-6" \
@@ -279,7 +279,8 @@ run_ld_link_exec_tests [list \
] \
[list \
"Run size-8" \
- "-Wl,--no-as-needed,--hash-styl=gnu tmpdir/libsize-8.so" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed,--hash-styl=gnu \
+ tmpdir/libsize-8.so" \
"" \
{size-8a.c} \
"size-8" \
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index 2720043..cb0b69b 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -351,12 +351,13 @@ if { ![is_remote host] && [which $CC] == 0 } {
}
# Pass -fplt to CC and CXX since -fno-plt doesn't work with S-records
-# tests.
-global PLT_CFLAGS
+# tests. Also add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if PIE doesn't work
+# with S-records.
+global PLT_CFLAGS NOPIE_CFLAGS NOPIE_LDFLAGS
set old_CC "$CC"
-set CC "$CC $PLT_CFLAGS"
+set CC "$CC $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS"
set old_CXX "$CXX"
-set CXX "$CXX $PLT_CFLAGS"
+set CXX "$CXX $PLT_CFLAGS $NOPIE_CFLAGS $NOPIE_LDFLAGS"
if { ![ld_compile $CC $srcdir/$subdir/sr1.c tmpdir/sr1.o] \
|| ![ld_compile $CC $srcdir/$subdir/sr2.c tmpdir/sr2.o] } {
diff --git a/ld/testsuite/ld-unique/pr21529.d b/ld/testsuite/ld-unique/pr21529.d
new file mode 100644
index 0000000..1bcd4fe
--- /dev/null
+++ b/ld/testsuite/ld-unique/pr21529.d
@@ -0,0 +1,5 @@
+#ld: --oformat binary -e main
+#objdump: -s -b binary
+#xfail: aarch64*-*-* arm*-*-* hppa-*-* ia64-*-* nds32*-*-* score-*-*
+
+#pass
diff --git a/ld/testsuite/ld-unique/pr21529.s b/ld/testsuite/ld-unique/pr21529.s
new file mode 100644
index 0000000..4570635
--- /dev/null
+++ b/ld/testsuite/ld-unique/pr21529.s
@@ -0,0 +1,8 @@
+ .type a, %gnu_unique_object
+a: .long 0
+ .size a, .-a
+
+ .type main,"function"
+ .global main
+main:
+ .dc.a a
diff --git a/ld/testsuite/ld-unique/unique.exp b/ld/testsuite/ld-unique/unique.exp
index 61c070a..49d7925 100644
--- a/ld/testsuite/ld-unique/unique.exp
+++ b/ld/testsuite/ld-unique/unique.exp
@@ -35,7 +35,12 @@ if { ![supports_gnu_unique] } {
return
}
-run_dump_test "unique"
+set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
+foreach t $test_list {
+ # We need to strip the ".d", but can leave the dirname.
+ verbose [file rootname $t]
+ run_dump_test [file rootname $t]
+}
# We need a working compiler. (Strictly speaking this is
# not true, we could use target specific assembler files).
diff --git a/ld/testsuite/ld-x86-64/call1c.d b/ld/testsuite/ld-x86-64/call1c.d
index 7fe8056..70933da 100644
--- a/ld/testsuite/ld-x86-64/call1c.d
+++ b/ld/testsuite/ld-x86-64/call1c.d
@@ -1,14 +1,4 @@
#source: call1.s
#as: --64 -mrelax-relocations=yes
#ld: -melf_x86_64 -z call-nop=prefix-nop
-#objdump: -dw
-
-.*: +file format .*
-
-
-Disassembly of section .text:
-
-#...
-[ ]*[a-f0-9]+: 90 nop
-[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * callq +[a-f0-9]+ <foo>
-#pass
+#error: invalid number for -z call-nop=prefix-: nop
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
new file mode 100644
index 0000000..6147ab4
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1-x32.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-1.s
+#as: --x32
+#ld: -shared -m elf32_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+1c0 <.plt>:
+ +[a-f0-9]+: ff 35 6a 01 20 00 pushq 0x20016a\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: ff 25 6c 01 20 00 jmpq \*0x20016c\(%rip\) # 200338 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmpq 1c0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: e9 d2 ff ff ff jmpq 1c0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1f0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 46 01 20 00 jmpq \*0x200146\(%rip\) # 200340 <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+0+200 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200348 <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+210 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 200 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 1f0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1.d b/ld/testsuite/ld-x86-64/ibt-plt-1.d
new file mode 100644
index 0000000..dbec3ed
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-1.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+290 <.plt>:
+ +[a-f0-9]+: ff 35 ea 01 20 00 pushq 0x2001ea\(%rip\) # 200480 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: f2 ff 25 eb 01 20 00 bnd jmpq \*0x2001eb\(%rip\) # 200488 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmpq 290 <.plt>
+ +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmpq 290 <.plt>
+ +[a-f0-9]+: 90 nop
+
+Disassembly of section .plt.sec:
+
+0+2c0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 c5 01 20 00 bnd jmpq \*0x2001c5\(%rip\) # 200490 <bar1>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+0+2d0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 bd 01 20 00 bnd jmpq \*0x2001bd\(%rip\) # 200498 <bar2>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+2e0 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 2d0 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 2c0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1.s b/ld/testsuite/ld-x86-64/ibt-plt-1.s
new file mode 100644
index 0000000..2ddf3bb
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-1.s
@@ -0,0 +1,45 @@
+ .text
+ .p2align 4,,15
+ .globl foo
+ .type foo, @function
+foo:
+.LFB0:
+ .cfi_startproc
+ subq $8, %rsp
+ .cfi_def_cfa_offset 16
+ call bar2@PLT
+ addq $8, %rsp
+ .cfi_def_cfa_offset 8
+ jmp bar1@PLT
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
+ .section .note.GNU-stack,"",@progbits
+
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2.s b/ld/testsuite/ld-x86-64/ibt-plt-2.s
new file mode 100644
index 0000000..e1ea540
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2.s
@@ -0,0 +1,45 @@
+ .text
+ .p2align 4,,15
+ .globl foo
+ .type foo, @function
+foo:
+.LFB0:
+ .cfi_startproc
+ subq $8, %rsp
+ .cfi_def_cfa_offset 16
+ call bar2@PLT
+ addq $8, %rsp
+ .cfi_def_cfa_offset 8
+ jmp bar1@PLT
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
+ .section .note.GNU-stack,"",@progbits
+
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x0
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
new file mode 100644
index 0000000..df9dc8e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a-x32.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-2.s
+#as: --x32
+#ld: -shared -m elf32_x86_64 -z ibtplt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+1c0 <.plt>:
+ +[a-f0-9]+: ff 35 6a 01 20 00 pushq 0x20016a\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: ff 25 6c 01 20 00 jmpq \*0x20016c\(%rip\) # 200338 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmpq 1c0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: e9 d2 ff ff ff jmpq 1c0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1f0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 46 01 20 00 jmpq \*0x200146\(%rip\) # 200340 <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+0+200 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200348 <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+210 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 200 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 1f0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a.d b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
new file mode 100644
index 0000000..0e4f424
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-2.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64 -z ibtplt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+290 <.plt>:
+ +[a-f0-9]+: ff 35 ea 01 20 00 pushq 0x2001ea\(%rip\) # 200480 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: f2 ff 25 eb 01 20 00 bnd jmpq \*0x2001eb\(%rip\) # 200488 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmpq 290 <.plt>
+ +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmpq 290 <.plt>
+ +[a-f0-9]+: 90 nop
+
+Disassembly of section .plt.sec:
+
+0+2c0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 c5 01 20 00 bnd jmpq \*0x2001c5\(%rip\) # 200490 <bar1>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+0+2d0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 bd 01 20 00 bnd jmpq \*0x2001bd\(%rip\) # 200498 <bar2>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+2e0 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 2d0 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 2c0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d
new file mode 100644
index 0000000..e9e5638
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2b-x32.d
@@ -0,0 +1,9 @@
+#source: ibt-plt-2.s
+#as: --x32
+#ld: -shared -m elf32_x86_64 -z ibtplt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2b.d b/ld/testsuite/ld-x86-64/ibt-plt-2b.d
new file mode 100644
index 0000000..604db82
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2b.d
@@ -0,0 +1,9 @@
+#source: ibt-plt-2.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64 -z ibtplt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature:
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
new file mode 100644
index 0000000..e908804
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c-x32.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-2.s
+#as: --x32
+#ld: -shared -m elf32_x86_64 -z ibt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+1c0 <.plt>:
+ +[a-f0-9]+: ff 35 6a 01 20 00 pushq 0x20016a\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: ff 25 6c 01 20 00 jmpq \*0x20016c\(%rip\) # 200338 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmpq 1c0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: e9 d2 ff ff ff jmpq 1c0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1f0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 46 01 20 00 jmpq \*0x200146\(%rip\) # 200340 <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+0+200 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200348 <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+210 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 200 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 1f0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c.d b/ld/testsuite/ld-x86-64/ibt-plt-2c.d
new file mode 100644
index 0000000..0ef1131
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2c.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-2.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64 -z ibt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+290 <.plt>:
+ +[a-f0-9]+: ff 35 ea 01 20 00 pushq 0x2001ea\(%rip\) # 200480 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: f2 ff 25 eb 01 20 00 bnd jmpq \*0x2001eb\(%rip\) # 200488 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmpq 290 <.plt>
+ +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmpq 290 <.plt>
+ +[a-f0-9]+: 90 nop
+
+Disassembly of section .plt.sec:
+
+0+2c0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 c5 01 20 00 bnd jmpq \*0x2001c5\(%rip\) # 200490 <bar1>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+0+2d0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 bd 01 20 00 bnd jmpq \*0x2001bd\(%rip\) # 200498 <bar2>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+2e0 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 2d0 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 2c0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d
new file mode 100644
index 0000000..b3be904
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2d-x32.d
@@ -0,0 +1,9 @@
+#source: ibt-plt-2.s
+#as: --x32
+#ld: -shared -m elf32_x86_64 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2d.d b/ld/testsuite/ld-x86-64/ibt-plt-2d.d
new file mode 100644
index 0000000..7226b69
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-2d.d
@@ -0,0 +1,9 @@
+#source: ibt-plt-2.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3.s b/ld/testsuite/ld-x86-64/ibt-plt-3.s
new file mode 100644
index 0000000..299b023
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3.s
@@ -0,0 +1,17 @@
+ .text
+ .p2align 4,,15
+ .globl foo
+ .type foo, @function
+foo:
+.LFB0:
+ .cfi_startproc
+ subq $8, %rsp
+ .cfi_def_cfa_offset 16
+ call bar2@PLT
+ addq $8, %rsp
+ .cfi_def_cfa_offset 8
+ jmp bar1@PLT
+ .cfi_endproc
+.LFE0:
+ .size foo, .-foo
+ .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
new file mode 100644
index 0000000..0f7835d
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a-x32.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-3.s
+#as: --x32
+#ld: -shared -m elf32_x86_64 -z ibtplt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+1a0 <.plt>:
+ +[a-f0-9]+: ff 35 52 01 20 00 pushq 0x200152\(%rip\) # 2002f8 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: ff 25 54 01 20 00 jmpq \*0x200154\(%rip\) # 200300 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmpq 1a0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: e9 d2 ff ff ff jmpq 1a0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1d0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 2e 01 20 00 jmpq \*0x20012e\(%rip\) # 200308 <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+0+1e0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 26 01 20 00 jmpq \*0x200126\(%rip\) # 200310 <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+1f0 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 1e0 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 1d0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a.d b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
new file mode 100644
index 0000000..b8f2ebc
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-3.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64 -z ibtplt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+250 <.plt>:
+ +[a-f0-9]+: ff 35 ca 01 20 00 pushq 0x2001ca\(%rip\) # 200420 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: f2 ff 25 cb 01 20 00 bnd jmpq \*0x2001cb\(%rip\) # 200428 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmpq 250 <.plt>
+ +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmpq 250 <.plt>
+ +[a-f0-9]+: 90 nop
+
+Disassembly of section .plt.sec:
+
+0+280 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 a5 01 20 00 bnd jmpq \*0x2001a5\(%rip\) # 200430 <bar1>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+0+290 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 9d 01 20 00 bnd jmpq \*0x20019d\(%rip\) # 200438 <bar2>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+2a0 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 290 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 280 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d
new file mode 100644
index 0000000..fb0a834
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3b-x32.d
@@ -0,0 +1,5 @@
+#source: ibt-plt-3.s
+#as: --x32
+#ld: -shared -m elf32_x86_64 -z ibtplt
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3b.d b/ld/testsuite/ld-x86-64/ibt-plt-3b.d
new file mode 100644
index 0000000..5a3843b
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3b.d
@@ -0,0 +1,5 @@
+#source: ibt-plt-3.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64 -z ibtplt
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
new file mode 100644
index 0000000..234944d
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c-x32.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-3.s
+#as: --x32
+#ld: -shared -m elf32_x86_64 -z ibt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+1c0 <.plt>:
+ +[a-f0-9]+: ff 35 6a 01 20 00 pushq 0x20016a\(%rip\) # 200330 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: ff 25 6c 01 20 00 jmpq \*0x20016c\(%rip\) # 200338 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: e9 e2 ff ff ff jmpq 1c0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: e9 d2 ff ff ff jmpq 1c0 <.plt>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+
+Disassembly of section .plt.sec:
+
+0+1f0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 46 01 20 00 jmpq \*0x200146\(%rip\) # 200340 <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+0+200 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: ff 25 3e 01 20 00 jmpq \*0x20013e\(%rip\) # 200348 <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+210 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 200 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 1f0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c.d b/ld/testsuite/ld-x86-64/ibt-plt-3c.d
new file mode 100644
index 0000000..b299f22
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3c.d
@@ -0,0 +1,43 @@
+#source: ibt-plt-3.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64 -z ibt
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .plt:
+
+0+290 <.plt>:
+ +[a-f0-9]+: ff 35 ea 01 20 00 pushq 0x2001ea\(%rip\) # 200480 <_GLOBAL_OFFSET_TABLE_\+0x8>
+ +[a-f0-9]+: f2 ff 25 eb 01 20 00 bnd jmpq \*0x2001eb\(%rip\) # 200488 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 00 00 00 00 pushq \$0x0
+ +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmpq 290 <.plt>
+ +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: 68 01 00 00 00 pushq \$0x1
+ +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmpq 290 <.plt>
+ +[a-f0-9]+: 90 nop
+
+Disassembly of section .plt.sec:
+
+0+2c0 <bar1@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 c5 01 20 00 bnd jmpq \*0x2001c5\(%rip\) # 200490 <bar1>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+0+2d0 <bar2@plt>:
+ +[a-f0-9]+: f3 0f 1e fa endbr64
+ +[a-f0-9]+: f2 ff 25 bd 01 20 00 bnd jmpq \*0x2001bd\(%rip\) # 200498 <bar2>
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+
+Disassembly of section .text:
+
+0+2e0 <foo>:
+ +[a-f0-9]+: 48 83 ec 08 sub \$0x8,%rsp
+ +[a-f0-9]+: e8 e7 ff ff ff callq 2d0 <bar2@plt>
+ +[a-f0-9]+: 48 83 c4 08 add \$0x8,%rsp
+ +[a-f0-9]+: e9 ce ff ff ff jmpq 2c0 <bar1@plt>
+#pass
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d b/ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d
new file mode 100644
index 0000000..447e811
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3d-x32.d
@@ -0,0 +1,10 @@
+#source: ibt-plt-3.s
+#as: --x32
+#ld: -shared -m elf32_x86_64 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
+
diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3d.d b/ld/testsuite/ld-x86-64/ibt-plt-3d.d
new file mode 100644
index 0000000..342626a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/ibt-plt-3d.d
@@ -0,0 +1,10 @@
+#source: ibt-plt-3.s
+#as: --64 -defsym __64_bit__=1
+#ld: -shared -m elf_x86_64 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
+
diff --git a/ld/testsuite/ld-x86-64/lea1a.d b/ld/testsuite/ld-x86-64/lea1a.d
index 9b662cb..28ea4b9 100644
--- a/ld/testsuite/ld-x86-64/lea1a.d
+++ b/ld/testsuite/ld-x86-64/lea1a.d
@@ -15,5 +15,5 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo>
[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <bar>
[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section>
-[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <__stop_my_section>
+[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <.*>
#pass
diff --git a/ld/testsuite/ld-x86-64/lea1b.d b/ld/testsuite/ld-x86-64/lea1b.d
index 9108149..c7873cd 100644
--- a/ld/testsuite/ld-x86-64/lea1b.d
+++ b/ld/testsuite/ld-x86-64/lea1b.d
@@ -15,5 +15,5 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo>
[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <bar>
[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section>
-[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <__stop_my_section>
+[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <.*>
#pass
diff --git a/ld/testsuite/ld-x86-64/lea1d.d b/ld/testsuite/ld-x86-64/lea1d.d
index 4d708d2..70fc603 100644
--- a/ld/testsuite/ld-x86-64/lea1d.d
+++ b/ld/testsuite/ld-x86-64/lea1d.d
@@ -15,5 +15,5 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo>
[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <bar>
[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section>
-[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <__stop_my_section>
+[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <.*>
#pass
diff --git a/ld/testsuite/ld-x86-64/lea1e.d b/ld/testsuite/ld-x86-64/lea1e.d
index da60137..123fcd2 100644
--- a/ld/testsuite/ld-x86-64/lea1e.d
+++ b/ld/testsuite/ld-x86-64/lea1e.d
@@ -15,5 +15,5 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo>
[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <bar>
[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section>
-[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <__stop_my_section>
+[ ]*[a-f0-9]+: 4c 8d 1d ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%r11 # [a-f0-9]+ <.*>
#pass
diff --git a/ld/testsuite/ld-x86-64/no-plt.exp b/ld/testsuite/ld-x86-64/no-plt.exp
index 9cecd03..84ca5b7 100644
--- a/ld/testsuite/ld-x86-64/no-plt.exp
+++ b/ld/testsuite/ld-x86-64/no-plt.exp
@@ -39,6 +39,9 @@ if { [which $CC] == 0 } {
return
}
+# Add $NOPIE_CFLAGS and $NOPIE_LDFLAGS if non-PIE is required.
+global NOPIE_CFLAGS NOPIE_LDFLAGS
+
run_cc_link_tests [list \
[list \
"Build no-plt-func1.o no-plt-main1.o" \
@@ -71,7 +74,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1a)" \
- "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/no-plt-extern1.o" \
"" \
{dummy.s} \
@@ -89,7 +92,7 @@ run_cc_link_tests [list \
] \
[list \
"No PLT (dynamic 1c)" \
- "tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
+ "$NOPIE_LDFLAGS tmpdir/no-plt-check1.o tmpdir/no-plt-main1.o \
tmpdir/no-plt-func1.o tmpdir/libno-plt-1b.so" \
"" \
{dummy.s} \
@@ -266,7 +269,7 @@ if { [check_ifunc_available] } {
] \
[list \
"Run pr20253-2f" \
- "tmpdir/pr20253-2a.o" \
+ "$NOPIE_LDFLAGS tmpdir/pr20253-2a.o" \
"" \
{ pr20253-2b.S pr20253-2c.S pr20253-2d.S } \
"pr20253-2f" \
diff --git a/ld/testsuite/ld-x86-64/plt-main-ibt-now.rd b/ld/testsuite/ld-x86-64/plt-main-ibt-now.rd
new file mode 100644
index 0000000..2478c1f
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/plt-main-ibt-now.rd
@@ -0,0 +1,3 @@
+#...
+ +\[[ 0-9]+\] \.plt\.sec +.*
+#pass
diff --git a/ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd b/ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd
new file mode 100644
index 0000000..7b5e174
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd
@@ -0,0 +1,7 @@
+#...
+Disassembly of section .plt.got:
+
+[a-f0-9]+ <[_a-z]+@plt>:
+[ ]*[a-f0-9]+: f3 0f 1e fa endbr64
+[ ]*[a-f0-9]+: ff 25 .. .. 20 00 jmpq +\*0x20....\(%rip\) # ...... <[_a-z]+>
+#pass
diff --git a/ld/testsuite/ld-x86-64/plt-main-ibt.dd b/ld/testsuite/ld-x86-64/plt-main-ibt.dd
new file mode 100644
index 0000000..725f427
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/plt-main-ibt.dd
@@ -0,0 +1,7 @@
+#...
+Disassembly of section .plt.got:
+
+[a-f0-9]+ <[_a-z]+@plt>:
+[ ]*[a-f0-9]+: f3 0f 1e fa endbr64
+[ ]*[a-f0-9]+: f2 ff 25 .. .. 20 00 bnd jmpq \*0x20....\(%rip\) # ...... <[_a-z]+>
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr21481b.S b/ld/testsuite/ld-x86-64/pr21481b.S
index 744d86a..583ec77 100644
--- a/ld/testsuite/ld-x86-64/pr21481b.S
+++ b/ld/testsuite/ld-x86-64/pr21481b.S
@@ -10,7 +10,11 @@ check:
cmpl $func1, %eax
jne .L3
movq func1_p@GOTPCREL(%rip), %rdx
+#ifdef __LP64__
cmpq %rax, (%rdx)
+#else
+ cmpl %eax, (%rdx)
+#endif
jne .L3
call *func1@GOTPCREL(%rip)
cmpl $1, %eax
diff --git a/ld/testsuite/ld-x86-64/property-x86-3-x32.d b/ld/testsuite/ld-x86-64/property-x86-3-x32.d
new file mode 100644
index 0000000..cd8a2b5
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-3-x32.d
@@ -0,0 +1,10 @@
+#source: property-x86-3.s
+#as: --x32
+#ld: -shared -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-3.d b/ld/testsuite/ld-x86-64/property-x86-3.d
index 1e0348c..6686b14 100644
--- a/ld/testsuite/ld-x86-64/property-x86-3.d
+++ b/ld/testsuite/ld-x86-64/property-x86-3.d
@@ -1,4 +1,4 @@
-#as: --64
+#as: --64 -defsym __64_bit__=1
#ld: -shared -m elf_x86_64
#readelf: -n
diff --git a/ld/testsuite/ld-x86-64/property-x86-3.s b/ld/testsuite/ld-x86-64/property-x86-3.s
index e87ac81..be8cc9e 100644
--- a/ld/testsuite/ld-x86-64/property-x86-3.s
+++ b/ld/testsuite/ld-x86-64/property-x86-3.s
@@ -1,5 +1,9 @@
.section ".note.gnu.property", "a"
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
.long 1f - 0f /* name length. */
.long 3f - 1f /* data length. */
/* NT_GNU_PROPERTY_TYPE_0 */
@@ -7,21 +11,33 @@
0:
.asciz "GNU" /* vendor name. */
1:
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
/* GNU_PROPERTY_X86_ISA_1_USED */
.long 0xc0000000 /* pr_type. */
.long 5f - 4f /* pr_datasz. */
4:
.long 0xa
5:
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
/* GNU_PROPERTY_X86_ISA_1_NEEDED */
.long 0xc0000001 /* pr_type. */
.long 5f - 4f /* pr_datasz. */
4:
.long 0x3
5:
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
3:
.section ".note.gnu.property", "a"
@@ -33,19 +49,31 @@
0:
.asciz "GNU" /* vendor name. */
1:
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
/* GNU_PROPERTY_X86_ISA_1_USED */
.long 0xc0000000 /* pr_type. */
.long 5f - 4f /* pr_datasz. */
4:
.long 0xa0
5:
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
/* GNU_PROPERTY_X86_ISA_1_NEEDED */
.long 0xc0000001 /* pr_type. */
.long 5f - 4f /* pr_datasz. */
4:
.long 0x30
5:
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
3:
diff --git a/ld/testsuite/ld-x86-64/property-x86-4a-x32.d b/ld/testsuite/ld-x86-64/property-x86-4a-x32.d
new file mode 100644
index 0000000..9012513
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-4a-x32.d
@@ -0,0 +1,10 @@
+#source: property-x86-4a.s
+#source: property-x86-4b.s
+#as: --x32
+#ld: -m elf32_x86_64 --gc-sections --entry=main
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000008 NT_GNU_PROPERTY_TYPE_0
+ Properties: no copy on protected
diff --git a/ld/testsuite/ld-x86-64/property-x86-4a.d b/ld/testsuite/ld-x86-64/property-x86-4a.d
index 50be0b7..5e8cf4c 100644
--- a/ld/testsuite/ld-x86-64/property-x86-4a.d
+++ b/ld/testsuite/ld-x86-64/property-x86-4a.d
@@ -1,6 +1,6 @@
#source: property-x86-4a.s
#source: property-x86-4b.s
-#as: --64
+#as: --64 -defsym __64_bit__=1
#ld: -m elf_x86_64 --gc-sections --entry=main
#readelf: -n
diff --git a/ld/testsuite/ld-x86-64/property-x86-4b-x32.d b/ld/testsuite/ld-x86-64/property-x86-4b-x32.d
new file mode 100644
index 0000000..10e2efb
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-4b-x32.d
@@ -0,0 +1,10 @@
+#source: property-x86-4a.s
+#source: property-x86-4b.s
+#as: --x32
+#ld: -m elf32_x86_64 --gc-sections --entry=main
+#readelf: -S --wide
+
+#failif
+#...
+ +\[ [0-9]\] .debug_info.*
+#...
diff --git a/ld/testsuite/ld-x86-64/property-x86-4b.d b/ld/testsuite/ld-x86-64/property-x86-4b.d
index 194dd6c..a53833c 100644
--- a/ld/testsuite/ld-x86-64/property-x86-4b.d
+++ b/ld/testsuite/ld-x86-64/property-x86-4b.d
@@ -1,6 +1,6 @@
#source: property-x86-4a.s
#source: property-x86-4b.s
-#as: --64
+#as: --64 -defsym __64_bit__=1
#ld: -m elf_x86_64 --gc-sections --entry=main
#readelf: -S --wide
diff --git a/ld/testsuite/ld-x86-64/property-x86-4b.s b/ld/testsuite/ld-x86-64/property-x86-4b.s
index 3da1055..7a2c707 100644
--- a/ld/testsuite/ld-x86-64/property-x86-4b.s
+++ b/ld/testsuite/ld-x86-64/property-x86-4b.s
@@ -5,16 +5,29 @@ t.c.4903c230:
.byte 0x28
.section ".note.gnu.property", "a"
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
.long 1f - 0f /* name length. */
.long 3f - 2f /* data length. */
/* NT_GNU_PROPERTY_TYPE_0 */
.long 5 /* note type. */
0: .asciz "GNU" /* vendor name. */
-1: .p2align 3
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
2:
/* GNU_PROPERTY_NO_COPY_ON_PROTECTED */
.long 2 /* pr_type. */
.long 0 /* pr_datasz. */
+.ifdef __64_bit__
.p2align 3
+.else
+ .p2align 2
+.endif
3:
diff --git a/ld/testsuite/ld-x86-64/property-x86-empty.s b/ld/testsuite/ld-x86-64/property-x86-empty.s
new file mode 100644
index 0000000..6a6b517
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-empty.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x0
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt.s b/ld/testsuite/ld-x86-64/property-x86-ibt.s
new file mode 100644
index 0000000..84ee964
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x1
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt1a-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt1a-x32.d
new file mode 100644
index 0000000..b215d79d
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt1a-x32.d
@@ -0,0 +1,6 @@
+#source: property-x86-empty.s
+#source: property-x86-ibt.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt1a.d b/ld/testsuite/ld-x86-64/property-x86-ibt1a.d
new file mode 100644
index 0000000..50f220c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt1a.d
@@ -0,0 +1,6 @@
+#source: property-x86-empty.s
+#source: property-x86-ibt.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt1b-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt1b-x32.d
new file mode 100644
index 0000000..7361cea
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt1b-x32.d
@@ -0,0 +1,6 @@
+#source: property-x86-ibt.s
+#source: property-x86-empty.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt1b.d b/ld/testsuite/ld-x86-64/property-x86-ibt1b.d
new file mode 100644
index 0000000..7f47db7
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt1b.d
@@ -0,0 +1,6 @@
+#source: property-x86-ibt.s
+#source: property-x86-empty.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt2-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt2-x32.d
new file mode 100644
index 0000000..a0fb614
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt2-x32.d
@@ -0,0 +1,9 @@
+#source: property-x86-ibt.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt2.d b/ld/testsuite/ld-x86-64/property-x86-ibt2.d
new file mode 100644
index 0000000..be3df9c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt2.d
@@ -0,0 +1,9 @@
+#source: property-x86-ibt.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d
new file mode 100644
index 0000000..011426f
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt3a-x32.d
@@ -0,0 +1,11 @@
+#source: property-x86-3.s
+#source: property-x86-ibt.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3a.d b/ld/testsuite/ld-x86-64/property-x86-ibt3a.d
new file mode 100644
index 0000000..1b4229a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt3a.d
@@ -0,0 +1,11 @@
+#source: property-x86-3.s
+#source: property-x86-ibt.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d
new file mode 100644
index 0000000..290ed6a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt3b-x32.d
@@ -0,0 +1,11 @@
+#source: property-x86-ibt.s
+#source: property-x86-3.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt3b.d b/ld/testsuite/ld-x86-64/property-x86-ibt3b.d
new file mode 100644
index 0000000..1142e03
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt3b.d
@@ -0,0 +1,11 @@
+#source: property-x86-ibt.s
+#source: property-x86-3.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt4-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt4-x32.d
new file mode 100644
index 0000000..b96abbc
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt4-x32.d
@@ -0,0 +1,9 @@
+#source: property-x86-empty.s
+#as: --x32
+#ld: -r -m elf32_x86_64 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt4.d b/ld/testsuite/ld-x86-64/property-x86-ibt4.d
new file mode 100644
index 0000000..3f61a76
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt4.d
@@ -0,0 +1,9 @@
+#source: property-x86-empty.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt5-x32.d b/ld/testsuite/ld-x86-64/property-x86-ibt5-x32.d
new file mode 100644
index 0000000..5245d0b
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt5-x32.d
@@ -0,0 +1,9 @@
+#source: start.s
+#as: --x32
+#ld: -r -m elf32_x86_64 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-x86-64/property-x86-ibt5.d b/ld/testsuite/ld-x86-64/property-x86-ibt5.d
new file mode 100644
index 0000000..ab74033
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-ibt5.d
@@ -0,0 +1,9 @@
+#source: start.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64 -z ibt
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: IBT
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk.s b/ld/testsuite/ld-x86-64/property-x86-shstk.s
new file mode 100644
index 0000000..4c3218a
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk.s
@@ -0,0 +1,27 @@
+ .section ".note.gnu.property", "a"
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+ .long 1f - 0f /* name length */
+ .long 5f - 2f /* data length */
+ .long 5 /* note type */
+0: .asciz "GNU" /* vendor name */
+1:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+2: .long 0xc0000002 /* pr_type. */
+ .long 4f - 3f /* pr_datasz. */
+3:
+ .long 0x2
+4:
+.ifdef __64_bit__
+ .p2align 3
+.else
+ .p2align 2
+.endif
+5:
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk1a-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk1a-x32.d
new file mode 100644
index 0000000..312d1ea
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk1a-x32.d
@@ -0,0 +1,6 @@
+#source: property-x86-empty.s
+#source: property-x86-shstk.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk1a.d b/ld/testsuite/ld-x86-64/property-x86-shstk1a.d
new file mode 100644
index 0000000..39a996e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk1a.d
@@ -0,0 +1,6 @@
+#source: property-x86-empty.s
+#source: property-x86-shstk.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk1b-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk1b-x32.d
new file mode 100644
index 0000000..9e91c5c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk1b-x32.d
@@ -0,0 +1,6 @@
+#source: property-x86-shstk.s
+#source: property-x86-empty.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk1b.d b/ld/testsuite/ld-x86-64/property-x86-shstk1b.d
new file mode 100644
index 0000000..a9b9e62
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk1b.d
@@ -0,0 +1,6 @@
+#source: property-x86-shstk.s
+#source: property-x86-empty.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk2-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk2-x32.d
new file mode 100644
index 0000000..7155f3f
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk2-x32.d
@@ -0,0 +1,9 @@
+#source: property-x86-shstk.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk2.d b/ld/testsuite/ld-x86-64/property-x86-shstk2.d
new file mode 100644
index 0000000..7fbafe8
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk2.d
@@ -0,0 +1,9 @@
+#source: property-x86-shstk.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d
new file mode 100644
index 0000000..819542d
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk3a-x32.d
@@ -0,0 +1,11 @@
+#source: property-x86-3.s
+#source: property-x86-shstk.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3a.d b/ld/testsuite/ld-x86-64/property-x86-shstk3a.d
new file mode 100644
index 0000000..4c5d0e0
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk3a.d
@@ -0,0 +1,11 @@
+#source: property-x86-3.s
+#source: property-x86-shstk.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d
new file mode 100644
index 0000000..ba181e0
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk3b-x32.d
@@ -0,0 +1,11 @@
+#source: property-x86-shstk.s
+#source: property-x86-3.s
+#as: --x32
+#ld: -r -m elf32_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000018 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk3b.d b/ld/testsuite/ld-x86-64/property-x86-shstk3b.d
new file mode 100644
index 0000000..5216f38
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk3b.d
@@ -0,0 +1,11 @@
+#source: property-x86-shstk.s
+#source: property-x86-3.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000020 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 ISA used: 586, SSE, SSE3, SSE4_1
+ x86 ISA needed: i486, 586, SSE2, SSE3
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk4-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk4-x32.d
new file mode 100644
index 0000000..61b7826
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk4-x32.d
@@ -0,0 +1,9 @@
+#source: property-x86-empty.s
+#as: --x32
+#ld: -r -m elf32_x86_64 -z shstk
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk4.d b/ld/testsuite/ld-x86-64/property-x86-shstk4.d
new file mode 100644
index 0000000..c2a7b36
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk4.d
@@ -0,0 +1,9 @@
+#source: property-x86-empty.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64 -z shstk
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk5-x32.d b/ld/testsuite/ld-x86-64/property-x86-shstk5-x32.d
new file mode 100644
index 0000000..83c6a68
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk5-x32.d
@@ -0,0 +1,9 @@
+#source: start.s
+#as: --x32
+#ld: -r -m elf32_x86_64 -z shstk
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x0000000c NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-x86-64/property-x86-shstk5.d b/ld/testsuite/ld-x86-64/property-x86-shstk5.d
new file mode 100644
index 0000000..9a4b186
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/property-x86-shstk5.d
@@ -0,0 +1,9 @@
+#source: start.s
+#as: --64 -defsym __64_bit__=1
+#ld: -r -melf_x86_64 -z shstk
+#readelf: -n
+
+Displaying notes found in: .note.gnu.property
+ Owner Data size Description
+ GNU 0x00000010 NT_GNU_PROPERTY_TYPE_0
+ Properties: x86 feature: SHSTK
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index ebb55f3..9b83e1c 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -332,6 +332,37 @@ run_dump_test "pr20093-2"
run_dump_test "property-x86-3"
run_dump_test "property-x86-4a"
run_dump_test "property-x86-4b"
+run_dump_test "property-x86-3-x32"
+run_dump_test "property-x86-4a-x32"
+run_dump_test "property-x86-4b-x32"
+run_dump_test "property-x86-ibt1a"
+run_dump_test "property-x86-ibt1b"
+run_dump_test "property-x86-ibt1a-x32"
+run_dump_test "property-x86-ibt1b-x32"
+run_dump_test "property-x86-ibt2"
+run_dump_test "property-x86-ibt2-x32"
+run_dump_test "property-x86-ibt3a"
+run_dump_test "property-x86-ibt3b"
+run_dump_test "property-x86-ibt3a-x32"
+run_dump_test "property-x86-ibt3b-x32"
+run_dump_test "property-x86-ibt4"
+run_dump_test "property-x86-ibt4-x32"
+run_dump_test "property-x86-ibt5"
+run_dump_test "property-x86-ibt5-x32"
+run_dump_test "property-x86-shstk1a"
+run_dump_test "property-x86-shstk1b"
+run_dump_test "property-x86-shstk1a-x32"
+run_dump_test "property-x86-shstk1b-x32"
+run_dump_test "property-x86-shstk2"
+run_dump_test "property-x86-shstk2-x32"
+run_dump_test "property-x86-shstk3a"
+run_dump_test "property-x86-shstk3b"
+run_dump_test "property-x86-shstk3a-x32"
+run_dump_test "property-x86-shstk3b-x32"
+run_dump_test "property-x86-shstk4"
+run_dump_test "property-x86-shstk4-x32"
+run_dump_test "property-x86-shstk5"
+run_dump_test "property-x86-shstk5-x32"
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
return
@@ -812,7 +843,9 @@ if { [isnative] && [which $CC] != 0 } {
] \
[list \
"Build gotpcrel1" \
- "-Wl,--as-needed tmpdir/gotpcrel1a.o tmpdir/gotpcrel1b.o tmpdir/gotpcrel1c.o tmpdir/gotpcrel1d.so" \
+ "$NOPIE_LDFLAGS -Wl,--as-needed tmpdir/gotpcrel1a.o \
+ tmpdir/gotpcrel1b.o tmpdir/gotpcrel1c.o \
+ tmpdir/gotpcrel1d.so" \
{ dummy.s } \
"" \
{{objdump {-dw} gotpcrel1.dd}} \
@@ -1058,11 +1091,12 @@ if { [isnative] && [which $CC] != 0 } {
] \
[list \
"Run pr19031" \
- "-Wl,--no-as-needed tmpdir/pr19031.so" \
+ "$NOPIE_LDFLAGS -Wl,--no-as-needed tmpdir/pr19031.so" \
"" \
{ pr19031b.S pr19031c.c } \
"pr19031" \
"pr19031.out" \
+ "$NOPIE_CFLAGS" \
] \
[list \
"Run gotpcrel1" \
@@ -1344,6 +1378,156 @@ if { [isnative] && [which $CC] != 0 } {
}
}
+ if { [istarget "x86_64-*-linux*"] } {
+ if { [istarget "x86_64-*-linux*-gnux32"] } {
+ set pltdump {{objdump {-drw} plt-main-ibt-x32.dd}}
+ set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt-x32.dd}}
+ } else {
+ set pltdump {{objdump {-drw} plt-main-ibt.dd}}
+ set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt.dd}}
+ }
+ run_cc_link_tests [list \
+ [list \
+ "Build plt-main with -z ibtplt" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt" \
+ "" \
+ { plt-main5.c } \
+ $pltdump \
+ "plt-main-ibt" \
+ ] \
+ [list \
+ "Build plt-main with PIE and -z ibtplt" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -pie" \
+ "-fPIC" \
+ { plt-main5.c } \
+ $pltdump \
+ "plt-main-pie-ibt" \
+ ] \
+ [list \
+ "Build plt-main with -z ibtplt -z now" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -z now" \
+ "" \
+ { plt-main5.c } \
+ $pltsecdump \
+ "plt-main-ibt-now" \
+ ] \
+ [list \
+ "Build plt-main with PIE and -z ibtplt -z now" \
+ "tmpdir/plt-main1.o tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so -z ibtplt -z now -pie" \
+ "-fPIC" \
+ { plt-main5.c } \
+ $pltsecdump \
+ "plt-main-pie-ibt-now" \
+ ] \
+ [list \
+ "Build libibtplt-lib.so with -z ibtplt" \
+ "-shared -z ibtplt" \
+ "-fPIC" \
+ { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \
+ $pltdump \
+ "libibtplt-lib.so" \
+ ] \
+ [list \
+ "Build libibtplt--now-lib.so with -z ibtplt -z now" \
+ "-shared -z ibtplt -z now" \
+ "-fPIC" \
+ { plt-main1.c plt-main2.c plt-main3.c plt-main4.c} \
+ $pltdump \
+ "libibtplt-now-lib.so" \
+ ] \
+ ]
+
+ run_ld_link_exec_tests [list \
+ [list \
+ "Run plt-main with -z ibtplt" \
+ "-Wl,--no-as-needed,-z,ibtplt tmpdir/plt-main1.o \
+ tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
+ "" \
+ { plt-main5.c } \
+ "plt-main-ibt" \
+ "plt-main.out" \
+ ] \
+ [list \
+ "Run plt-main with PIE and -z ibtplt" \
+ "-Wl,--no-as-needed,-z,ibtplt -pie tmpdir/plt-main1.o \
+ tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
+ "" \
+ { plt-main5.c } \
+ "plt-main-pie-ibt" \
+ "plt-main.out" \
+ "-fPIC" \
+ ] \
+ [list \
+ "Run plt-main with -z ibtplt -z now" \
+ "-Wl,--no-as-needed,-z,ibtplt,-z,now tmpdir/plt-main1.o \
+ tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
+ "" \
+ { plt-main5.c } \
+ "plt-main-ibt-now" \
+ "plt-main.out" \
+ ] \
+ [list \
+ "Run plt-main with PIE and -z ibtplt -z now" \
+ "-Wl,--no-as-needed,-z,ibtplt,-z,now -pie tmpdir/plt-main1.o \
+ tmpdir/plt-main2.o tmpdir/plt-main3.o \
+ tmpdir/plt-main4.o tmpdir/libplt-lib.so" \
+ "" \
+ { plt-main5.c } \
+ "plt-main-pie-ibt-now" \
+ "plt-main.out" \
+ "-fPIC" \
+ ] \
+ [list \
+ "Run plt-main with libibtplt-lib.so -z ibtplt" \
+ "-Wl,--no-as-needed,-z,ibtplt tmpdir/libibtplt-lib.so \
+ tmpdir/libplt-lib.so" \
+ "" \
+ { plt-main5.c } \
+ "plt-main-ibt-lib" \
+ "plt-main.out" \
+ ] \
+ [list \
+ "Run plt-main with libibtplt-lib.so -z ibtplt -z now" \
+ "-Wl,--no-as-needed,-z,ibtplt,-z,now \
+ tmpdir/libibtplt-now-lib.so tmpdir/libplt-lib.so" \
+ "" \
+ { plt-main5.c } \
+ "plt-main-ibt-now-lib" \
+ "plt-main.out" \
+ ] \
+ ]
+
+ if { [check_ifunc_attribute_available] } {
+ run_ld_link_exec_tests [list \
+ [list \
+ "Run pr21481a" \
+ "$NOPIE_LDFLAGS -Wl,-z,ibtplt" \
+ "" \
+ { pr21481a.c pr21481b.S } \
+ "pr21481a" \
+ "pass.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ [list \
+ "Run pr21481b" \
+ "$NOPIE_LDFLAGS -Wl,-z,ibtplt,-z,now" \
+ "" \
+ { pr21481a.c pr21481b.S } \
+ "pr21481b" \
+ "pass.out" \
+ "$NOPIE_CFLAGS" \
+ ] \
+ ]
+ }
+ }
+
undefined_weak "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS"
undefined_weak "-fPIE" ""
undefined_weak "-fPIE" "-pie"
@@ -1365,6 +1549,24 @@ run_ld_link_tests [list \
{{readelf -SW plt2.rd} {objdump -dwr plt2.dd}} \
"plt2" \
] \
+ [list \
+ "Build pr21626.so" \
+ "-shared -melf_x86_64" \
+ "" \
+ "--64 -defsym __64_bit__=1" \
+ {property-x86-3.s} \
+ "" \
+ "pr21626.so" \
+ ] \
+ [list \
+ "Build pr21626" \
+ "-melf_x86_64 tmpdir/pr21626.so" \
+ "" \
+ "--64" \
+ {start.s foo.s} \
+ "" \
+ "pr21626" \
+ ] \
]
# Linux only tests
@@ -1381,3 +1583,21 @@ run_dump_test "pr20830b-now"
run_dump_test "pr21038a-now"
run_dump_test "pr21038b-now"
run_dump_test "pr21038c-now"
+run_dump_test "ibt-plt-1"
+run_dump_test "ibt-plt-1-x32"
+run_dump_test "ibt-plt-2a"
+run_dump_test "ibt-plt-2b"
+run_dump_test "ibt-plt-2c"
+run_dump_test "ibt-plt-2d"
+run_dump_test "ibt-plt-2a-x32"
+run_dump_test "ibt-plt-2b-x32"
+run_dump_test "ibt-plt-2c-x32"
+run_dump_test "ibt-plt-2d-x32"
+run_dump_test "ibt-plt-3a"
+run_dump_test "ibt-plt-3b"
+run_dump_test "ibt-plt-3c"
+run_dump_test "ibt-plt-3d"
+run_dump_test "ibt-plt-3a-x32"
+run_dump_test "ibt-plt-3b-x32"
+run_dump_test "ibt-plt-3c-x32"
+run_dump_test "ibt-plt-3d-x32"
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index aecc700..cddcaf8 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -1858,6 +1858,25 @@ proc is_generic_elf { } {
return 0;
}
+proc is_underscore_target { } {
+ global is_underscore_target_saved
+ global target_triplet
+ global srcdir
+
+ if { ![info exists is_underscore_target_saved] } {
+ set cmd "targ=$target_triplet . $srcdir/../../bfd/config.bfd &&"
+ append cmd { echo "$targ_underscore"}
+ verbose -log "$cmd"
+ set status [catch {exec sh -c $cmd} result]
+ if { $status == 0 && [string match "yes" $result] } {
+ set is_underscore_target_saved 1
+ } else {
+ set is_underscore_target_saved 0
+ }
+ }
+ return $is_underscore_target_saved
+}
+
# Returns true if the target ld supports the plugin API.
proc check_plugin_api_available { } {
global plugin_api_available_saved
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 4b19fef..b3087fa 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -9,6 +9,108 @@
* waitpid.c (wait) [__MINGW32__]: Define as a macro
that calls _cwait, so that this function works on MinGW.
+2017-05-27 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_identifier): Prefix mangled init symbols
+ with `initializer for'.
+ * testsuite/demangle-expected: Update tests.
+
+2017-05-27 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_call_convention_p): Move declaration
+ before dlang_type.
+ (dlang_type): Handle function types.
+ * testsuite/d-demangle-expected: Add tests.
+
+2017-05-27 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_parse_real): Remove stack buffer, write
+ the demangled hexadecimal directly to string.
+ * testsuite/d-demangle-expected: Add tests.
+
+2017-05-02 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_hexdigit): New function.
+ (ascii2hex): Remove function.
+ (dlang_parse_string): Update to call dlang_hexdigit.
+ * testsuite/d-demangle-expected: Add tests.
+
+2017-05-02 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (strtol): Remove declaration.
+ Updated all callers to use dlang_number.
+ (dlang_number): New function.
+ (dlang_value): Moved check for ISDIGIT into dlang_parse_integer.
+ * testsuite/d-demangle-expected: Add tests.
+
+2017-05-02 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_parse_symbol): Remove function.
+ (dlang_parse_qualified): New function.
+ (dlang_parse_mangle): New function.
+ (dlang_type): Update to call dlang_parse_qualified.
+ (dlang_identifier): Update to call either dlang_parse_qualified or
+ dlang_parse_mangle.
+ (dlang_type_modifier_p): Remove function.
+ (dlang_call_convention_p): Don't allow type modifiers in mangle.
+ (dlang_template_args): Update to call dlang_identifier.
+ (dlang_demangle): Update to call dlang_parse_mangle.
+ * testsuite/d-demangle-expected: Add tests.
+
+2017-05-01 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_value): Add comment explaining why cases for
+ digits are required.
+ * testsuite/d-demangle-expected: Update integer value tests.
+
+2017-05-01 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_parse_symbol): Skip over anonymous symbols.
+ * testsuite/d-demangle-expected: Add tests.
+
+2017-05-01 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_identifier): Handle template constraint symbols.
+ (dlang_parse_template): Only advance if template symbol prefix is
+ followed by a digit.
+ * testsuite/d-demangle-expected: Add tests.
+
+2017-05-01 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * d-demangle.c (dlang_attributes): Handle scope attributes.
+ * testsuite/d-demangle-expected: Add tests.
+
+2017-04-27 Jonathan Wakely <jwakely@redhat.com>
+
+ PR demangler/80513
+ * cp-demangle.c (d_number): Check for overflow.
+ * cplus-dem.c (consume_count): Fix overflow check.
+ (gnu_special): Check for underscore after thunk delta.
+ * testsuite/demangle-expected: Add tests for overflows and invalid
+ characters in thunks.
+
+2017-04-21 Mark Wielaard <mark@klomp.org>
+
+ * cp-demangle.c (MAX_RECURSION_COUNT): New constant.
+ (struct d_print_info): Add recursion field.
+ (d_print_init): Initialize recursion.
+ (d_print_comp): Check and update d_print_info recursion depth.
+
+2017-04-21 Mark Wielaard <mark@klomp.org>
+
+ * cp-demangle.c (d_substitution): Return NULL if d_add_substitution
+ fails.
+
+2017-04-21 Mark Wielaard <mark@klomp.org>
+
+ * cp-demangle.h (struct d_info): Remove did_subs field.
+ * cp-demangle.c (struct d_info_checkpoint): Likewise.
+ (d_template_param): Don't update did_subs.
+ (d_substitution): Likewise.
+ (d_checkpoint): Don't assign did_subs.
+ (d_backtrack): Likewise.
+ (cplus_demangle_init_info): Don't initialize did_subs.
+
2017-03-27 Pedro Alves <palves@redhat.com>
* cp-demint.c (cplus_demangle_fill_component): Handle
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 04832ff..7b8d0b4 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -316,10 +316,12 @@ struct d_info_checkpoint
const char *n;
int next_comp;
int next_sub;
- int did_subs;
int expansion;
};
+/* Maximum number of times d_print_comp may be called recursively. */
+#define MAX_RECURSION_COUNT 1024
+
enum { D_PRINT_BUFFER_LENGTH = 256 };
struct d_print_info
{
@@ -342,6 +344,9 @@ struct d_print_info
struct d_print_mod *modifiers;
/* Set to 1 if we saw a demangling error. */
int demangle_failure;
+ /* Number of times d_print_comp was recursively called. Should not
+ be bigger than MAX_RECURSION_COUNT. */
+ int recursion;
/* Non-zero if we're printing a lambda argument. A template
parameter reference actually means 'auto'. */
int is_lambda_arg;
@@ -1687,6 +1692,8 @@ d_number (struct d_info *di)
ret = - ret;
return ret;
}
+ if (ret > ((INT_MAX - (peek - '0')) / 10))
+ return -1;
ret = ret * 10 + peek - '0';
d_advance (di, 1);
peek = d_peek_char (di);
@@ -3075,8 +3082,6 @@ d_template_param (struct d_info *di)
if (param < 0)
return NULL;
- ++di->did_subs;
-
return d_make_template_param (di, param);
}
@@ -3846,8 +3851,6 @@ d_substitution (struct d_info *di, int prefix)
if (id >= (unsigned int) di->next_sub)
return NULL;
- ++di->did_subs;
-
return di->subs[id];
}
else
@@ -3896,7 +3899,8 @@ d_substitution (struct d_info *di, int prefix)
/* If there are ABI tags on the abbreviation, it becomes
a substitution candidate. */
dc = d_abi_tags (di, dc);
- d_add_substitution (di, dc);
+ if (! d_add_substitution (di, dc))
+ return NULL;
}
return dc;
}
@@ -3912,7 +3916,6 @@ d_checkpoint (struct d_info *di, struct d_info_checkpoint *checkpoint)
checkpoint->n = di->n;
checkpoint->next_comp = di->next_comp;
checkpoint->next_sub = di->next_sub;
- checkpoint->did_subs = di->did_subs;
checkpoint->expansion = di->expansion;
}
@@ -3922,7 +3925,6 @@ d_backtrack (struct d_info *di, struct d_info_checkpoint *checkpoint)
di->n = checkpoint->n;
di->next_comp = checkpoint->next_comp;
di->next_sub = checkpoint->next_sub;
- di->did_subs = checkpoint->did_subs;
di->expansion = checkpoint->expansion;
}
@@ -4157,6 +4159,7 @@ d_print_init (struct d_print_info *dpi, demangle_callbackref callback,
dpi->opaque = opaque;
dpi->demangle_failure = 0;
+ dpi->recursion = 0;
dpi->is_lambda_arg = 0;
dpi->component_stack = NULL;
@@ -5691,13 +5694,14 @@ d_print_comp (struct d_print_info *dpi, int options,
struct demangle_component *dc)
{
struct d_component_stack self;
- if (dc == NULL || dc->d_printing > 1)
+ if (dc == NULL || dc->d_printing > 1 || dpi->recursion > MAX_RECURSION_COUNT)
{
d_print_error (dpi);
return;
}
- else
- dc->d_printing++;
+
+ dc->d_printing++;
+ dpi->recursion++;
self.dc = dc;
self.parent = dpi->component_stack;
@@ -5707,6 +5711,7 @@ d_print_comp (struct d_print_info *dpi, int options,
dpi->component_stack = self.parent;
dc->d_printing--;
+ dpi->recursion--;
}
/* Print a Java dentifier. For Java we try to handle encoded extended
@@ -6159,7 +6164,6 @@ cplus_demangle_init_info (const char *mangled, int options, size_t len,
chars in the mangled string. */
di->num_subs = len;
di->next_sub = 0;
- di->did_subs = 0;
di->last_name = NULL;
diff --git a/libiberty/cp-demangle.h b/libiberty/cp-demangle.h
index a265775..d4a4ab6 100644
--- a/libiberty/cp-demangle.h
+++ b/libiberty/cp-demangle.h
@@ -111,10 +111,6 @@ struct d_info
int next_sub;
/* The number of available entries in the subs array. */
int num_subs;
- /* The number of substitutions which we actually made from the subs
- array, plus the number of template parameter references we
- saw. */
- int did_subs;
/* The last name we saw, for constructors and destructors. */
struct demangle_component *last_name;
/* A running total of the length of large expansions from the
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
index a990e07..81c17a3 100644
--- a/libiberty/cplus-dem.c
+++ b/libiberty/cplus-dem.c
@@ -520,21 +520,17 @@ consume_count (const char **type)
while (ISDIGIT ((unsigned char)**type))
{
- count *= 10;
-
- /* Check for overflow.
- We assume that count is represented using two's-complement;
- no power of two is divisible by ten, so if an overflow occurs
- when multiplying by ten, the result will not be a multiple of
- ten. */
- if ((count % 10) != 0)
+ const int digit = **type - '0';
+ /* Check for overflow. */
+ if (count > ((INT_MAX - digit) / 10))
{
while (ISDIGIT ((unsigned char) **type))
(*type)++;
return -1;
}
- count += **type - '0';
+ count *= 10;
+ count += digit;
(*type)++;
}
@@ -3173,6 +3169,8 @@ gnu_special (struct work_stuff *work, const char **mangled, string *declp)
delta = consume_count (mangled);
if (delta == -1)
success = 0;
+ else if (**mangled != '_')
+ success = 0;
else
{
char *method = internal_cplus_demangle (work, ++*mangled);
diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index 12457f0..08690de 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -26,9 +26,7 @@ You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/>. */
-/* This file exports one function; dlang_demangle.
-
- This file imports strtol for decoding mangled literals. */
+/* This file exports one function; dlang_demangle. */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -42,8 +40,6 @@ If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
-#else
-extern long strtol (const char *nptr, char **endptr, int base);
#endif
#include <demangle.h>
@@ -186,7 +182,10 @@ static const char *dlang_type (string *, const char *);
static const char *dlang_value (string *, const char *, const char *, char);
-static const char *dlang_parse_symbol (string *, const char *,
+static const char *dlang_parse_qualified (string *, const char *,
+ enum dlang_symbol_kinds);
+
+static const char *dlang_parse_mangle (string *, const char *,
enum dlang_symbol_kinds);
static const char *dlang_parse_tuple (string *, const char *);
@@ -194,6 +193,80 @@ static const char *dlang_parse_tuple (string *, const char *);
static const char *dlang_parse_template (string *, const char *, long);
+/* Extract the number from MANGLED, and assign the result to RET.
+ Return the remaining string on success or NULL on failure. */
+static const char *
+dlang_number (const char *mangled, long *ret)
+{
+ /* Return NULL if trying to extract something that isn't a digit. */
+ if (mangled == NULL || !ISDIGIT (*mangled))
+ return NULL;
+
+ (*ret) = 0;
+
+ while (ISDIGIT (*mangled))
+ {
+ (*ret) *= 10;
+
+ /* If an overflow occured when multiplying by ten, the result
+ will not be a multiple of ten. */
+ if ((*ret % 10) != 0)
+ return NULL;
+
+ (*ret) += mangled[0] - '0';
+ mangled++;
+ }
+
+ if (*mangled == '\0' || *ret < 0)
+ return NULL;
+
+ return mangled;
+}
+
+/* Extract the hex-digit from MANGLED, and assign the result to RET.
+ Return the remaining string on success or NULL on failure. */
+static const char *
+dlang_hexdigit (const char *mangled, char *ret)
+{
+ char c;
+
+ /* Return NULL if trying to extract something that isn't a hexdigit. */
+ if (mangled == NULL || !ISXDIGIT (mangled[0]) || !ISXDIGIT (mangled[1]))
+ return NULL;
+
+ c = mangled[0];
+ if (!ISDIGIT (c))
+ (*ret) = (c - (ISUPPER (c) ? 'A' : 'a') + 10);
+ else
+ (*ret) = (c - '0');
+
+ c = mangled[1];
+ if (!ISDIGIT (c))
+ (*ret) = (*ret << 4) | (c - (ISUPPER (c) ? 'A' : 'a') + 10);
+ else
+ (*ret) = (*ret << 4) | (c - '0');
+
+ mangled += 2;
+
+ return mangled;
+}
+
+/* Extract the function calling convention from MANGLED and
+ return 1 on success or 0 on failure. */
+static int
+dlang_call_convention_p (const char *mangled)
+{
+ switch (*mangled)
+ {
+ case 'F': case 'U': case 'V':
+ case 'W': case 'R': case 'Y':
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
/* Demangle the calling convention from MANGLED and append it to DECL.
Return the remaining string on success or NULL on failure. */
static const char *
@@ -327,6 +400,10 @@ dlang_attributes (string *decl, const char *mangled)
mangled++;
string_append (decl, "return ");
continue;
+ case 'l': /* scope */
+ mangled++;
+ string_append (decl, "scope ");
+ continue;
default: /* unknown attribute */
return NULL;
@@ -539,17 +616,22 @@ dlang_type (string *decl, const char *mangled)
}
case 'P': /* pointer (T*) */
mangled++;
- /* Function pointer types don't include the trailing asterisk. */
- switch (*mangled)
+ if (!dlang_call_convention_p (mangled))
{
- case 'F': case 'U': case 'W':
- case 'V': case 'R': case 'Y':
- mangled = dlang_function_type (decl, mangled);
- string_append (decl, "function");
+ mangled = dlang_type (decl, mangled);
+ string_append (decl, "*");
return mangled;
}
- mangled = dlang_type (decl, mangled);
- string_append (decl, "*");
+ /* Fall through */
+ case 'F': /* function T (D) */
+ case 'U': /* function T (C) */
+ case 'W': /* function T (Windows) */
+ case 'V': /* function T (Pascal) */
+ case 'R': /* function T (C++) */
+ case 'Y': /* function T (Objective-C) */
+ /* Function pointer types don't include the trailing asterisk. */
+ mangled = dlang_function_type (decl, mangled);
+ string_append (decl, "function");
return mangled;
case 'I': /* ident T */
case 'C': /* class T */
@@ -557,7 +639,7 @@ dlang_type (string *decl, const char *mangled)
case 'E': /* enum T */
case 'T': /* typedef T */
mangled++;
- return dlang_parse_symbol (decl, mangled, dlang_type_name);
+ return dlang_parse_qualified (decl, mangled, dlang_type_name);
case 'D': /* delegate T */
{
string mods;
@@ -702,15 +784,10 @@ static const char *
dlang_identifier (string *decl, const char *mangled,
enum dlang_symbol_kinds kind)
{
- char *endptr;
long len;
+ const char *endptr = dlang_number (mangled, &len);
- if (mangled == NULL || *mangled == '\0')
- return NULL;
-
- len = strtol (mangled, &endptr, 10);
-
- if (endptr == NULL || len <= 0)
+ if (endptr == NULL || len == 0)
return NULL;
/* In template parameter symbols, the first character of the mangled
@@ -719,7 +796,7 @@ dlang_identifier (string *decl, const char *mangled,
if (kind == dlang_template_param)
{
long psize = len;
- char *pend;
+ const char *pend;
int saved = string_length (decl);
/* Work backwards until a match is found. */
@@ -739,12 +816,10 @@ dlang_identifier (string *decl, const char *mangled,
/* Check whether template parameter is a function with a valid
return type or an untyped identifier. */
if (ISDIGIT (*mangled))
- mangled = dlang_parse_symbol (decl, mangled, dlang_template_ident);
+ mangled = dlang_parse_qualified (decl, mangled,
+ dlang_template_ident);
else if (strncmp (mangled, "_D", 2) == 0)
- {
- mangled += 2;
- mangled = dlang_parse_symbol (decl, mangled, dlang_function);
- }
+ mangled = dlang_parse_mangle (decl, mangled, dlang_function);
/* Check for name length mismatch. */
if (mangled && (mangled - pend) == psize)
@@ -765,14 +840,9 @@ dlang_identifier (string *decl, const char *mangled,
mangled = endptr;
/* May be a template instance. */
- if (len >= 5 && strncmp (mangled, "__T", 3) == 0)
- {
- /* Template symbol. */
- if (ISDIGIT (mangled[3]) && mangled[3] != '0')
- return dlang_parse_template (decl, mangled, len);
-
- return NULL;
- }
+ if (len >= 5 && mangled[0] == '_' && mangled[1] == '_'
+ && (mangled[2] == 'T' || mangled[2] == 'U'))
+ return dlang_parse_template (decl, mangled, len);
switch (len)
{
@@ -794,7 +864,8 @@ dlang_identifier (string *decl, const char *mangled,
else if (strncmp (mangled, "__initZ", len+1) == 0)
{
/* The static initialiser for a given symbol. */
- string_append (decl, "init$");
+ string_prepend (decl, "initializer for ");
+ string_setlength (decl, string_length (decl) - 1);
mangled += len;
return mangled;
}
@@ -871,10 +942,10 @@ dlang_parse_integer (string *decl, const char *mangled, char type)
char value[10];
int pos = 10;
int width = 0;
- char *endptr;
- long val = strtol (mangled, &endptr, 10);
+ long val;
- if (endptr == NULL || val < 0)
+ mangled = dlang_number (mangled, &val);
+ if (mangled == NULL)
return NULL;
string_append (decl, "'");
@@ -923,19 +994,17 @@ dlang_parse_integer (string *decl, const char *mangled, char type)
string_appendn (decl, &(value[pos]), 10 - pos);
}
string_append (decl, "'");
- mangled = endptr;
}
else if (type == 'b')
{
/* Parse boolean value. */
- char *endptr;
- long val = strtol (mangled, &endptr, 10);
+ long val;
- if (endptr == NULL || val < 0)
+ mangled = dlang_number (mangled, &val);
+ if (mangled == NULL)
return NULL;
string_append (decl, val ? "true" : "false");
- mangled = endptr;
}
else
{
@@ -943,6 +1012,9 @@ dlang_parse_integer (string *decl, const char *mangled, char type)
const char *numptr = mangled;
size_t num = 0;
+ if (! ISDIGIT (*mangled))
+ return NULL;
+
while (ISDIGIT (*mangled))
{
num++;
@@ -975,9 +1047,6 @@ dlang_parse_integer (string *decl, const char *mangled, char type)
static const char *
dlang_parse_real (string *decl, const char *mangled)
{
- char buffer[64];
- int len = 0;
-
/* Handle NAN and +-INF. */
if (strncmp (mangled, "NAN", 3) == 0)
{
@@ -1001,23 +1070,22 @@ dlang_parse_real (string *decl, const char *mangled)
/* Hexadecimal prefix and leading bit. */
if (*mangled == 'N')
{
- buffer[len++] = '-';
+ string_append (decl, "-");
mangled++;
}
if (!ISXDIGIT (*mangled))
return NULL;
- buffer[len++] = '0';
- buffer[len++] = 'x';
- buffer[len++] = *mangled;
- buffer[len++] = '.';
+ string_append (decl, "0x");
+ string_appendn (decl, mangled, 1);
+ string_append (decl, ".");
mangled++;
/* Significand. */
while (ISXDIGIT (*mangled))
{
- buffer[len++] = *mangled;
+ string_appendn (decl, mangled, 1);
mangled++;
}
@@ -1025,110 +1093,80 @@ dlang_parse_real (string *decl, const char *mangled)
if (*mangled != 'P')
return NULL;
- buffer[len++] = 'p';
+ string_append (decl, "p");
mangled++;
if (*mangled == 'N')
{
- buffer[len++] = '-';
+ string_append (decl, "-");
mangled++;
}
while (ISDIGIT (*mangled))
{
- buffer[len++] = *mangled;
+ string_appendn (decl, mangled, 1);
mangled++;
}
- /* Write out the demangled hexadecimal, rather than trying to
- convert the buffer into a floating-point value. */
- buffer[len] = '\0';
- len = strlen (buffer);
- string_appendn (decl, buffer, len);
return mangled;
}
-/* Convert VAL from an ascii hexdigit to value. */
-static char
-ascii2hex (char val)
-{
- if (val >= 'a' && val <= 'f')
- return (val - 'a' + 10);
-
- if (val >= 'A' && val <= 'F')
- return (val - 'A' + 10);
-
- if (val >= '0' && val <= '9')
- return (val - '0');
-
- return 0;
-}
-
/* Extract the string value from MANGLED and append it to DECL.
Return the remaining string on success or NULL on failure. */
static const char *
dlang_parse_string (string *decl, const char *mangled)
{
char type = *mangled;
- char *endptr;
long len;
mangled++;
- len = strtol (mangled, &endptr, 10);
-
- if (endptr == NULL || len < 0)
- return NULL;
-
- mangled = endptr;
- if (*mangled != '_')
+ mangled = dlang_number (mangled, &len);
+ if (mangled == NULL || *mangled != '_')
return NULL;
mangled++;
string_append (decl, "\"");
while (len--)
{
- if (ISXDIGIT (mangled[0]) && ISXDIGIT (mangled[1]))
+ char val;
+ const char *endptr = dlang_hexdigit (mangled, &val);
+
+ if (endptr == NULL)
+ return NULL;
+
+ /* Sanitize white and non-printable characters. */
+ switch (val)
{
- char a = ascii2hex (mangled[0]);
- char b = ascii2hex (mangled[1]);
- char val = (a << 4) | b;
+ case ' ':
+ string_append (decl, " ");
+ break;
+ case '\t':
+ string_append (decl, "\\t");
+ break;
+ case '\n':
+ string_append (decl, "\\n");
+ break;
+ case '\r':
+ string_append (decl, "\\r");
+ break;
+ case '\f':
+ string_append (decl, "\\f");
+ break;
+ case '\v':
+ string_append (decl, "\\v");
+ break;
- /* Sanitize white and non-printable characters. */
- switch (val)
+ default:
+ if (ISPRINT (val))
+ string_appendn (decl, &val, 1);
+ else
{
- case ' ':
- string_append (decl, " ");
- break;
- case '\t':
- string_append (decl, "\\t");
- break;
- case '\n':
- string_append (decl, "\\n");
- break;
- case '\r':
- string_append (decl, "\\r");
- break;
- case '\f':
- string_append (decl, "\\f");
- break;
- case '\v':
- string_append (decl, "\\v");
- break;
-
- default:
- if (ISPRINT (val))
- string_appendn (decl, &val, 1);
- else
- {
- string_append (decl, "\\x");
- string_appendn (decl, mangled, 2);
- }
+ string_append (decl, "\\x");
+ string_appendn (decl, mangled, 2);
}
}
- else
- return NULL;
- mangled += 2;
+ mangled = endptr;
}
string_append (decl, "\"");
@@ -1143,13 +1181,12 @@ dlang_parse_string (string *decl, const char *mangled)
static const char *
dlang_parse_arrayliteral (string *decl, const char *mangled)
{
- char *endptr;
- long elements = strtol (mangled, &endptr, 10);
+ long elements;
- if (endptr == NULL || elements < 0)
+ mangled = dlang_number (mangled, &elements);
+ if (mangled == NULL)
return NULL;
- mangled = endptr;
string_append (decl, "[");
while (elements--)
{
@@ -1167,13 +1204,12 @@ dlang_parse_arrayliteral (string *decl, const char *mangled)
static const char *
dlang_parse_assocarray (string *decl, const char *mangled)
{
- char *endptr;
- long elements = strtol (mangled, &endptr, 10);
+ long elements;
- if (endptr == NULL || elements < 0)
+ mangled = dlang_number (mangled, &elements);
+ if (mangled == NULL)
return NULL;
- mangled = endptr;
string_append (decl, "[");
while (elements--)
{
@@ -1194,13 +1230,12 @@ dlang_parse_assocarray (string *decl, const char *mangled)
static const char *
dlang_parse_structlit (string *decl, const char *mangled, const char *name)
{
- char *endptr;
- long args = strtol (mangled, &endptr, 10);
+ long args;
- if (endptr == NULL || args < 0)
+ mangled = dlang_number (mangled, &args);
+ if (mangled == NULL)
return NULL;
- mangled = endptr;
if (name != NULL)
string_append (decl, name);
@@ -1241,9 +1276,11 @@ dlang_value (string *decl, const char *mangled, const char *name, char type)
case 'i':
mangled++;
- if (*mangled < '0' || *mangled > '9')
- return NULL;
/* Fall through */
+
+ /* There really should always be an `i' before encoded numbers, but there
+ wasn't in early versions of D2, so this case range must remain for
+ backwards compatibility. */
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
mangled = dlang_parse_integer (decl, mangled, type);
@@ -1296,101 +1333,133 @@ dlang_value (string *decl, const char *mangled, const char *name, char type)
return mangled;
}
-/* Extract the type modifiers from MANGLED and return the string
- length that it consumes in MANGLED on success or 0 on failure. */
-static int
-dlang_type_modifier_p (const char *mangled)
+/* Extract and demangle the symbol in MANGLED and append it to DECL.
+ Returns the remaining signature on success or NULL on failure. */
+static const char *
+dlang_parse_mangle (string *decl, const char *mangled,
+ enum dlang_symbol_kinds kind)
{
- int i;
+ /* A D mangled symbol is comprised of both scope and type information.
+
+ MangleName:
+ _D QualifiedName Type
+ _D QualifiedName M Type
+ _D QualifiedName Z
+ ^
+ The caller should have guaranteed that the start pointer is at the
+ above location.
+ */
+ mangled += 2;
- switch (*mangled)
+ mangled = dlang_parse_qualified (decl, mangled, dlang_top_level);
+
+ if (mangled != NULL)
{
- case 'x': case 'y':
- return 1;
+ /* Artificial symbols end with 'Z' and have no type. */
+ if (*mangled == 'Z')
+ mangled++;
+ else
+ {
+ string mods;
+ int saved;
- case 'O':
- mangled++;
- i = dlang_type_modifier_p (mangled);
- return i + 1;
+ /* Skip over 'this' parameter. */
+ if (*mangled == 'M')
+ mangled++;
- case 'N':
- mangled++;
- if (*mangled == 'g')
- {
- mangled++;
- i = dlang_type_modifier_p (mangled);
- return i + 2;
- }
- }
+ /* Save the type modifiers for appending at the end if needed. */
+ string_init (&mods);
+ mangled = dlang_type_modifiers (&mods, mangled);
- return 0;
-}
+ if (mangled && dlang_call_convention_p (mangled))
+ {
+ /* Skip over calling convention and attributes. */
+ saved = string_length (decl);
+ mangled = dlang_call_convention (decl, mangled);
+ mangled = dlang_attributes (decl, mangled);
+ string_setlength (decl, saved);
+
+ string_append (decl, "(");
+ mangled = dlang_function_args (decl, mangled);
+ string_append (decl, ")");
+
+ /* Add any const/immutable/shared modifier. */
+ string_appendn (decl, mods.b, string_length (&mods));
+ }
-/* Extract the function calling convention from MANGLED and
- return 1 on success or 0 on failure. */
-static int
-dlang_call_convention_p (const char *mangled)
-{
- /* Prefix for functions needing 'this' */
- if (*mangled == 'M')
- {
- mangled++;
- /* Also skip over any type modifiers. */
- mangled += dlang_type_modifier_p (mangled);
+ /* Consume the decl type of symbol. */
+ saved = string_length (decl);
+ mangled = dlang_type (decl, mangled);
+ string_setlength (decl, saved);
+
+ string_delete (&mods);
+ }
}
- switch (*mangled)
+ /* Check that the entire symbol was successfully demangled. */
+ if (kind == dlang_top_level)
{
- case 'F': case 'U': case 'V':
- case 'W': case 'R': case 'Y':
- return 1;
-
- default:
- return 0;
+ if (mangled == NULL || *mangled != '\0')
+ return NULL;
}
+
+ return mangled;
}
-/* Extract and demangle the symbol in MANGLED and append it to DECL.
+/* Extract and demangle the qualified symbol in MANGLED and append it to DECL.
Returns the remaining signature on success or NULL on failure. */
static const char *
-dlang_parse_symbol (string *decl, const char *mangled,
- enum dlang_symbol_kinds kind)
+dlang_parse_qualified (string *decl, const char *mangled,
+ enum dlang_symbol_kinds kind)
{
- int saved;
+ /* Qualified names are identifiers separated by their encoded length.
+ Nested functions also encode their argument types without specifying
+ what they return.
+
+ QualifiedName:
+ SymbolName
+ SymbolName QualifiedName
+ SymbolName TypeFunctionNoReturn QualifiedName
+ SymbolName M TypeModifiers TypeFunctionNoReturn QualifiedName
+ ^
+ The start pointer should be at the above location.
+ */
size_t n = 0;
do
{
if (n++)
string_append (decl, ".");
+ /* Skip over anonymous symbols. */
+ while (*mangled == '0')
+ mangled++;
+
mangled = dlang_identifier (decl, mangled, kind);
- if (mangled && dlang_call_convention_p (mangled))
+ /* Consume the encoded arguments. However if this is not followed by the
+ next encoded length, then this is not a continuation of a qualified
+ name, in which case we backtrack and return the current unconsumed
+ position of the mangled decl. */
+ if (mangled && (*mangled == 'M' || dlang_call_convention_p (mangled)))
{
- string mods;
- const char *start = NULL;
- int checkpoint = 0;
+ const char *start = mangled;
+ int saved = string_length (decl);
- /* Skip over 'this' parameter. */
+ /* Skip over 'this' parameter and type modifiers. */
if (*mangled == 'M')
- mangled++;
-
- /* We have reached here because we expect an extern(Pascal) function.
- However this is so rare, that it is more likely a template value
- parameter. Since this can't be assumed, first attempt parsing
- the symbol as a function, and then back out on failure. */
- if (*mangled == 'V')
{
- start = mangled;
- checkpoint = string_length (decl);
+ mangled++;
+ mangled = dlang_type_modifiers (decl, mangled);
+ string_setlength (decl, saved);
}
- /* Save the type modifiers for appending at the end. */
- string_init (&mods);
- mangled = dlang_type_modifiers (&mods, mangled);
+ /* The rule we expect to match in the mangled string is:
- /* Skip over calling convention and attributes in qualified name. */
- saved = string_length (decl);
+ TypeFunctionNoReturn:
+ CallConvention FuncAttrs Arguments ArgClose
+
+ The calling convention and function attributes are not included
+ in the demangled string. */
mangled = dlang_call_convention (decl, mangled);
mangled = dlang_attributes (decl, mangled);
string_setlength (decl, saved);
@@ -1399,41 +1468,16 @@ dlang_parse_symbol (string *decl, const char *mangled,
mangled = dlang_function_args (decl, mangled);
string_append (decl, ")");
- /* Add any const/immutable/shared modifier. */
- string_appendn (decl, mods.b, string_length (&mods));
- string_delete (&mods);
-
- if (mangled == NULL && checkpoint != 0)
+ if (mangled == NULL || !ISDIGIT (*mangled))
{
+ /* Did not match the rule we were looking for. */
mangled = start;
- string_setlength (decl, checkpoint);
+ string_setlength (decl, saved);
}
}
}
while (mangled && ISDIGIT (*mangled));
- /* Only top-level symbols or function template parameters have
- a type that needs checking. */
- if (kind == dlang_top_level || kind == dlang_function)
- {
- /* Artificial symbols end with 'Z' and have no type. */
- if (mangled && *mangled == 'Z')
- mangled++;
- else
- {
- saved = string_length (decl);
- mangled = dlang_type (decl, mangled);
- string_setlength (decl, saved);
- }
-
- /* Check that the entire symbol was successfully demangled. */
- if (kind == dlang_top_level)
- {
- if (mangled == NULL || *mangled != '\0')
- return NULL;
- }
- }
-
return mangled;
}
@@ -1442,13 +1486,12 @@ dlang_parse_symbol (string *decl, const char *mangled,
static const char *
dlang_parse_tuple (string *decl, const char *mangled)
{
- char *endptr;
- long elements = strtol (mangled, &endptr, 10);
+ long elements;
- if (endptr == NULL || elements < 0)
+ mangled = dlang_number (mangled, &elements);
+ if (mangled == NULL)
return NULL;
- mangled = endptr;
string_append (decl, "Tuple!(");
while (elements--)
@@ -1489,7 +1532,7 @@ dlang_template_args (string *decl, const char *mangled)
{
case 'S': /* Symbol parameter. */
mangled++;
- mangled = dlang_parse_symbol (decl, mangled, dlang_template_param);
+ mangled = dlang_identifier (decl, mangled, dlang_template_param);
break;
case 'T': /* Type parameter. */
mangled++;
@@ -1537,11 +1580,14 @@ dlang_parse_template (string *decl, const char *mangled, long len)
TemplateInstanceName:
Number __T LName TemplateArgs Z
+ Number __U LName TemplateArgs Z
^
The start pointer should be at the above location, and LEN should be
the value of the decoded number.
*/
- if (strncmp (mangled, "__T", 3) != 0)
+
+ /* Template symbol. */
+ if (!ISDIGIT (mangled[3]) || mangled[3] == '0')
return NULL;
mangled += 3;
@@ -1584,9 +1630,7 @@ dlang_demangle (const char *mangled, int option ATTRIBUTE_UNUSED)
}
else
{
- mangled += 2;
-
- if (dlang_parse_symbol (&decl, mangled, dlang_top_level) == NULL)
+ if (dlang_parse_mangle (&decl, mangled, dlang_top_level) == NULL)
string_delete (&decl);
}
diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
index 04d39f4..547a2dd 100644
--- a/libiberty/testsuite/d-demangle-expected
+++ b/libiberty/testsuite/d-demangle-expected
@@ -22,6 +22,14 @@ _D8demangle4testPFLAiYi
demangle.test
#
--format=dlang
+_D8demangle4testFZv
+demangle.test()
+#
+--format=dlang
+_D8demangle4testMFZ2fnMFZv
+demangle.test().fn()
+#
+--format=dlang
_D8demangle4testFaZv
demangle.test(char)
#
@@ -330,6 +338,10 @@ _D8demangle4testFNkaZv
demangle.test(return char)
#
--format=dlang
+_D8demangle4testFNlaZv
+demangle.test(char)
+#
+--format=dlang
_D8demangle4testFaXv
demangle.test(char...)
#
@@ -478,6 +490,26 @@ _D8demangle4testFNjNkDFNjZaZv
demangle.test(return char() return delegate)
#
--format=dlang
+_D8demangle4testFNlDFZaZv
+demangle.test(char() delegate)
+#
+--format=dlang
+_D8demangle4testFMDFZaZv
+demangle.test(scope char() delegate)
+#
+--format=dlang
+_D8demangle4testFDFNlZaZv
+demangle.test(char() scope delegate)
+#
+--format=dlang
+_D8demangle4testFMDFNlZaZv
+demangle.test(scope char() scope delegate)
+#
+--format=dlang
+_D8demangle4testFNlMDFNlZaZv
+demangle.test(scope char() scope delegate)
+#
+--format=dlang
_D8demangle4testFPFNaZaZv
demangle.test(char() pure function)
#
@@ -534,8 +566,28 @@ _D8demangle4testFNjNkPFNjZaZv
demangle.test(return char() return function)
#
--format=dlang
+_D8demangle4testFNlPFZaZv
+demangle.test(char() function)
+#
+--format=dlang
+_D8demangle4testFMPFZaZv
+demangle.test(scope char() function)
+#
+--format=dlang
+_D8demangle4testFPFNlZaZv
+demangle.test(char() scope function)
+#
+--format=dlang
+_D8demangle4testFMPFNlZaZv
+demangle.test(scope char() scope function)
+#
+--format=dlang
+_D8demangle4testFNlMPFNlZaZv
+demangle.test(scope char() scope function)
+#
+--format=dlang
_D8demangle4test6__initZ
-demangle.test.init$
+initializer for demangle.test
#
--format=dlang
_D8demangle4test6__vtblZ
@@ -606,6 +658,10 @@ _D8demangle9__T4testZv
demangle.test!()
#
--format=dlang
+_D8demangle9__U4testZv
+demangle.test!()
+#
+--format=dlang
_D8demangle11__T4testTaZv
demangle.test!(char)
#
@@ -650,35 +706,35 @@ _D8demangle13__T4testVPinZv
demangle.test!(null)
#
--format=dlang
-_D8demangle14__T4testVg123Zv
+_D8demangle15__T4testVgi123Zv
demangle.test!(123)
#
--format=dlang
-_D8demangle14__T4testVi123Zv
+_D8demangle15__T4testVii123Zv
demangle.test!(123)
#
--format=dlang
-_D8demangle14__T4testVs123Zv
+_D8demangle15__T4testVsi123Zv
demangle.test!(123)
#
--format=dlang
-_D8demangle14__T4testVh123Zv
+_D8demangle15__T4testVhi123Zv
demangle.test!(123u)
#
--format=dlang
-_D8demangle14__T4testVk123Zv
+_D8demangle15__T4testVki123Zv
demangle.test!(123u)
#
--format=dlang
-_D8demangle14__T4testVt123Zv
+_D8demangle15__T4testVti123Zv
demangle.test!(123u)
#
--format=dlang
-_D8demangle14__T4testVl123Zv
+_D8demangle15__T4testVli123Zv
demangle.test!(123L)
#
--format=dlang
-_D8demangle14__T4testVm123Zv
+_D8demangle15__T4testVmi123Zv
demangle.test!(123uL)
#
--format=dlang
@@ -698,35 +754,35 @@ _D8demangle15__T4testVmN123Zv
demangle.test!(-123uL)
#
--format=dlang
-_D8demangle12__T4testVb1Zv
+_D8demangle13__T4testVbi1Zv
demangle.test!(true)
#
--format=dlang
-_D8demangle12__T4testVb0Zv
+_D8demangle13__T4testVbi0Zv
demangle.test!(false)
#
--format=dlang
-_D8demangle13__T4testVa10Zv
+_D8demangle14__T4testVai10Zv
demangle.test!('\x0a')
#
--format=dlang
-_D8demangle13__T4testVa32Zv
+_D8demangle14__T4testVai32Zv
demangle.test!(' ')
#
--format=dlang
-_D8demangle13__T4testVa65Zv
+_D8demangle14__T4testVai65Zv
demangle.test!('A')
#
--format=dlang
-_D8demangle14__T4testVa126Zv
+_D8demangle15__T4testVai126Zv
demangle.test!('~')
#
--format=dlang
-_D8demangle15__T4testVu1000Zv
+_D8demangle16__T4testVui1000Zv
demangle.test!('\u03e8')
#
--format=dlang
-_D8demangle17__T4testVw100000Zv
+_D8demangle18__T4testVwi100000Zv
demangle.test!('\U000186a0')
#
--format=dlang
@@ -782,6 +838,10 @@ _D8demangle52__T4testVrcN0C4CCCCCCCCCCCCCDP4c0B666666666666666P6Zv
demangle.test!(-0x0.C4CCCCCCCCCCCCCDp4+0x0.B666666666666666p6i)
#
--format=dlang
+_D8demangle91__T4testVde000111222333444555666777888999AAABBBCCCDDDEEEFFFP000111222333444555666777888999Zv
+demangle.test!(0x0.00111222333444555666777888999AAABBBCCCDDDEEEFFFp000111222333444555666777888999)
+#
+--format=dlang
_D8demangle22__T4testVG3ua3_616263Zv
demangle.test!("abc")
#
@@ -794,6 +854,14 @@ _D8demangle22__T4testVG3uw3_616263Zv
demangle.test!("abc"w)
#
--format=dlang
+_D8demangle16__T4testVAyaa0_Zv
+demangle.test!("")
+#
+--format=dlang
+_D8demangle32__T4testVAyaa8_20090a0d0c0b00ffZv
+demangle.test!(" \t\n\r\f\v\x00\xff")
+#
+--format=dlang
_D8demangle22__T4testVAiA4i1i2i3i4Zv
demangle.test!([1, 2, 3, 4])
#
@@ -818,6 +886,10 @@ _D8demangle35__T4testVS8demangle1SS2i1a3_616263Zv
demangle.test!(demangle.S(1, "abc"))
#
--format=dlang
+_D8demangle13__T4testTFZaZ6mangleFZv
+demangle.test!(char() function).mangle()
+#
+--format=dlang
_D8demangle4testMxFZv
demangle.test() const
#
@@ -881,6 +953,14 @@ demangle.test(char() delegate shared inout)
_D8demangle4testFDONgxFZaZv
demangle.test(char() delegate shared inout const)
#
+--format=dlang
+_D8demangle004testFaZv
+demangle.test(char)
+#
+--format=dlang
+_D8demangle000000004testFaZv
+demangle.test(char)
+#
# Unittests
#
--format=dlang
@@ -900,6 +980,126 @@ _D5__T1aZv
_D5__T1aZv
#
--format=dlang
+_D00
+_D00
+#
+--format=dlang
+_D9223372036854775817
+_D9223372036854775817
+#
+--format=dlang
+_D1az
+_D1az
+#
+--format=dlang
+_D1aN
+_D1aN
+#
+--format=dlang
+_D1aF
+_D1aF
+#
+--format=dlang
+_D1aM
+_D1aM
+#
+--format=dlang
+_D1aFZNz
+_D1aFZNz
+#
+--format=dlang
+_D1aFNzZv
+_D1aFNzZv
+#
+--format=dlang
+_D4testFDX
+_D4testFDX
+#
+--format=dlang
+_D5__T0aZv
+_D5__T0aZv
+#
+--format=dlang
+_D10__T4testYZv
+_D10__T4testYZv
+#
+--format=dlang
+_D4testFBaZv
+_D4testFBaZv
+#
+--format=dlang
+_D8__T4test
+_D8__T4test
+#
+--format=dlang
+_D10__T4testVi
+_D10__T4testVi
+#
+--format=dlang
+_D10__T4testVai
+_D10__T4testVai
+#
+--format=dlang
+_D10__T4testVbi
+_D10__T4testVbi
+#
+--format=dlang
+_D11__T4testS1a
+_D11__T4testS1a
+#
+--format=dlang
+_D12__T4testViiZv
+_D12__T4testViiZv
+#
+--format=dlang
+_D12__T4testViYZv
+_D12__T4testViYZv
+#
+--format=dlang
+_D12__T4testVrcZv
+_D12__T4testVrcZv
+#
+--format=dlang
+_D13__T4testVdeYZv
+_D13__T4testVdeYZv
+#
+--format=dlang
+_D13__T4testViSiZv
+_D13__T4testViSiZv
+#
+--format=dlang
+_D14__T4testVAiAiZv
+_D14__T4testVAiAiZv
+#
+--format=dlang
+_D14__T4testS123aZv
+_D14__T4testS123aZv
+#
+--format=dlang
+_D15__T4testVHiiAiZv
+_D15__T4testVHiiAiZv
+#
+--format=dlang
+_D15__T4testVfe0p1Zv
+_D15__T4testVfe0p1Zv
+#
+--format=dlang
+_D15__T4testVAyaa1_
+_D15__T4testVAyaa1_
+#
+--format=dlang
+_D16__T4testVAyaa0aZv
+_D16__T4testVAyaa0aZv
+#
+--format=dlang
+_D18__T4testVAyaa1_0GZv
+_D18__T4testVAyaa1_0GZv
+#
+--format=dlang
+_D18__T4testVAyaa1_YYZv
+_D18__T4testVAyaa1_YYZv
+#
+--format=dlang
_D4test3fooAa
test.foo
#
@@ -1020,7 +1220,7 @@ _D8demangle20__T2fnVAiA4i1i2i3i4Z2fnFZv
demangle.fn!([1, 2, 3, 4]).fn()
#
--format=dlang
-_D8demangle10__T2fnVi1Z2fnFZv
+_D8demangle11__T2fnVii1Z2fnFZv
demangle.fn!(1).fn()
#
--format=dlang
@@ -1052,6 +1252,18 @@ _D8demangle29__T2fnVa97Va9Va0Vu257Vw65537Z2fnFZv
demangle.fn!('a', '\x09', '\x00', '\u0101', '\U00010001').fn()
#
--format=dlang
+_D8demangle32__T2fnTS3symVS3valS1a4_6e756c6cZ3fun13__T8positionZ13__T8confusesZ8demangleFDFxaZvZv
+demangle.fn!(sym, val("null")).fun.position!().confuses!().demangle(void(const(char)) delegate)
+#
+--format=dlang
+_D8demangle39__T2fnVAyaa12_d0bfd180d0b8d0bcd0b5d180Z2fnFZv
+demangle.fn!("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xbc\xd0\xb5\xd1\x80").fn()
+#
+--format=dlang
+_D8demangle26__T2fnVAyaa6_e4b896e7958cZ2fnFZv
+demangle.fn!("\xe4\xb8\x96\xe7\x95\x8c").fn()
+#
+--format=dlang
_D2gc11gctemplates56__T8mkBitmapTS3std5range13__T4iotaTiTiZ4iotaFiiZ6ResultZ8mkBitmapFNbNiNfPmmZv
gc.gctemplates.mkBitmap!(std.range.iota!(int, int).iota(int, int).Result).mkBitmap(ulong*, ulong)
#
@@ -1090,3 +1302,7 @@ std.traits.fqnSym!(std).adjustIdent(immutable(char)[])
--format=dlang
_D2rt8lifetime36__T14_d_newarrayOpTS13_d_newarrayiTZ14_d_newarrayOpTFNaNbxC8TypeInfomPmZAv
rt.lifetime._d_newarrayOpT!(_d_newarrayiT)._d_newarrayOpT(const(TypeInfo), ulong, ulong*)
+#
+--format=dlang
+_D4core8demangle16__T6mangleTFZPvZ6mangleFNaNbNfAxaAaZ11DotSplitter5emptyMxFNaNbNdNiNfZb
+core.demangle.mangle!(void*() function).mangle(const(char)[], char[]).DotSplitter.empty() const
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 45c5722..f2a12b9 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -4720,3 +4720,18 @@ _ZdvMMMMMMMMMMMMMrrrrA_DTdvfp_fp_Eededilfdfdfdfd
_Z1MA_aMMMMA_MMA_MMMMMMMMSt1MS_o11T0000000000t2M0oooozoooo
_Z1MA_aMMMMA_MMA_MMMMMMMMSt1MS_o11T0000000000t2M0oooozoooo
+
+#
+# demangler/80513 Test for overflow in d_number
+_Z4294967297x
+_Z4294967297x
+
+#
+# demangler/80513 Test for bogus characters after __thunk_
+__thunk_16a_$_1x
+__thunk_16a_$_1x
+
+#
+# demangler/80513 Test for overflow in consume_count
+__thunk_4294967297__$_1x
+__thunk_4294967297__$_1x
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 888126e..5371bbb 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,105 @@
+2017-06-23 Andrew Waterman <andrew@sifive.com>
+
+ * riscv-opc.c (riscv_opcodes): Mark I-type SLT instruction as an
+ alias; do not mark SLTI instruction as an alias.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-dis.c (RM_0FAE_REG_5): Removed.
+ (PREFIX_MOD_3_0F01_REG_5_RM_1): Likewise.
+ (PREFIX_MOD_3_0F01_REG_5_RM_0): New.
+ (PREFIX_MOD_3_0FAE_REG_5): Likewise.
+ (prefix_table): Remove PREFIX_MOD_3_0F01_REG_5_RM_1. Add
+ PREFIX_MOD_3_0F01_REG_5_RM_0.
+ (prefix_table): Update PREFIX_MOD_0_0FAE_REG_5. Add
+ PREFIX_MOD_3_0FAE_REG_5.
+ (mod_table): Update MOD_0FAE_REG_5.
+ (rm_table): Update RM_0F01_REG_5. Remove RM_0FAE_REG_5.
+ * i386-opc.tbl: Update incsspd, incsspq and setssbsy.
+ * i386-tbl.h: Regenerated.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-dis.c (prefix_table): Replace savessp with saveprevssp.
+ * i386-opc.tbl: Likewise.
+ * i386-tbl.h: Regenerated.
+
+2017-06-21 H.J. Lu <hongjiu.lu@intel.com>
+
+ * i386-dis.c (reg_table): Swap indirEv with NOTRACK on "call{&|}"
+ and "jmp{&|}".
+ (NOTRACK_Fixup): Support memory indirect branch with NOTRACK
+ prefix.
+
+2017-06-19 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21614
+ * score-dis.c (score_opcodes): Add sentinel.
+
+2017-06-16 Alan Modra <amodra@gmail.com>
+
+ * rx-decode.c: Regenerate.
+
+2017-06-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/21594
+ * i386-dis.c (OP_E_register): Check valid bnd register.
+ (OP_G): Likewise.
+
+2017-06-15 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21595
+ * aarch64-dis.c (aarch64_ext_ldst_reglist): Check for an out of
+ range value.
+
+2017-06-15 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21588
+ * rl78-decode.opc (OP_BUF_LEN): Define.
+ (GETBYTE): Check for the index exceeding OP_BUF_LEN.
+ (rl78_decode_opcode): Use OP_BUF_LEN as the length of the op_buf
+ array.
+ * rl78-decode.c: Regenerate.
+
+2017-06-15 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21586
+ * bfin-dis.c (gregs): Clip index to prevent overflow.
+ (regs): Likewise.
+ (regs_lo): Likewise.
+ (regs_hi): Likewise.
+
+2017-06-14 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21576
+ * score7-dis.c (score_opcodes): Add sentinel.
+
+2017-06-14 Yao Qi <yao.qi@linaro.org>
+
+ * aarch64-dis.c: Include disassemble.h instead of dis-asm.h.
+ * arm-dis.c: Likewise.
+ * ia64-dis.c: Likewise.
+ * mips-dis.c: Likewise.
+ * spu-dis.c: Likewise.
+ * disassemble.h (print_insn_aarch64): New declaration, moved from
+ include/dis-asm.h.
+ (print_insn_big_arm, print_insn_big_mips): Likewise.
+ (print_insn_i386, print_insn_ia64): Likewise.
+ (print_insn_little_arm, print_insn_little_mips): Likewise.
+
+2017-06-14 Nick Clifton <nickc@redhat.com>
+
+ PR binutils/21587
+ * rx-decode.opc: Include libiberty.h
+ (GET_SCALE): New macro - validates access to SCALE array.
+ (GET_PSCALE): New macro - validates access to PSCALE array.
+ (DIs, SIs, S2Is, rx_disp): Use new macros.
+ * rx-decode.c: Regenerate.
+
+2017-07-14 Andre Vieira <andre.simoesdiasvieira@arm.com>
+
+ * arm-dis.c (print_insn_arm): Remove bogus entry for bx.
+
2017-05-30 Anton Kolesov <anton.kolesov@synopsys.com>
* arc-dis.c (enforced_isa_mask): Declare.
diff --git a/opcodes/aarch64-dis.c b/opcodes/aarch64-dis.c
index e5fe61f..a860dbc 100644
--- a/opcodes/aarch64-dis.c
+++ b/opcodes/aarch64-dis.c
@@ -20,7 +20,7 @@
#include "sysdep.h"
#include "bfd_stdint.h"
-#include "dis-asm.h"
+#include "disassemble.h"
#include "libiberty.h"
#include "opintl.h"
#include "aarch64-dis.h"
@@ -409,6 +409,9 @@ aarch64_ext_ldst_reglist (const aarch64_operand *self ATTRIBUTE_UNUSED,
info->reglist.first_regno = extract_field (FLD_Rt, code, 0);
/* opcode */
value = extract_field (FLD_opcode, code, 0);
+ /* PR 21595: Check for a bogus value. */
+ if (value >= ARRAY_SIZE (data))
+ return 0;
if (expected_num != data[value].num_elements || data[value].is_reserved)
return 0;
info->reglist.num_regs = data[value].num_regs;
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index a0a03ee..a30afb9 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -22,7 +22,7 @@
#include "sysdep.h"
-#include "dis-asm.h"
+#include "disassemble.h"
#include "opcode/arm.h"
#include "opintl.h"
#include "safe-ctype.h"
@@ -2310,8 +2310,6 @@ static const struct opcode32 arm_opcodes[] =
0x01300000, 0x0ff00010, "teq%p%c\t%16-19r, %o"},
{ARM_FEATURE_CORE_LOW (ARM_EXT_V1),
0x01300010, 0x0ff00010, "teq%p%c\t%16-19R, %o"},
- {ARM_FEATURE_CORE_LOW (ARM_EXT_V5),
- 0x0130f000, 0x0ff0f010, "bx%c\t%0-3r"},
{ARM_FEATURE_CORE_LOW (ARM_EXT_V1),
0x03400000, 0x0fe00000, "cmp%p%c\t%16-19r, %o"},
diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c
index bca68b4..e3f4622 100644
--- a/opcodes/bfin-dis.c
+++ b/opcodes/bfin-dis.c
@@ -350,7 +350,7 @@ static const enum machine_registers decode_gregs[] =
REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
};
-#define gregs(x, i) REGNAME (decode_gregs[((i) << 3) | (x)])
+#define gregs(x, i) REGNAME (decode_gregs[(((i) << 3) | (x)) & 15])
/* [dregs pregs (iregs mregs) (bregs lregs)]. */
static const enum machine_registers decode_regs[] =
@@ -361,7 +361,7 @@ static const enum machine_registers decode_regs[] =
REG_B0, REG_B1, REG_B2, REG_B3, REG_L0, REG_L1, REG_L2, REG_L3,
};
-#define regs(x, i) REGNAME (decode_regs[((i) << 3) | (x)])
+#define regs(x, i) REGNAME (decode_regs[(((i) << 3) | (x)) & 31])
/* [dregs pregs (iregs mregs) (bregs lregs) Low Half]. */
static const enum machine_registers decode_regs_lo[] =
@@ -372,7 +372,7 @@ static const enum machine_registers decode_regs_lo[] =
REG_BL0, REG_BL1, REG_BL2, REG_BL3, REG_LL0, REG_LL1, REG_LL2, REG_LL3,
};
-#define regs_lo(x, i) REGNAME (decode_regs_lo[((i) << 3) | (x)])
+#define regs_lo(x, i) REGNAME (decode_regs_lo[(((i) << 3) | (x)) & 31])
/* [dregs pregs (iregs mregs) (bregs lregs) High Half]. */
static const enum machine_registers decode_regs_hi[] =
@@ -383,7 +383,7 @@ static const enum machine_registers decode_regs_hi[] =
REG_BH0, REG_BH1, REG_BH2, REG_BH3, REG_LH0, REG_LH1, REG_LH2, REG_LH3,
};
-#define regs_hi(x, i) REGNAME (decode_regs_hi[((i) << 3) | (x)])
+#define regs_hi(x, i) REGNAME (decode_regs_hi[(((i) << 3) | (x)) & 31])
static const enum machine_registers decode_statbits[] =
{
diff --git a/opcodes/disassemble.h b/opcodes/disassemble.h
index dec09fe..bccd6af 100644
--- a/opcodes/disassemble.h
+++ b/opcodes/disassemble.h
@@ -21,9 +21,12 @@
#define DISASSEMBLE_H
#include "dis-asm.h"
+extern int print_insn_aarch64 (bfd_vma, disassemble_info *);
extern int print_insn_alpha (bfd_vma, disassemble_info *);
extern int print_insn_avr (bfd_vma, disassemble_info *);
extern int print_insn_bfin (bfd_vma, disassemble_info *);
+extern int print_insn_big_arm (bfd_vma, disassemble_info *);
+extern int print_insn_big_mips (bfd_vma, disassemble_info *);
extern int print_insn_big_nios2 (bfd_vma, disassemble_info *);
extern int print_insn_big_powerpc (bfd_vma, disassemble_info *);
extern int print_insn_big_score (bfd_vma, disassemble_info *);
@@ -42,14 +45,18 @@ extern int print_insn_h8300s (bfd_vma, disassemble_info *);
extern int print_insn_h8500 (bfd_vma, disassemble_info *);
extern int print_insn_hppa (bfd_vma, disassemble_info *);
extern int print_insn_i370 (bfd_vma, disassemble_info *);
+extern int print_insn_i386 (bfd_vma, disassemble_info *);
extern int print_insn_i386_att (bfd_vma, disassemble_info *);
extern int print_insn_i386_intel (bfd_vma, disassemble_info *);
extern int print_insn_i860 (bfd_vma, disassemble_info *);
extern int print_insn_i960 (bfd_vma, disassemble_info *);
+extern int print_insn_ia64 (bfd_vma, disassemble_info *);
extern int print_insn_ip2k (bfd_vma, disassemble_info *);
extern int print_insn_iq2000 (bfd_vma, disassemble_info *);
extern int print_insn_little_nios2 (bfd_vma, disassemble_info *);
extern int print_insn_riscv (bfd_vma, disassemble_info *);
+extern int print_insn_little_arm (bfd_vma, disassemble_info *);
+extern int print_insn_little_mips (bfd_vma, disassemble_info *);
extern int print_insn_little_powerpc (bfd_vma, disassemble_info *);
extern int print_insn_little_score (bfd_vma, disassemble_info *);
extern int print_insn_lm32 (bfd_vma, disassemble_info *);
@@ -78,6 +85,7 @@ extern int print_insn_pru (bfd_vma, disassemble_info *);
extern int print_insn_rs6000 (bfd_vma, disassemble_info *);
extern int print_insn_s390 (bfd_vma, disassemble_info *);
extern int print_insn_sh64 (bfd_vma, disassemble_info *);
+extern int print_insn_spu (bfd_vma, disassemble_info *);
extern int print_insn_tic30 (bfd_vma, disassemble_info *);
extern int print_insn_tic4x (bfd_vma, disassemble_info *);
extern int print_insn_tic54x (bfd_vma, disassemble_info *);
diff --git a/opcodes/i386-dis.c b/opcodes/i386-dis.c
index b35dbc0..612e06f 100644
--- a/opcodes/i386-dis.c
+++ b/opcodes/i386-dis.c
@@ -940,7 +940,6 @@ enum
RM_0F01_REG_5,
RM_0F01_REG_7,
RM_0F1E_MOD_3_REG_7,
- RM_0FAE_REG_5,
RM_0FAE_REG_6,
RM_0FAE_REG_7
};
@@ -949,7 +948,7 @@ enum
{
PREFIX_90 = 0,
PREFIX_MOD_0_0F01_REG_5,
- PREFIX_MOD_3_0F01_REG_5_RM_1,
+ PREFIX_MOD_3_0F01_REG_5_RM_0,
PREFIX_MOD_3_0F01_REG_5_RM_2,
PREFIX_0F10,
PREFIX_0F11,
@@ -997,6 +996,7 @@ enum
PREFIX_MOD_0_0FAE_REG_4,
PREFIX_MOD_3_0FAE_REG_4,
PREFIX_MOD_0_0FAE_REG_5,
+ PREFIX_MOD_3_0FAE_REG_5,
PREFIX_0FAE_REG_6,
PREFIX_0FAE_REG_7,
PREFIX_0FB8,
@@ -3552,9 +3552,9 @@ static const struct dis386 reg_table[][8] = {
{
{ "incQ", { Evh1 }, 0 },
{ "decQ", { Evh1 }, 0 },
- { "call{&|}", { indirEv, NOTRACK, BND }, 0 },
+ { "call{&|}", { NOTRACK, indirEv, BND }, 0 },
{ MOD_TABLE (MOD_FF_REG_3) },
- { "jmp{&|}", { indirEv, NOTRACK, BND }, 0 },
+ { "jmp{&|}", { NOTRACK, indirEv, BND }, 0 },
{ MOD_TABLE (MOD_FF_REG_5) },
{ "pushU", { stackEv }, 0 },
{ Bad_Opcode },
@@ -3789,16 +3789,16 @@ static const struct dis386 prefix_table[][4] = {
{ "rstorssp", { Mq }, PREFIX_OPCODE },
},
- /* PREFIX_MOD_3_0F01_REG_5_RM_1 */
+ /* PREFIX_MOD_3_0F01_REG_5_RM_0 */
{
{ Bad_Opcode },
- { "incsspK", { Skip_MODRM }, PREFIX_OPCODE },
+ { "setssbsy", { Skip_MODRM }, PREFIX_OPCODE },
},
/* PREFIX_MOD_3_0F01_REG_5_RM_2 */
{
{ Bad_Opcode },
- { "savessp", { Skip_MODRM }, PREFIX_OPCODE },
+ { "saveprevssp", { Skip_MODRM }, PREFIX_OPCODE },
},
/* PREFIX_0F10 */
@@ -4134,7 +4134,12 @@ static const struct dis386 prefix_table[][4] = {
/* PREFIX_MOD_0_0FAE_REG_5 */
{
{ "xrstor", { FXSAVE }, PREFIX_OPCODE },
- { "setssbsy", { Mq }, PREFIX_OPCODE },
+ },
+
+ /* PREFIX_MOD_3_0FAE_REG_5 */
+ {
+ { "lfence", { Skip_MODRM }, 0 },
+ { "incsspK", { Rdq }, PREFIX_OPCODE },
},
/* PREFIX_0FAE_REG_6 */
@@ -11657,7 +11662,7 @@ static const struct dis386 mod_table[][2] = {
{
/* MOD_0FAE_REG_5 */
{ PREFIX_TABLE (PREFIX_MOD_0_0FAE_REG_5) },
- { RM_TABLE (RM_0FAE_REG_5) },
+ { PREFIX_TABLE (PREFIX_MOD_3_0FAE_REG_5) },
},
{
/* MOD_0FAE_REG_6 */
@@ -12233,8 +12238,8 @@ static const struct dis386 rm_table[][8] = {
},
{
/* RM_0F01_REG_5 */
+ { PREFIX_TABLE (PREFIX_MOD_3_0F01_REG_5_RM_0) },
{ Bad_Opcode },
- { PREFIX_TABLE (PREFIX_MOD_3_0F01_REG_5_RM_1) },
{ PREFIX_TABLE (PREFIX_MOD_3_0F01_REG_5_RM_2) },
{ Bad_Opcode },
{ Bad_Opcode },
@@ -12262,10 +12267,6 @@ static const struct dis386 rm_table[][8] = {
{ "nopQ", { Ev }, 0 },
},
{
- /* RM_0FAE_REG_5 */
- { "lfence", { Skip_MODRM }, 0 },
- },
- {
/* RM_0FAE_REG_6 */
{ "mfence", { Skip_MODRM }, 0 },
},
@@ -15025,6 +15026,11 @@ OP_E_register (int bytemode, int sizeflag)
names = address_mode == mode_64bit ? names64 : names32;
break;
case bnd_mode:
+ if (reg > 0x3)
+ {
+ oappend ("(bad)");
+ return;
+ }
names = names_bnd;
break;
case indir_v_mode:
@@ -15569,6 +15575,11 @@ OP_G (int bytemode, int sizeflag)
oappend (names64[modrm.reg + add]);
break;
case bnd_mode:
+ if (modrm.reg > 0x3)
+ {
+ oappend ("(bad)");
+ return;
+ }
oappend (names_bnd[modrm.reg]);
break;
case v_mode:
@@ -16806,14 +16817,12 @@ static void
NOTRACK_Fixup (int bytemode ATTRIBUTE_UNUSED,
int sizeflag ATTRIBUTE_UNUSED)
{
- if (modrm.mod == 3
- && active_seg_prefix == PREFIX_DS
+ if (active_seg_prefix == PREFIX_DS
&& (address_mode != mode_64bit || last_data_prefix < 0))
{
- /* NOTRACK prefix is only valid on register indirect branch
- instructions and it must be the last prefix before REX
- prefix and opcode. NB: DATA prefix is unsupported for
- Intel64. */
+ /* NOTRACK prefix is only valid on indirect branch instructions
+ and it must be the last prefix before REX prefix and opcode.
+ NB: DATA prefix is unsupported for Intel64. */
if (last_active_prefix >= 0)
{
int notrack_prefix = last_active_prefix;
diff --git a/opcodes/i386-opc.tbl b/opcodes/i386-opc.tbl
index 5b1a4fd..924bb0a 100644
--- a/opcodes/i386-opc.tbl
+++ b/opcodes/i386-opc.tbl
@@ -6009,17 +6009,17 @@ ptwrite, 1, 0xf30fae, 0x4, 2, CpuPTWRITE, Modrm|CheckRegSize|No_bSuf|No_wSuf|No_
// CET instructions.
-incsspd, 0, 0xf30f01e9, None, 3, CpuCET, IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
-incsspq, 0, 0xf30f01e9, None, 3, CpuCET|Cpu64, IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Rex64, { 0 }
+incsspd, 1, 0xf30fae, 0x5, 2, CpuCET, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32 }
+incsspq, 1, 0xf30fae, 0x5, 2, CpuCET|Cpu64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Rex64, { Reg64 }
rdsspd, 1, 0xf30f1e, 0x1, 2, CpuCET, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32 }
rdsspq, 1, 0xf30f1e, 0x1, 2, CpuCET|Cpu64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Rex64, { Reg64 }
-savessp, 0, 0xf30f01ea, None, 3, CpuCET, IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
+saveprevssp, 0, 0xf30f01ea, None, 3, CpuCET, IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
rstorssp, 1, 0xf30f01, 0x5, 2, CpuCET, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Qword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S }
wrssd, 2, 0x0f38f6, None, 3, CpuCET, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32, Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S }
wrssq, 2, 0x0f38f6, None, 3, CpuCET|Cpu64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Rex64, { Reg64, Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S }
wrussd, 2, 0x660f38f5, None, 3, CpuCET, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { Reg32, Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S }
wrussq, 2, 0x660f38f5, None, 3, CpuCET|Cpu64, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|Rex64, { Reg64, Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S }
-setssbsy, 1, 0xf30fae, 0x5, 2, CpuCET, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Qword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S }
+setssbsy, 0, 0xf30f01e8, None, 3, CpuCET, IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
clrssbsy, 1, 0xf30fae, 0x6, 2, CpuCET, Modrm|IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf|NoRex64, { Qword|Unspecified|BaseIndex|Disp8|Disp16|Disp32|Disp32S }
endbr64, 0, 0xf30f1efa, None, 3, CpuCET, IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
endbr32, 0, 0xf30f1efb, None, 3, CpuCET, IgnoreSize|No_bSuf|No_wSuf|No_lSuf|No_sSuf|No_qSuf|No_ldSuf, { 0 }
diff --git a/opcodes/i386-tbl.h b/opcodes/i386-tbl.h
index 1fcd003..af583ce 100644
--- a/opcodes/i386-tbl.h
+++ b/opcodes/i386-tbl.h
@@ -91993,30 +91993,30 @@ const insn_template i386_optab[] =
{ { { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 } } } },
- { "incsspd", 0, 0xf30f01e9, None, 3,
+ { "incsspd", 1, 0xf30fae, 0x5, 2,
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 } },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1,
+ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1,
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 },
- { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ { { { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } },
- { "incsspq", 0, 0xf30f01e9, None, 3,
+ { "incsspq", 1, 0xf30fae, 0x5, 2,
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0 } },
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1,
+ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1,
1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 },
- { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ { { { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } },
{ "rdsspd", 1, 0xf30f1e, 0x1, 2,
@@ -92045,7 +92045,7 @@ const insn_template i386_optab[] =
{ { { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } },
- { "savessp", 0, 0xf30f01ea, None, 3,
+ { "saveprevssp", 0, 0xf30f01ea, None, 3,
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -92135,19 +92135,19 @@ const insn_template i386_optab[] =
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 } } } },
- { "setssbsy", 1, 0xf30fae, 0x5, 2,
+ { "setssbsy", 0, 0xf30f01e8, None, 3,
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 } },
- { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1,
- 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
+ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1,
+ 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0 },
{ { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 } } } },
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } } },
{ "clrssbsy", 1, 0xf30fae, 0x6, 2,
{ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
diff --git a/opcodes/ia64-dis.c b/opcodes/ia64-dis.c
index 3f2253a..2cf6e60 100644
--- a/opcodes/ia64-dis.c
+++ b/opcodes/ia64-dis.c
@@ -22,7 +22,7 @@
#include "sysdep.h"
#include <assert.h>
-#include "dis-asm.h"
+#include "disassemble.h"
#include "opcode/ia64.h"
#define NELEMS(a) ((int) (sizeof (a) / sizeof (a[0])))
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index 8caae81..b541e03 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -20,7 +20,7 @@
MA 02110-1301, USA. */
#include "sysdep.h"
-#include "dis-asm.h"
+#include "disassemble.h"
#include "libiberty.h"
#include "opcode/mips.h"
#include "opintl.h"
diff --git a/opcodes/riscv-opc.c b/opcodes/riscv-opc.c
index 0188a65..9914c44 100644
--- a/opcodes/riscv-opc.c
+++ b/opcodes/riscv-opc.c
@@ -245,9 +245,9 @@ const struct riscv_opcode riscv_opcodes[] =
{"snez", "I", "d,t", MATCH_SLTU, MASK_SLTU | MASK_RS1, match_opcode, INSN_ALIAS },
{"sltz", "I", "d,s", MATCH_SLT, MASK_SLT | MASK_RS2, match_opcode, INSN_ALIAS },
{"sgtz", "I", "d,t", MATCH_SLT, MASK_SLT | MASK_RS1, match_opcode, INSN_ALIAS },
-{"slti", "I", "d,s,j", MATCH_SLTI, MASK_SLTI, match_opcode, INSN_ALIAS },
+{"slti", "I", "d,s,j", MATCH_SLTI, MASK_SLTI, match_opcode, 0 },
{"slt", "I", "d,s,t", MATCH_SLT, MASK_SLT, match_opcode, 0 },
-{"slt", "I", "d,s,j", MATCH_SLTI, MASK_SLTI, match_opcode, 0 },
+{"slt", "I", "d,s,j", MATCH_SLTI, MASK_SLTI, match_opcode, INSN_ALIAS },
{"sltiu", "I", "d,s,j", MATCH_SLTIU, MASK_SLTIU, match_opcode, 0 },
{"sltu", "I", "d,s,t", MATCH_SLTU, MASK_SLTU, match_opcode, 0 },
{"sltu", "I", "d,s,j", MATCH_SLTIU, MASK_SLTIU, match_opcode, INSN_ALIAS },
diff --git a/opcodes/rl78-decode.c b/opcodes/rl78-decode.c
index d0566ea..b2d4bd6 100644
--- a/opcodes/rl78-decode.c
+++ b/opcodes/rl78-decode.c
@@ -51,7 +51,9 @@ typedef struct
#define W() rl78->size = RL78_Word
#define AU ATTRIBUTE_UNUSED
-#define GETBYTE() (ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr))
+
+#define OP_BUF_LEN 20
+#define GETBYTE() (ld->rl78->n_bytes < (OP_BUF_LEN - 1) ? ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr): 0)
#define B ((unsigned long) GETBYTE())
#define SYNTAX(x) rl78->syntax = x
@@ -169,7 +171,7 @@ rl78_decode_opcode (unsigned long pc AU,
RL78_Dis_Isa isa)
{
LocalData lds, * ld = &lds;
- unsigned char op_buf[20] = {0};
+ unsigned char op_buf[OP_BUF_LEN] = {0};
unsigned char *op = op_buf;
int op0, op1;
@@ -201,7 +203,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("nop");
-#line 911 "rl78-decode.opc"
+#line 913 "rl78-decode.opc"
ID(nop);
/*----------------------------------------------------------------------*/
@@ -214,7 +216,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x07:
{
/** 0000 0rw1 addw %0, %1 */
-#line 274 "rl78-decode.opc"
+#line 276 "rl78-decode.opc"
int rw AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -224,7 +226,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rw = 0x%x\n", rw);
}
SYNTAX("addw %0, %1");
-#line 274 "rl78-decode.opc"
+#line 276 "rl78-decode.opc"
ID(add); W(); DR(AX); SRW(rw); Fzac;
}
@@ -239,7 +241,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addw %0, %e!1");
-#line 265 "rl78-decode.opc"
+#line 267 "rl78-decode.opc"
ID(add); W(); DR(AX); SM(None, IMMU(2)); Fzac;
}
@@ -254,7 +256,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addw %0, #%1");
-#line 271 "rl78-decode.opc"
+#line 273 "rl78-decode.opc"
ID(add); W(); DR(AX); SC(IMMU(2)); Fzac;
}
@@ -269,7 +271,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addw %0, %1");
-#line 277 "rl78-decode.opc"
+#line 279 "rl78-decode.opc"
ID(add); W(); DR(AX); SM(None, SADDR); Fzac;
}
@@ -284,7 +286,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("xch a, x");
-#line 1234 "rl78-decode.opc"
+#line 1236 "rl78-decode.opc"
ID(xch); DR(A); SR(X);
/*----------------------------------------------------------------------*/
@@ -301,7 +303,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e1");
-#line 678 "rl78-decode.opc"
+#line 680 "rl78-decode.opc"
ID(mov); DR(A); SM(B, IMMU(2));
}
@@ -316,7 +318,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("add %0, #%1");
-#line 228 "rl78-decode.opc"
+#line 230 "rl78-decode.opc"
ID(add); DM(None, SADDR); SC(IMMU(1)); Fzac;
/*----------------------------------------------------------------------*/
@@ -333,7 +335,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("add %0, %1");
-#line 222 "rl78-decode.opc"
+#line 224 "rl78-decode.opc"
ID(add); DR(A); SM(None, SADDR); Fzac;
}
@@ -348,7 +350,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("add %0, #%1");
-#line 216 "rl78-decode.opc"
+#line 218 "rl78-decode.opc"
ID(add); DR(A); SC(IMMU(1)); Fzac;
}
@@ -363,7 +365,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("add %0, %e1");
-#line 204 "rl78-decode.opc"
+#line 206 "rl78-decode.opc"
ID(add); DR(A); SM(HL, 0); Fzac;
}
@@ -378,7 +380,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("add %0, %ea1");
-#line 210 "rl78-decode.opc"
+#line 212 "rl78-decode.opc"
ID(add); DR(A); SM(HL, IMMU(1)); Fzac;
}
@@ -393,7 +395,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("add %0, %e!1");
-#line 201 "rl78-decode.opc"
+#line 203 "rl78-decode.opc"
ID(add); DR(A); SM(None, IMMU(2)); Fzac;
}
@@ -408,7 +410,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addw %0, #%1");
-#line 280 "rl78-decode.opc"
+#line 282 "rl78-decode.opc"
ID(add); W(); DR(SP); SC(IMMU(1)); Fzac;
/*----------------------------------------------------------------------*/
@@ -425,7 +427,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("es:");
-#line 193 "rl78-decode.opc"
+#line 195 "rl78-decode.opc"
DE(); SE();
op ++;
pc ++;
@@ -440,7 +442,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x16:
{
/** 0001 0ra0 movw %0, %1 */
-#line 859 "rl78-decode.opc"
+#line 861 "rl78-decode.opc"
int ra AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -450,7 +452,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" ra = 0x%x\n", ra);
}
SYNTAX("movw %0, %1");
-#line 859 "rl78-decode.opc"
+#line 861 "rl78-decode.opc"
ID(mov); W(); DRW(ra); SR(AX);
}
@@ -460,7 +462,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x17:
{
/** 0001 0ra1 movw %0, %1 */
-#line 856 "rl78-decode.opc"
+#line 858 "rl78-decode.opc"
int ra AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -470,7 +472,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" ra = 0x%x\n", ra);
}
SYNTAX("movw %0, %1");
-#line 856 "rl78-decode.opc"
+#line 858 "rl78-decode.opc"
ID(mov); W(); DR(AX); SRW(ra);
}
@@ -485,7 +487,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e0, %1");
-#line 729 "rl78-decode.opc"
+#line 731 "rl78-decode.opc"
ID(mov); DM(B, IMMU(2)); SR(A);
}
@@ -500,7 +502,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e0, #%1");
-#line 726 "rl78-decode.opc"
+#line 728 "rl78-decode.opc"
ID(mov); DM(B, IMMU(2)); SC(IMMU(1));
}
@@ -515,7 +517,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addc %0, #%1");
-#line 260 "rl78-decode.opc"
+#line 262 "rl78-decode.opc"
ID(addc); DM(None, SADDR); SC(IMMU(1)); Fzac;
/*----------------------------------------------------------------------*/
@@ -532,7 +534,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addc %0, %1");
-#line 257 "rl78-decode.opc"
+#line 259 "rl78-decode.opc"
ID(addc); DR(A); SM(None, SADDR); Fzac;
}
@@ -547,7 +549,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addc %0, #%1");
-#line 248 "rl78-decode.opc"
+#line 250 "rl78-decode.opc"
ID(addc); DR(A); SC(IMMU(1)); Fzac;
}
@@ -562,7 +564,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addc %0, %e1");
-#line 236 "rl78-decode.opc"
+#line 238 "rl78-decode.opc"
ID(addc); DR(A); SM(HL, 0); Fzac;
}
@@ -577,7 +579,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addc %0, %ea1");
-#line 245 "rl78-decode.opc"
+#line 247 "rl78-decode.opc"
ID(addc); DR(A); SM(HL, IMMU(1)); Fzac;
}
@@ -592,7 +594,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("addc %0, %e!1");
-#line 233 "rl78-decode.opc"
+#line 235 "rl78-decode.opc"
ID(addc); DR(A); SM(None, IMMU(2)); Fzac;
}
@@ -607,7 +609,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subw %0, #%1");
-#line 1198 "rl78-decode.opc"
+#line 1200 "rl78-decode.opc"
ID(sub); W(); DR(SP); SC(IMMU(1)); Fzac;
/*----------------------------------------------------------------------*/
@@ -620,7 +622,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x27:
{
/** 0010 0rw1 subw %0, %1 */
-#line 1192 "rl78-decode.opc"
+#line 1194 "rl78-decode.opc"
int rw AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -630,7 +632,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rw = 0x%x\n", rw);
}
SYNTAX("subw %0, %1");
-#line 1192 "rl78-decode.opc"
+#line 1194 "rl78-decode.opc"
ID(sub); W(); DR(AX); SRW(rw); Fzac;
}
@@ -645,7 +647,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subw %0, %e!1");
-#line 1183 "rl78-decode.opc"
+#line 1185 "rl78-decode.opc"
ID(sub); W(); DR(AX); SM(None, IMMU(2)); Fzac;
}
@@ -660,7 +662,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subw %0, #%1");
-#line 1189 "rl78-decode.opc"
+#line 1191 "rl78-decode.opc"
ID(sub); W(); DR(AX); SC(IMMU(2)); Fzac;
}
@@ -675,7 +677,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subw %0, %1");
-#line 1195 "rl78-decode.opc"
+#line 1197 "rl78-decode.opc"
ID(sub); W(); DR(AX); SM(None, SADDR); Fzac;
}
@@ -690,7 +692,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e0, %1");
-#line 741 "rl78-decode.opc"
+#line 743 "rl78-decode.opc"
ID(mov); DM(C, IMMU(2)); SR(A);
}
@@ -705,7 +707,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e1");
-#line 684 "rl78-decode.opc"
+#line 686 "rl78-decode.opc"
ID(mov); DR(A); SM(C, IMMU(2));
}
@@ -720,7 +722,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("sub %0, #%1");
-#line 1146 "rl78-decode.opc"
+#line 1148 "rl78-decode.opc"
ID(sub); DM(None, SADDR); SC(IMMU(1)); Fzac;
/*----------------------------------------------------------------------*/
@@ -737,7 +739,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("sub %0, %1");
-#line 1140 "rl78-decode.opc"
+#line 1142 "rl78-decode.opc"
ID(sub); DR(A); SM(None, SADDR); Fzac;
}
@@ -752,7 +754,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("sub %0, #%1");
-#line 1134 "rl78-decode.opc"
+#line 1136 "rl78-decode.opc"
ID(sub); DR(A); SC(IMMU(1)); Fzac;
}
@@ -767,7 +769,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("sub %0, %e1");
-#line 1122 "rl78-decode.opc"
+#line 1124 "rl78-decode.opc"
ID(sub); DR(A); SM(HL, 0); Fzac;
}
@@ -782,7 +784,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("sub %0, %ea1");
-#line 1128 "rl78-decode.opc"
+#line 1130 "rl78-decode.opc"
ID(sub); DR(A); SM(HL, IMMU(1)); Fzac;
}
@@ -797,7 +799,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("sub %0, %e!1");
-#line 1119 "rl78-decode.opc"
+#line 1121 "rl78-decode.opc"
ID(sub); DR(A); SM(None, IMMU(2)); Fzac;
}
@@ -808,7 +810,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x36:
{
/** 0011 0rg0 movw %0, #%1 */
-#line 853 "rl78-decode.opc"
+#line 855 "rl78-decode.opc"
int rg AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -818,7 +820,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("movw %0, #%1");
-#line 853 "rl78-decode.opc"
+#line 855 "rl78-decode.opc"
ID(mov); W(); DRW(rg); SC(IMMU(2));
}
@@ -830,7 +832,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0011 0001 0bit 0000 btclr %s1, $%a0 */
-#line 416 "rl78-decode.opc"
+#line 418 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -840,7 +842,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("btclr %s1, $%a0");
-#line 416 "rl78-decode.opc"
+#line 418 "rl78-decode.opc"
ID(branch_cond_clear); SM(None, SADDR); SB(bit); DC(pc+IMMS(1)+4); COND(T);
/*----------------------------------------------------------------------*/
@@ -850,7 +852,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x01:
{
/** 0011 0001 0bit 0001 btclr %1, $%a0 */
-#line 410 "rl78-decode.opc"
+#line 412 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -860,7 +862,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("btclr %1, $%a0");
-#line 410 "rl78-decode.opc"
+#line 412 "rl78-decode.opc"
ID(branch_cond_clear); DC(pc+IMMS(1)+3); SR(A); SB(bit); COND(T);
}
@@ -868,7 +870,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x02:
{
/** 0011 0001 0bit 0010 bt %s1, $%a0 */
-#line 402 "rl78-decode.opc"
+#line 404 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -878,7 +880,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bt %s1, $%a0");
-#line 402 "rl78-decode.opc"
+#line 404 "rl78-decode.opc"
ID(branch_cond); SM(None, SADDR); SB(bit); DC(pc+IMMS(1)+4); COND(T);
/*----------------------------------------------------------------------*/
@@ -888,7 +890,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x03:
{
/** 0011 0001 0bit 0011 bt %1, $%a0 */
-#line 396 "rl78-decode.opc"
+#line 398 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -898,7 +900,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bt %1, $%a0");
-#line 396 "rl78-decode.opc"
+#line 398 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+3); SR(A); SB(bit); COND(T);
}
@@ -906,7 +908,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x04:
{
/** 0011 0001 0bit 0100 bf %s1, $%a0 */
-#line 363 "rl78-decode.opc"
+#line 365 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -916,7 +918,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bf %s1, $%a0");
-#line 363 "rl78-decode.opc"
+#line 365 "rl78-decode.opc"
ID(branch_cond); SM(None, SADDR); SB(bit); DC(pc+IMMS(1)+4); COND(F);
/*----------------------------------------------------------------------*/
@@ -926,7 +928,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x05:
{
/** 0011 0001 0bit 0101 bf %1, $%a0 */
-#line 357 "rl78-decode.opc"
+#line 359 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -936,7 +938,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bf %1, $%a0");
-#line 357 "rl78-decode.opc"
+#line 359 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+3); SR(A); SB(bit); COND(F);
}
@@ -944,7 +946,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x07:
{
/** 0011 0001 0cnt 0111 shl %0, %1 */
-#line 1075 "rl78-decode.opc"
+#line 1077 "rl78-decode.opc"
int cnt AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -954,7 +956,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" cnt = 0x%x\n", cnt);
}
SYNTAX("shl %0, %1");
-#line 1075 "rl78-decode.opc"
+#line 1077 "rl78-decode.opc"
ID(shl); DR(C); SC(cnt);
}
@@ -962,7 +964,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x08:
{
/** 0011 0001 0cnt 1000 shl %0, %1 */
-#line 1072 "rl78-decode.opc"
+#line 1074 "rl78-decode.opc"
int cnt AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -972,7 +974,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" cnt = 0x%x\n", cnt);
}
SYNTAX("shl %0, %1");
-#line 1072 "rl78-decode.opc"
+#line 1074 "rl78-decode.opc"
ID(shl); DR(B); SC(cnt);
}
@@ -980,7 +982,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x09:
{
/** 0011 0001 0cnt 1001 shl %0, %1 */
-#line 1069 "rl78-decode.opc"
+#line 1071 "rl78-decode.opc"
int cnt AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -990,7 +992,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" cnt = 0x%x\n", cnt);
}
SYNTAX("shl %0, %1");
-#line 1069 "rl78-decode.opc"
+#line 1071 "rl78-decode.opc"
ID(shl); DR(A); SC(cnt);
}
@@ -998,7 +1000,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x0a:
{
/** 0011 0001 0cnt 1010 shr %0, %1 */
-#line 1086 "rl78-decode.opc"
+#line 1088 "rl78-decode.opc"
int cnt AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -1008,7 +1010,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" cnt = 0x%x\n", cnt);
}
SYNTAX("shr %0, %1");
-#line 1086 "rl78-decode.opc"
+#line 1088 "rl78-decode.opc"
ID(shr); DR(A); SC(cnt);
}
@@ -1016,7 +1018,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x0b:
{
/** 0011 0001 0cnt 1011 sar %0, %1 */
-#line 1033 "rl78-decode.opc"
+#line 1035 "rl78-decode.opc"
int cnt AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -1026,7 +1028,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" cnt = 0x%x\n", cnt);
}
SYNTAX("sar %0, %1");
-#line 1033 "rl78-decode.opc"
+#line 1035 "rl78-decode.opc"
ID(sar); DR(A); SC(cnt);
}
@@ -1035,7 +1037,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x8c:
{
/** 0011 0001 wcnt 1100 shlw %0, %1 */
-#line 1081 "rl78-decode.opc"
+#line 1083 "rl78-decode.opc"
int wcnt AU = (op[1] >> 4) & 0x0f;
if (trace)
{
@@ -1045,7 +1047,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" wcnt = 0x%x\n", wcnt);
}
SYNTAX("shlw %0, %1");
-#line 1081 "rl78-decode.opc"
+#line 1083 "rl78-decode.opc"
ID(shl); W(); DR(BC); SC(wcnt);
/*----------------------------------------------------------------------*/
@@ -1056,7 +1058,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x8d:
{
/** 0011 0001 wcnt 1101 shlw %0, %1 */
-#line 1078 "rl78-decode.opc"
+#line 1080 "rl78-decode.opc"
int wcnt AU = (op[1] >> 4) & 0x0f;
if (trace)
{
@@ -1066,7 +1068,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" wcnt = 0x%x\n", wcnt);
}
SYNTAX("shlw %0, %1");
-#line 1078 "rl78-decode.opc"
+#line 1080 "rl78-decode.opc"
ID(shl); W(); DR(AX); SC(wcnt);
}
@@ -1075,7 +1077,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x8e:
{
/** 0011 0001 wcnt 1110 shrw %0, %1 */
-#line 1089 "rl78-decode.opc"
+#line 1091 "rl78-decode.opc"
int wcnt AU = (op[1] >> 4) & 0x0f;
if (trace)
{
@@ -1085,7 +1087,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" wcnt = 0x%x\n", wcnt);
}
SYNTAX("shrw %0, %1");
-#line 1089 "rl78-decode.opc"
+#line 1091 "rl78-decode.opc"
ID(shr); W(); DR(AX); SC(wcnt);
/*----------------------------------------------------------------------*/
@@ -1096,7 +1098,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x8f:
{
/** 0011 0001 wcnt 1111 sarw %0, %1 */
-#line 1036 "rl78-decode.opc"
+#line 1038 "rl78-decode.opc"
int wcnt AU = (op[1] >> 4) & 0x0f;
if (trace)
{
@@ -1106,7 +1108,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" wcnt = 0x%x\n", wcnt);
}
SYNTAX("sarw %0, %1");
-#line 1036 "rl78-decode.opc"
+#line 1038 "rl78-decode.opc"
ID(sar); W(); DR(AX); SC(wcnt);
/*----------------------------------------------------------------------*/
@@ -1116,7 +1118,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x80:
{
/** 0011 0001 1bit 0000 btclr %s1, $%a0 */
-#line 413 "rl78-decode.opc"
+#line 415 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -1126,7 +1128,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("btclr %s1, $%a0");
-#line 413 "rl78-decode.opc"
+#line 415 "rl78-decode.opc"
ID(branch_cond_clear); SM(None, SFR); SB(bit); DC(pc+IMMS(1)+4); COND(T);
}
@@ -1134,7 +1136,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x81:
{
/** 0011 0001 1bit 0001 btclr %e1, $%a0 */
-#line 407 "rl78-decode.opc"
+#line 409 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -1144,7 +1146,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("btclr %e1, $%a0");
-#line 407 "rl78-decode.opc"
+#line 409 "rl78-decode.opc"
ID(branch_cond_clear); DC(pc+IMMS(1)+3); SM(HL,0); SB(bit); COND(T);
}
@@ -1152,7 +1154,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x82:
{
/** 0011 0001 1bit 0010 bt %s1, $%a0 */
-#line 399 "rl78-decode.opc"
+#line 401 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -1162,7 +1164,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bt %s1, $%a0");
-#line 399 "rl78-decode.opc"
+#line 401 "rl78-decode.opc"
ID(branch_cond); SM(None, SFR); SB(bit); DC(pc+IMMS(1)+4); COND(T);
}
@@ -1170,7 +1172,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x83:
{
/** 0011 0001 1bit 0011 bt %e1, $%a0 */
-#line 393 "rl78-decode.opc"
+#line 395 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -1180,7 +1182,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bt %e1, $%a0");
-#line 393 "rl78-decode.opc"
+#line 395 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+3); SM(HL,0); SB(bit); COND(T);
}
@@ -1188,7 +1190,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x84:
{
/** 0011 0001 1bit 0100 bf %s1, $%a0 */
-#line 360 "rl78-decode.opc"
+#line 362 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -1198,7 +1200,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bf %s1, $%a0");
-#line 360 "rl78-decode.opc"
+#line 362 "rl78-decode.opc"
ID(branch_cond); SM(None, SFR); SB(bit); DC(pc+IMMS(1)+4); COND(F);
}
@@ -1206,7 +1208,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x85:
{
/** 0011 0001 1bit 0101 bf %e1, $%a0 */
-#line 354 "rl78-decode.opc"
+#line 356 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -1216,7 +1218,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bf %e1, $%a0");
-#line 354 "rl78-decode.opc"
+#line 356 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+3); SM(HL,0); SB(bit); COND(F);
}
@@ -1229,7 +1231,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x37:
{
/** 0011 0ra1 xchw %0, %1 */
-#line 1239 "rl78-decode.opc"
+#line 1241 "rl78-decode.opc"
int ra AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -1239,7 +1241,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" ra = 0x%x\n", ra);
}
SYNTAX("xchw %0, %1");
-#line 1239 "rl78-decode.opc"
+#line 1241 "rl78-decode.opc"
ID(xch); W(); DR(AX); SRW(ra);
/*----------------------------------------------------------------------*/
@@ -1256,7 +1258,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e0, #%1");
-#line 738 "rl78-decode.opc"
+#line 740 "rl78-decode.opc"
ID(mov); DM(C, IMMU(2)); SC(IMMU(1));
}
@@ -1271,7 +1273,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e0, #%1");
-#line 732 "rl78-decode.opc"
+#line 734 "rl78-decode.opc"
ID(mov); DM(BC, IMMU(2)); SC(IMMU(1));
}
@@ -1286,7 +1288,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subc %0, #%1");
-#line 1178 "rl78-decode.opc"
+#line 1180 "rl78-decode.opc"
ID(subc); DM(None, SADDR); SC(IMMU(1)); Fzac;
/*----------------------------------------------------------------------*/
@@ -1303,7 +1305,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subc %0, %1");
-#line 1175 "rl78-decode.opc"
+#line 1177 "rl78-decode.opc"
ID(subc); DR(A); SM(None, SADDR); Fzac;
}
@@ -1318,7 +1320,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subc %0, #%1");
-#line 1166 "rl78-decode.opc"
+#line 1168 "rl78-decode.opc"
ID(subc); DR(A); SC(IMMU(1)); Fzac;
}
@@ -1333,7 +1335,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subc %0, %e1");
-#line 1154 "rl78-decode.opc"
+#line 1156 "rl78-decode.opc"
ID(subc); DR(A); SM(HL, 0); Fzac;
}
@@ -1348,7 +1350,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subc %0, %ea1");
-#line 1163 "rl78-decode.opc"
+#line 1165 "rl78-decode.opc"
ID(subc); DR(A); SM(HL, IMMU(1)); Fzac;
}
@@ -1363,7 +1365,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("subc %0, %e!1");
-#line 1151 "rl78-decode.opc"
+#line 1153 "rl78-decode.opc"
ID(subc); DR(A); SM(None, IMMU(2)); Fzac;
}
@@ -1378,7 +1380,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp %e!0, #%1");
-#line 480 "rl78-decode.opc"
+#line 482 "rl78-decode.opc"
ID(cmp); DM(None, IMMU(2)); SC(IMMU(1)); Fzac;
}
@@ -1393,7 +1395,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, #%1");
-#line 717 "rl78-decode.opc"
+#line 719 "rl78-decode.opc"
ID(mov); DR(ES); SC(IMMU(1));
}
@@ -1408,7 +1410,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmpw %0, %e!1");
-#line 531 "rl78-decode.opc"
+#line 533 "rl78-decode.opc"
ID(cmp); W(); DR(AX); SM(None, IMMU(2)); Fzac;
}
@@ -1418,7 +1420,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x47:
{
/** 0100 0ra1 cmpw %0, %1 */
-#line 540 "rl78-decode.opc"
+#line 542 "rl78-decode.opc"
int ra AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -1428,7 +1430,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" ra = 0x%x\n", ra);
}
SYNTAX("cmpw %0, %1");
-#line 540 "rl78-decode.opc"
+#line 542 "rl78-decode.opc"
ID(cmp); W(); DR(AX); SRW(ra); Fzac;
}
@@ -1443,7 +1445,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmpw %0, #%1");
-#line 537 "rl78-decode.opc"
+#line 539 "rl78-decode.opc"
ID(cmp); W(); DR(AX); SC(IMMU(2)); Fzac;
}
@@ -1458,7 +1460,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmpw %0, %1");
-#line 543 "rl78-decode.opc"
+#line 545 "rl78-decode.opc"
ID(cmp); W(); DR(AX); SM(None, SADDR); Fzac;
/*----------------------------------------------------------------------*/
@@ -1475,7 +1477,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e0, %1");
-#line 735 "rl78-decode.opc"
+#line 737 "rl78-decode.opc"
ID(mov); DM(BC, IMMU(2)); SR(A);
}
@@ -1490,7 +1492,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e1");
-#line 681 "rl78-decode.opc"
+#line 683 "rl78-decode.opc"
ID(mov); DR(A); SM(BC, IMMU(2));
}
@@ -1505,7 +1507,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp %0, #%1");
-#line 483 "rl78-decode.opc"
+#line 485 "rl78-decode.opc"
ID(cmp); DM(None, SADDR); SC(IMMU(1)); Fzac;
}
@@ -1520,7 +1522,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp %0, %1");
-#line 510 "rl78-decode.opc"
+#line 512 "rl78-decode.opc"
ID(cmp); DR(A); SM(None, SADDR); Fzac;
/*----------------------------------------------------------------------*/
@@ -1537,7 +1539,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp %0, #%1");
-#line 501 "rl78-decode.opc"
+#line 503 "rl78-decode.opc"
ID(cmp); DR(A); SC(IMMU(1)); Fzac;
}
@@ -1552,7 +1554,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp %0, %e1");
-#line 489 "rl78-decode.opc"
+#line 491 "rl78-decode.opc"
ID(cmp); DR(A); SM(HL, 0); Fzac;
}
@@ -1567,7 +1569,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp %0, %ea1");
-#line 498 "rl78-decode.opc"
+#line 500 "rl78-decode.opc"
ID(cmp); DR(A); SM(HL, IMMU(1)); Fzac;
}
@@ -1582,7 +1584,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp %0, %e!1");
-#line 486 "rl78-decode.opc"
+#line 488 "rl78-decode.opc"
ID(cmp); DR(A); SM(None, IMMU(2)); Fzac;
}
@@ -1597,7 +1599,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x57:
{
/** 0101 0reg mov %0, #%1 */
-#line 669 "rl78-decode.opc"
+#line 671 "rl78-decode.opc"
int reg AU = op[0] & 0x07;
if (trace)
{
@@ -1607,7 +1609,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("mov %0, #%1");
-#line 669 "rl78-decode.opc"
+#line 671 "rl78-decode.opc"
ID(mov); DRB(reg); SC(IMMU(1));
}
@@ -1622,7 +1624,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %e0, %1");
-#line 871 "rl78-decode.opc"
+#line 873 "rl78-decode.opc"
ID(mov); W(); DM(B, IMMU(2)); SR(AX);
}
@@ -1637,7 +1639,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %e1");
-#line 862 "rl78-decode.opc"
+#line 864 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(B, IMMU(2));
}
@@ -1652,7 +1654,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("and %0, #%1");
-#line 312 "rl78-decode.opc"
+#line 314 "rl78-decode.opc"
ID(and); DM(None, SADDR); SC(IMMU(1)); Fz;
/*----------------------------------------------------------------------*/
@@ -1669,7 +1671,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("and %0, %1");
-#line 309 "rl78-decode.opc"
+#line 311 "rl78-decode.opc"
ID(and); DR(A); SM(None, SADDR); Fz;
}
@@ -1684,7 +1686,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("and %0, #%1");
-#line 300 "rl78-decode.opc"
+#line 302 "rl78-decode.opc"
ID(and); DR(A); SC(IMMU(1)); Fz;
}
@@ -1699,7 +1701,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("and %0, %e1");
-#line 288 "rl78-decode.opc"
+#line 290 "rl78-decode.opc"
ID(and); DR(A); SM(HL, 0); Fz;
}
@@ -1714,7 +1716,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("and %0, %ea1");
-#line 294 "rl78-decode.opc"
+#line 296 "rl78-decode.opc"
ID(and); DR(A); SM(HL, IMMU(1)); Fz;
}
@@ -1729,7 +1731,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("and %0, %e!1");
-#line 285 "rl78-decode.opc"
+#line 287 "rl78-decode.opc"
ID(and); DR(A); SM(None, IMMU(2)); Fz;
}
@@ -1743,7 +1745,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x67:
{
/** 0110 0rba mov %0, %1 */
-#line 672 "rl78-decode.opc"
+#line 674 "rl78-decode.opc"
int rba AU = op[0] & 0x07;
if (trace)
{
@@ -1753,7 +1755,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("mov %0, %1");
-#line 672 "rl78-decode.opc"
+#line 674 "rl78-decode.opc"
ID(mov); DR(A); SRB(rba);
}
@@ -1772,7 +1774,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x07:
{
/** 0110 0001 0000 0reg add %0, %1 */
-#line 225 "rl78-decode.opc"
+#line 227 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -1782,7 +1784,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("add %0, %1");
-#line 225 "rl78-decode.opc"
+#line 227 "rl78-decode.opc"
ID(add); DRB(reg); SR(A); Fzac;
}
@@ -1796,7 +1798,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x0f:
{
/** 0110 0001 0000 1rba add %0, %1 */
-#line 219 "rl78-decode.opc"
+#line 221 "rl78-decode.opc"
int rba AU = op[1] & 0x07;
if (trace)
{
@@ -1806,7 +1808,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("add %0, %1");
-#line 219 "rl78-decode.opc"
+#line 221 "rl78-decode.opc"
ID(add); DR(A); SRB(rba); Fzac;
}
@@ -1821,7 +1823,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("addw %0, %ea1");
-#line 268 "rl78-decode.opc"
+#line 270 "rl78-decode.opc"
ID(add); W(); DR(AX); SM(HL, IMMU(1)); Fzac;
}
@@ -1836,7 +1838,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x17:
{
/** 0110 0001 0001 0reg addc %0, %1 */
-#line 254 "rl78-decode.opc"
+#line 256 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -1846,7 +1848,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("addc %0, %1");
-#line 254 "rl78-decode.opc"
+#line 256 "rl78-decode.opc"
ID(addc); DRB(reg); SR(A); Fzac;
}
@@ -1860,7 +1862,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x1f:
{
/** 0110 0001 0001 1rba addc %0, %1 */
-#line 251 "rl78-decode.opc"
+#line 253 "rl78-decode.opc"
int rba AU = op[1] & 0x07;
if (trace)
{
@@ -1870,7 +1872,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("addc %0, %1");
-#line 251 "rl78-decode.opc"
+#line 253 "rl78-decode.opc"
ID(addc); DR(A); SRB(rba); Fzac;
}
@@ -1885,7 +1887,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x27:
{
/** 0110 0001 0010 0reg sub %0, %1 */
-#line 1143 "rl78-decode.opc"
+#line 1145 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -1895,7 +1897,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("sub %0, %1");
-#line 1143 "rl78-decode.opc"
+#line 1145 "rl78-decode.opc"
ID(sub); DRB(reg); SR(A); Fzac;
}
@@ -1909,7 +1911,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x2f:
{
/** 0110 0001 0010 1rba sub %0, %1 */
-#line 1137 "rl78-decode.opc"
+#line 1139 "rl78-decode.opc"
int rba AU = op[1] & 0x07;
if (trace)
{
@@ -1919,7 +1921,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("sub %0, %1");
-#line 1137 "rl78-decode.opc"
+#line 1139 "rl78-decode.opc"
ID(sub); DR(A); SRB(rba); Fzac;
}
@@ -1934,7 +1936,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("subw %0, %ea1");
-#line 1186 "rl78-decode.opc"
+#line 1188 "rl78-decode.opc"
ID(sub); W(); DR(AX); SM(HL, IMMU(1)); Fzac;
}
@@ -1949,7 +1951,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x37:
{
/** 0110 0001 0011 0reg subc %0, %1 */
-#line 1172 "rl78-decode.opc"
+#line 1174 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -1959,7 +1961,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("subc %0, %1");
-#line 1172 "rl78-decode.opc"
+#line 1174 "rl78-decode.opc"
ID(subc); DRB(reg); SR(A); Fzac;
}
@@ -1973,7 +1975,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x3f:
{
/** 0110 0001 0011 1rba subc %0, %1 */
-#line 1169 "rl78-decode.opc"
+#line 1171 "rl78-decode.opc"
int rba AU = op[1] & 0x07;
if (trace)
{
@@ -1983,7 +1985,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("subc %0, %1");
-#line 1169 "rl78-decode.opc"
+#line 1171 "rl78-decode.opc"
ID(subc); DR(A); SRB(rba); Fzac;
}
@@ -1998,7 +2000,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x47:
{
/** 0110 0001 0100 0reg cmp %0, %1 */
-#line 507 "rl78-decode.opc"
+#line 509 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -2008,7 +2010,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("cmp %0, %1");
-#line 507 "rl78-decode.opc"
+#line 509 "rl78-decode.opc"
ID(cmp); DRB(reg); SR(A); Fzac;
}
@@ -2022,7 +2024,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x4f:
{
/** 0110 0001 0100 1rba cmp %0, %1 */
-#line 504 "rl78-decode.opc"
+#line 506 "rl78-decode.opc"
int rba AU = op[1] & 0x07;
if (trace)
{
@@ -2032,7 +2034,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("cmp %0, %1");
-#line 504 "rl78-decode.opc"
+#line 506 "rl78-decode.opc"
ID(cmp); DR(A); SRB(rba); Fzac;
}
@@ -2047,7 +2049,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("cmpw %0, %ea1");
-#line 534 "rl78-decode.opc"
+#line 536 "rl78-decode.opc"
ID(cmp); W(); DR(AX); SM(HL, IMMU(1)); Fzac;
}
@@ -2062,7 +2064,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x57:
{
/** 0110 0001 0101 0reg and %0, %1 */
-#line 306 "rl78-decode.opc"
+#line 308 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -2072,7 +2074,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("and %0, %1");
-#line 306 "rl78-decode.opc"
+#line 308 "rl78-decode.opc"
ID(and); DRB(reg); SR(A); Fz;
}
@@ -2086,7 +2088,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x5f:
{
/** 0110 0001 0101 1rba and %0, %1 */
-#line 303 "rl78-decode.opc"
+#line 305 "rl78-decode.opc"
int rba AU = op[1] & 0x07;
if (trace)
{
@@ -2096,7 +2098,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("and %0, %1");
-#line 303 "rl78-decode.opc"
+#line 305 "rl78-decode.opc"
ID(and); DR(A); SRB(rba); Fz;
}
@@ -2111,7 +2113,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("inc %ea0");
-#line 584 "rl78-decode.opc"
+#line 586 "rl78-decode.opc"
ID(add); DM(HL, IMMU(1)); SC(1); Fza;
}
@@ -2126,7 +2128,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x67:
{
/** 0110 0001 0110 0reg or %0, %1 */
-#line 961 "rl78-decode.opc"
+#line 963 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -2136,7 +2138,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("or %0, %1");
-#line 961 "rl78-decode.opc"
+#line 963 "rl78-decode.opc"
ID(or); DRB(reg); SR(A); Fz;
}
@@ -2150,7 +2152,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x6f:
{
/** 0110 0001 0110 1rba or %0, %1 */
-#line 958 "rl78-decode.opc"
+#line 960 "rl78-decode.opc"
int rba AU = op[1] & 0x07;
if (trace)
{
@@ -2160,7 +2162,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("or %0, %1");
-#line 958 "rl78-decode.opc"
+#line 960 "rl78-decode.opc"
ID(or); DR(A); SRB(rba); Fz;
}
@@ -2175,7 +2177,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("dec %ea0");
-#line 551 "rl78-decode.opc"
+#line 553 "rl78-decode.opc"
ID(sub); DM(HL, IMMU(1)); SC(1); Fza;
}
@@ -2190,7 +2192,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x77:
{
/** 0110 0001 0111 0reg xor %0, %1 */
-#line 1265 "rl78-decode.opc"
+#line 1267 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -2200,7 +2202,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("xor %0, %1");
-#line 1265 "rl78-decode.opc"
+#line 1267 "rl78-decode.opc"
ID(xor); DRB(reg); SR(A); Fz;
}
@@ -2214,7 +2216,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x7f:
{
/** 0110 0001 0111 1rba xor %0, %1 */
-#line 1262 "rl78-decode.opc"
+#line 1264 "rl78-decode.opc"
int rba AU = op[1] & 0x07;
if (trace)
{
@@ -2224,7 +2226,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("xor %0, %1");
-#line 1262 "rl78-decode.opc"
+#line 1264 "rl78-decode.opc"
ID(xor); DR(A); SRB(rba); Fz;
}
@@ -2239,7 +2241,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("incw %ea0");
-#line 598 "rl78-decode.opc"
+#line 600 "rl78-decode.opc"
ID(add); W(); DM(HL, IMMU(1)); SC(1);
}
@@ -2255,7 +2257,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("add %0, %e1");
-#line 207 "rl78-decode.opc"
+#line 209 "rl78-decode.opc"
ID(add); DR(A); SM2(HL, B, 0); Fzac;
}
@@ -2270,7 +2272,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("add %0, %e1");
-#line 213 "rl78-decode.opc"
+#line 215 "rl78-decode.opc"
ID(add); DR(A); SM2(HL, C, 0); Fzac;
}
@@ -2309,9 +2311,9 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf7:
{
/** 0110 0001 1nnn 01mm callt [%x0] */
-#line 433 "rl78-decode.opc"
+#line 435 "rl78-decode.opc"
int nnn AU = (op[1] >> 4) & 0x07;
-#line 433 "rl78-decode.opc"
+#line 435 "rl78-decode.opc"
int mm AU = op[1] & 0x03;
if (trace)
{
@@ -2322,7 +2324,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" mm = 0x%x\n", mm);
}
SYNTAX("callt [%x0]");
-#line 433 "rl78-decode.opc"
+#line 435 "rl78-decode.opc"
ID(call); DM(None, 0x80 + mm*16 + nnn*2);
/*----------------------------------------------------------------------*/
@@ -2338,7 +2340,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x8f:
{
/** 0110 0001 1000 1reg xch %0, %1 */
-#line 1224 "rl78-decode.opc"
+#line 1226 "rl78-decode.opc"
int reg AU = op[1] & 0x07;
if (trace)
{
@@ -2348,7 +2350,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("xch %0, %1");
-#line 1224 "rl78-decode.opc"
+#line 1226 "rl78-decode.opc"
/* Note: DECW uses reg == X, so this must follow DECW */
ID(xch); DR(A); SRB(reg);
@@ -2364,7 +2366,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("decw %ea0");
-#line 565 "rl78-decode.opc"
+#line 567 "rl78-decode.opc"
ID(sub); W(); DM(HL, IMMU(1)); SC(1);
}
@@ -2379,7 +2381,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("addc %0, %e1");
-#line 239 "rl78-decode.opc"
+#line 241 "rl78-decode.opc"
ID(addc); DR(A); SM2(HL, B, 0); Fzac;
}
@@ -2394,7 +2396,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("addc %0, %e1");
-#line 242 "rl78-decode.opc"
+#line 244 "rl78-decode.opc"
ID(addc); DR(A); SM2(HL, C, 0); Fzac;
}
@@ -2410,7 +2412,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("sub %0, %e1");
-#line 1125 "rl78-decode.opc"
+#line 1127 "rl78-decode.opc"
ID(sub); DR(A); SM2(HL, B, 0); Fzac;
}
@@ -2425,7 +2427,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("sub %0, %e1");
-#line 1131 "rl78-decode.opc"
+#line 1133 "rl78-decode.opc"
ID(sub); DR(A); SM2(HL, C, 0); Fzac;
}
@@ -2440,7 +2442,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %1");
-#line 1228 "rl78-decode.opc"
+#line 1230 "rl78-decode.opc"
ID(xch); DR(A); SM(None, SADDR);
}
@@ -2455,7 +2457,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %e1");
-#line 1221 "rl78-decode.opc"
+#line 1223 "rl78-decode.opc"
ID(xch); DR(A); SM2(HL, C, 0);
}
@@ -2470,7 +2472,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %e!1");
-#line 1203 "rl78-decode.opc"
+#line 1205 "rl78-decode.opc"
ID(xch); DR(A); SM(None, IMMU(2));
}
@@ -2485,7 +2487,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %s1");
-#line 1231 "rl78-decode.opc"
+#line 1233 "rl78-decode.opc"
ID(xch); DR(A); SM(None, SFR);
}
@@ -2500,7 +2502,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %e1");
-#line 1212 "rl78-decode.opc"
+#line 1214 "rl78-decode.opc"
ID(xch); DR(A); SM(HL, 0);
}
@@ -2515,7 +2517,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %ea1");
-#line 1218 "rl78-decode.opc"
+#line 1220 "rl78-decode.opc"
ID(xch); DR(A); SM(HL, IMMU(1));
}
@@ -2530,7 +2532,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %e1");
-#line 1206 "rl78-decode.opc"
+#line 1208 "rl78-decode.opc"
ID(xch); DR(A); SM(DE, 0);
}
@@ -2545,7 +2547,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %ea1");
-#line 1209 "rl78-decode.opc"
+#line 1211 "rl78-decode.opc"
ID(xch); DR(A); SM(DE, IMMU(1));
}
@@ -2560,7 +2562,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("subc %0, %e1");
-#line 1157 "rl78-decode.opc"
+#line 1159 "rl78-decode.opc"
ID(subc); DR(A); SM2(HL, B, 0); Fzac;
}
@@ -2575,7 +2577,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("subc %0, %e1");
-#line 1160 "rl78-decode.opc"
+#line 1162 "rl78-decode.opc"
ID(subc); DR(A); SM2(HL, C, 0); Fzac;
}
@@ -2590,7 +2592,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("mov %0, %1");
-#line 723 "rl78-decode.opc"
+#line 725 "rl78-decode.opc"
ID(mov); DR(ES); SM(None, SADDR);
}
@@ -2605,7 +2607,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xch %0, %e1");
-#line 1215 "rl78-decode.opc"
+#line 1217 "rl78-decode.opc"
ID(xch); DR(A); SM2(HL, B, 0);
}
@@ -2620,7 +2622,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("cmp %0, %e1");
-#line 492 "rl78-decode.opc"
+#line 494 "rl78-decode.opc"
ID(cmp); DR(A); SM2(HL, B, 0); Fzac;
}
@@ -2635,7 +2637,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("cmp %0, %e1");
-#line 495 "rl78-decode.opc"
+#line 497 "rl78-decode.opc"
ID(cmp); DR(A); SM2(HL, C, 0); Fzac;
}
@@ -2650,7 +2652,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("bh $%a0");
-#line 340 "rl78-decode.opc"
+#line 342 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+3); SR(None); COND(H);
}
@@ -2665,7 +2667,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("sk%c1");
-#line 1094 "rl78-decode.opc"
+#line 1096 "rl78-decode.opc"
ID(skip); COND(C);
}
@@ -2680,7 +2682,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("mov %0, %e1");
-#line 660 "rl78-decode.opc"
+#line 662 "rl78-decode.opc"
ID(mov); DR(A); SM2(HL, B, 0);
}
@@ -2691,7 +2693,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfa:
{
/** 0110 0001 11rg 1010 call %0 */
-#line 430 "rl78-decode.opc"
+#line 432 "rl78-decode.opc"
int rg AU = (op[1] >> 4) & 0x03;
if (trace)
{
@@ -2701,7 +2703,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("call %0");
-#line 430 "rl78-decode.opc"
+#line 432 "rl78-decode.opc"
ID(call); DRW(rg);
}
@@ -2716,7 +2718,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("br ax");
-#line 380 "rl78-decode.opc"
+#line 382 "rl78-decode.opc"
ID(branch); DR(AX);
/*----------------------------------------------------------------------*/
@@ -2733,7 +2735,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("brk");
-#line 388 "rl78-decode.opc"
+#line 390 "rl78-decode.opc"
ID(break);
/*----------------------------------------------------------------------*/
@@ -2750,7 +2752,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("pop %s0");
-#line 989 "rl78-decode.opc"
+#line 991 "rl78-decode.opc"
ID(mov); W(); DR(PSW); SPOP();
/*----------------------------------------------------------------------*/
@@ -2767,7 +2769,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("movs %ea0, %1");
-#line 811 "rl78-decode.opc"
+#line 813 "rl78-decode.opc"
ID(mov); DM(HL, IMMU(1)); SR(X); Fzc;
/*----------------------------------------------------------------------*/
@@ -2780,7 +2782,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xff:
{
/** 0110 0001 11rb 1111 sel rb%1 */
-#line 1041 "rl78-decode.opc"
+#line 1043 "rl78-decode.opc"
int rb AU = (op[1] >> 4) & 0x03;
if (trace)
{
@@ -2790,7 +2792,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rb = 0x%x\n", rb);
}
SYNTAX("sel rb%1");
-#line 1041 "rl78-decode.opc"
+#line 1043 "rl78-decode.opc"
ID(sel); SC(rb);
/*----------------------------------------------------------------------*/
@@ -2807,7 +2809,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("and %0, %e1");
-#line 291 "rl78-decode.opc"
+#line 293 "rl78-decode.opc"
ID(and); DR(A); SM2(HL, B, 0); Fz;
}
@@ -2822,7 +2824,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("and %0, %e1");
-#line 297 "rl78-decode.opc"
+#line 299 "rl78-decode.opc"
ID(and); DR(A); SM2(HL, C, 0); Fz;
}
@@ -2837,7 +2839,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("bnh $%a0");
-#line 343 "rl78-decode.opc"
+#line 345 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+3); SR(None); COND(NH);
}
@@ -2852,7 +2854,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("sk%c1");
-#line 1100 "rl78-decode.opc"
+#line 1102 "rl78-decode.opc"
ID(skip); COND(NC);
}
@@ -2867,7 +2869,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("mov %e0, %1");
-#line 627 "rl78-decode.opc"
+#line 629 "rl78-decode.opc"
ID(mov); DM2(HL, B, 0); SR(A);
}
@@ -2882,7 +2884,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("ror %0, %1");
-#line 1022 "rl78-decode.opc"
+#line 1024 "rl78-decode.opc"
ID(ror); DR(A); SC(1);
}
@@ -2897,7 +2899,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("rolc %0, %1");
-#line 1016 "rl78-decode.opc"
+#line 1018 "rl78-decode.opc"
ID(rolc); DR(A); SC(1);
}
@@ -2912,7 +2914,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("push %s1");
-#line 997 "rl78-decode.opc"
+#line 999 "rl78-decode.opc"
ID(mov); W(); DPUSH(); SR(PSW);
/*----------------------------------------------------------------------*/
@@ -2929,7 +2931,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("cmps %0, %ea1");
-#line 526 "rl78-decode.opc"
+#line 528 "rl78-decode.opc"
ID(cmp); DR(X); SM(HL, IMMU(1)); Fzac;
/*----------------------------------------------------------------------*/
@@ -2946,7 +2948,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("or %0, %e1");
-#line 946 "rl78-decode.opc"
+#line 948 "rl78-decode.opc"
ID(or); DR(A); SM2(HL, B, 0); Fz;
}
@@ -2961,7 +2963,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("or %0, %e1");
-#line 952 "rl78-decode.opc"
+#line 954 "rl78-decode.opc"
ID(or); DR(A); SM2(HL, C, 0); Fz;
}
@@ -2976,7 +2978,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("sk%c1");
-#line 1097 "rl78-decode.opc"
+#line 1099 "rl78-decode.opc"
ID(skip); COND(H);
}
@@ -2991,7 +2993,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("sk%c1");
-#line 1109 "rl78-decode.opc"
+#line 1111 "rl78-decode.opc"
ID(skip); COND(Z);
/*----------------------------------------------------------------------*/
@@ -3008,7 +3010,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("mov %0, %e1");
-#line 663 "rl78-decode.opc"
+#line 665 "rl78-decode.opc"
ID(mov); DR(A); SM2(HL, C, 0);
}
@@ -3023,7 +3025,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("rol %0, %1");
-#line 1013 "rl78-decode.opc"
+#line 1015 "rl78-decode.opc"
ID(rol); DR(A); SC(1);
}
@@ -3038,7 +3040,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("retb");
-#line 1008 "rl78-decode.opc"
+#line 1010 "rl78-decode.opc"
ID(reti);
/*----------------------------------------------------------------------*/
@@ -3055,7 +3057,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("halt");
-#line 576 "rl78-decode.opc"
+#line 578 "rl78-decode.opc"
ID(halt);
/*----------------------------------------------------------------------*/
@@ -3066,7 +3068,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfe:
{
/** 0110 0001 111r 1110 rolwc %0, %1 */
-#line 1019 "rl78-decode.opc"
+#line 1021 "rl78-decode.opc"
int r AU = (op[1] >> 4) & 0x01;
if (trace)
{
@@ -3076,7 +3078,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" r = 0x%x\n", r);
}
SYNTAX("rolwc %0, %1");
-#line 1019 "rl78-decode.opc"
+#line 1021 "rl78-decode.opc"
ID(rolc); W(); DRW(r); SC(1);
}
@@ -3091,7 +3093,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xor %0, %e1");
-#line 1250 "rl78-decode.opc"
+#line 1252 "rl78-decode.opc"
ID(xor); DR(A); SM2(HL, B, 0); Fz;
}
@@ -3106,7 +3108,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("xor %0, %e1");
-#line 1256 "rl78-decode.opc"
+#line 1258 "rl78-decode.opc"
ID(xor); DR(A); SM2(HL, C, 0); Fz;
}
@@ -3121,7 +3123,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("sk%c1");
-#line 1103 "rl78-decode.opc"
+#line 1105 "rl78-decode.opc"
ID(skip); COND(NH);
}
@@ -3136,7 +3138,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("sk%c1");
-#line 1106 "rl78-decode.opc"
+#line 1108 "rl78-decode.opc"
ID(skip); COND(NZ);
}
@@ -3151,7 +3153,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("mov %e0, %1");
-#line 636 "rl78-decode.opc"
+#line 638 "rl78-decode.opc"
ID(mov); DM2(HL, C, 0); SR(A);
}
@@ -3166,7 +3168,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("rorc %0, %1");
-#line 1025 "rl78-decode.opc"
+#line 1027 "rl78-decode.opc"
ID(rorc); DR(A); SC(1);
/*----------------------------------------------------------------------*/
@@ -3186,7 +3188,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("reti");
-#line 1005 "rl78-decode.opc"
+#line 1007 "rl78-decode.opc"
ID(reti);
}
@@ -3201,7 +3203,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("stop");
-#line 1114 "rl78-decode.opc"
+#line 1116 "rl78-decode.opc"
ID(stop);
/*----------------------------------------------------------------------*/
@@ -3221,7 +3223,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %e0, %1");
-#line 874 "rl78-decode.opc"
+#line 876 "rl78-decode.opc"
ID(mov); W(); DM(C, IMMU(2)); SR(AX);
}
@@ -3236,7 +3238,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %e1");
-#line 865 "rl78-decode.opc"
+#line 867 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(C, IMMU(2));
}
@@ -3251,7 +3253,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("or %0, #%1");
-#line 967 "rl78-decode.opc"
+#line 969 "rl78-decode.opc"
ID(or); DM(None, SADDR); SC(IMMU(1)); Fz;
/*----------------------------------------------------------------------*/
@@ -3268,7 +3270,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("or %0, %1");
-#line 964 "rl78-decode.opc"
+#line 966 "rl78-decode.opc"
ID(or); DR(A); SM(None, SADDR); Fz;
}
@@ -3283,7 +3285,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("or %0, #%1");
-#line 955 "rl78-decode.opc"
+#line 957 "rl78-decode.opc"
ID(or); DR(A); SC(IMMU(1)); Fz;
}
@@ -3298,7 +3300,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("or %0, %e1");
-#line 943 "rl78-decode.opc"
+#line 945 "rl78-decode.opc"
ID(or); DR(A); SM(HL, 0); Fz;
}
@@ -3313,7 +3315,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("or %0, %ea1");
-#line 949 "rl78-decode.opc"
+#line 951 "rl78-decode.opc"
ID(or); DR(A); SM(HL, IMMU(1)); Fz;
}
@@ -3328,7 +3330,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("or %0, %e!1");
-#line 940 "rl78-decode.opc"
+#line 942 "rl78-decode.opc"
ID(or); DR(A); SM(None, IMMU(2)); Fz;
}
@@ -3342,7 +3344,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x77:
{
/** 0111 0rba mov %0, %1 */
-#line 696 "rl78-decode.opc"
+#line 698 "rl78-decode.opc"
int rba AU = op[0] & 0x07;
if (trace)
{
@@ -3352,7 +3354,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rba = 0x%x\n", rba);
}
SYNTAX("mov %0, %1");
-#line 696 "rl78-decode.opc"
+#line 698 "rl78-decode.opc"
ID(mov); DRB(rba); SR(A);
}
@@ -3371,7 +3373,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x70:
{
/** 0111 0001 0bit 0000 set1 %e!0 */
-#line 1046 "rl78-decode.opc"
+#line 1048 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3381,7 +3383,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("set1 %e!0");
-#line 1046 "rl78-decode.opc"
+#line 1048 "rl78-decode.opc"
ID(mov); DM(None, IMMU(2)); DB(bit); SC(1);
}
@@ -3396,7 +3398,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x71:
{
/** 0111 0001 0bit 0001 mov1 %0, cy */
-#line 803 "rl78-decode.opc"
+#line 805 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3406,7 +3408,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("mov1 %0, cy");
-#line 803 "rl78-decode.opc"
+#line 805 "rl78-decode.opc"
ID(mov); DM(None, SADDR); DB(bit); SCY();
}
@@ -3421,7 +3423,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x72:
{
/** 0111 0001 0bit 0010 set1 %0 */
-#line 1064 "rl78-decode.opc"
+#line 1066 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3431,7 +3433,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("set1 %0");
-#line 1064 "rl78-decode.opc"
+#line 1066 "rl78-decode.opc"
ID(mov); DM(None, SADDR); DB(bit); SC(1);
/*----------------------------------------------------------------------*/
@@ -3448,7 +3450,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x73:
{
/** 0111 0001 0bit 0011 clr1 %0 */
-#line 456 "rl78-decode.opc"
+#line 458 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3458,7 +3460,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("clr1 %0");
-#line 456 "rl78-decode.opc"
+#line 458 "rl78-decode.opc"
ID(mov); DM(None, SADDR); DB(bit); SC(0);
/*----------------------------------------------------------------------*/
@@ -3475,7 +3477,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x74:
{
/** 0111 0001 0bit 0100 mov1 cy, %1 */
-#line 797 "rl78-decode.opc"
+#line 799 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3485,7 +3487,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("mov1 cy, %1");
-#line 797 "rl78-decode.opc"
+#line 799 "rl78-decode.opc"
ID(mov); DCY(); SM(None, SADDR); SB(bit);
}
@@ -3500,7 +3502,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x75:
{
/** 0111 0001 0bit 0101 and1 cy, %s1 */
-#line 326 "rl78-decode.opc"
+#line 328 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3510,7 +3512,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("and1 cy, %s1");
-#line 326 "rl78-decode.opc"
+#line 328 "rl78-decode.opc"
ID(and); DCY(); SM(None, SADDR); SB(bit);
/*----------------------------------------------------------------------*/
@@ -3530,7 +3532,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x76:
{
/** 0111 0001 0bit 0110 or1 cy, %s1 */
-#line 981 "rl78-decode.opc"
+#line 983 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3540,7 +3542,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("or1 cy, %s1");
-#line 981 "rl78-decode.opc"
+#line 983 "rl78-decode.opc"
ID(or); DCY(); SM(None, SADDR); SB(bit);
/*----------------------------------------------------------------------*/
@@ -3557,7 +3559,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x77:
{
/** 0111 0001 0bit 0111 xor1 cy, %s1 */
-#line 1285 "rl78-decode.opc"
+#line 1287 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3567,7 +3569,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("xor1 cy, %s1");
-#line 1285 "rl78-decode.opc"
+#line 1287 "rl78-decode.opc"
ID(xor); DCY(); SM(None, SADDR); SB(bit);
/*----------------------------------------------------------------------*/
@@ -3584,7 +3586,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x78:
{
/** 0111 0001 0bit 1000 clr1 %e!0 */
-#line 438 "rl78-decode.opc"
+#line 440 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3594,7 +3596,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("clr1 %e!0");
-#line 438 "rl78-decode.opc"
+#line 440 "rl78-decode.opc"
ID(mov); DM(None, IMMU(2)); DB(bit); SC(0);
}
@@ -3609,7 +3611,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x79:
{
/** 0111 0001 0bit 1001 mov1 %s0, cy */
-#line 806 "rl78-decode.opc"
+#line 808 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3619,7 +3621,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("mov1 %s0, cy");
-#line 806 "rl78-decode.opc"
+#line 808 "rl78-decode.opc"
ID(mov); DM(None, SFR); DB(bit); SCY();
/*----------------------------------------------------------------------*/
@@ -3636,7 +3638,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x7a:
{
/** 0111 0001 0bit 1010 set1 %s0 */
-#line 1058 "rl78-decode.opc"
+#line 1060 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3646,7 +3648,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("set1 %s0");
-#line 1058 "rl78-decode.opc"
+#line 1060 "rl78-decode.opc"
op0 = SFR;
ID(mov); DM(None, op0); DB(bit); SC(1);
if (op0 == RL78_SFR_PSW && bit == 7)
@@ -3664,7 +3666,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x7b:
{
/** 0111 0001 0bit 1011 clr1 %s0 */
-#line 450 "rl78-decode.opc"
+#line 452 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3674,7 +3676,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("clr1 %s0");
-#line 450 "rl78-decode.opc"
+#line 452 "rl78-decode.opc"
op0 = SFR;
ID(mov); DM(None, op0); DB(bit); SC(0);
if (op0 == RL78_SFR_PSW && bit == 7)
@@ -3692,7 +3694,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x7c:
{
/** 0111 0001 0bit 1100 mov1 cy, %s1 */
-#line 800 "rl78-decode.opc"
+#line 802 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3702,7 +3704,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("mov1 cy, %s1");
-#line 800 "rl78-decode.opc"
+#line 802 "rl78-decode.opc"
ID(mov); DCY(); SM(None, SFR); SB(bit);
}
@@ -3717,7 +3719,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x7d:
{
/** 0111 0001 0bit 1101 and1 cy, %s1 */
-#line 323 "rl78-decode.opc"
+#line 325 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3727,7 +3729,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("and1 cy, %s1");
-#line 323 "rl78-decode.opc"
+#line 325 "rl78-decode.opc"
ID(and); DCY(); SM(None, SFR); SB(bit);
}
@@ -3742,7 +3744,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x7e:
{
/** 0111 0001 0bit 1110 or1 cy, %s1 */
-#line 978 "rl78-decode.opc"
+#line 980 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3752,7 +3754,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("or1 cy, %s1");
-#line 978 "rl78-decode.opc"
+#line 980 "rl78-decode.opc"
ID(or); DCY(); SM(None, SFR); SB(bit);
}
@@ -3767,7 +3769,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x7f:
{
/** 0111 0001 0bit 1111 xor1 cy, %s1 */
-#line 1282 "rl78-decode.opc"
+#line 1284 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3777,7 +3779,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("xor1 cy, %s1");
-#line 1282 "rl78-decode.opc"
+#line 1284 "rl78-decode.opc"
ID(xor); DCY(); SM(None, SFR); SB(bit);
}
@@ -3792,7 +3794,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("set1 cy");
-#line 1055 "rl78-decode.opc"
+#line 1057 "rl78-decode.opc"
ID(mov); DCY(); SC(1);
}
@@ -3807,7 +3809,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf1:
{
/** 0111 0001 1bit 0001 mov1 %e0, cy */
-#line 785 "rl78-decode.opc"
+#line 787 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3817,7 +3819,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("mov1 %e0, cy");
-#line 785 "rl78-decode.opc"
+#line 787 "rl78-decode.opc"
ID(mov); DM(HL, 0); DB(bit); SCY();
}
@@ -3832,7 +3834,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf2:
{
/** 0111 0001 1bit 0010 set1 %e0 */
-#line 1049 "rl78-decode.opc"
+#line 1051 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3842,7 +3844,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("set1 %e0");
-#line 1049 "rl78-decode.opc"
+#line 1051 "rl78-decode.opc"
ID(mov); DM(HL, 0); DB(bit); SC(1);
}
@@ -3857,7 +3859,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf3:
{
/** 0111 0001 1bit 0011 clr1 %e0 */
-#line 441 "rl78-decode.opc"
+#line 443 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3867,7 +3869,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("clr1 %e0");
-#line 441 "rl78-decode.opc"
+#line 443 "rl78-decode.opc"
ID(mov); DM(HL, 0); DB(bit); SC(0);
}
@@ -3882,7 +3884,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf4:
{
/** 0111 0001 1bit 0100 mov1 cy, %e1 */
-#line 791 "rl78-decode.opc"
+#line 793 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3892,7 +3894,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("mov1 cy, %e1");
-#line 791 "rl78-decode.opc"
+#line 793 "rl78-decode.opc"
ID(mov); DCY(); SM(HL, 0); SB(bit);
}
@@ -3907,7 +3909,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf5:
{
/** 0111 0001 1bit 0101 and1 cy, %e1 */
-#line 317 "rl78-decode.opc"
+#line 319 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3917,7 +3919,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("and1 cy, %e1");
-#line 317 "rl78-decode.opc"
+#line 319 "rl78-decode.opc"
ID(and); DCY(); SM(HL, 0); SB(bit);
}
@@ -3932,7 +3934,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf6:
{
/** 0111 0001 1bit 0110 or1 cy, %e1 */
-#line 972 "rl78-decode.opc"
+#line 974 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3942,7 +3944,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("or1 cy, %e1");
-#line 972 "rl78-decode.opc"
+#line 974 "rl78-decode.opc"
ID(or); DCY(); SM(HL, 0); SB(bit);
}
@@ -3957,7 +3959,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf7:
{
/** 0111 0001 1bit 0111 xor1 cy, %e1 */
-#line 1276 "rl78-decode.opc"
+#line 1278 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -3967,7 +3969,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("xor1 cy, %e1");
-#line 1276 "rl78-decode.opc"
+#line 1278 "rl78-decode.opc"
ID(xor); DCY(); SM(HL, 0); SB(bit);
}
@@ -3982,7 +3984,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("clr1 cy");
-#line 447 "rl78-decode.opc"
+#line 449 "rl78-decode.opc"
ID(mov); DCY(); SC(0);
}
@@ -3997,7 +3999,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf9:
{
/** 0111 0001 1bit 1001 mov1 %e0, cy */
-#line 788 "rl78-decode.opc"
+#line 790 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -4007,7 +4009,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("mov1 %e0, cy");
-#line 788 "rl78-decode.opc"
+#line 790 "rl78-decode.opc"
ID(mov); DR(A); DB(bit); SCY();
}
@@ -4022,7 +4024,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfa:
{
/** 0111 0001 1bit 1010 set1 %0 */
-#line 1052 "rl78-decode.opc"
+#line 1054 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -4032,7 +4034,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("set1 %0");
-#line 1052 "rl78-decode.opc"
+#line 1054 "rl78-decode.opc"
ID(mov); DR(A); DB(bit); SC(1);
}
@@ -4047,7 +4049,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfb:
{
/** 0111 0001 1bit 1011 clr1 %0 */
-#line 444 "rl78-decode.opc"
+#line 446 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -4057,7 +4059,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("clr1 %0");
-#line 444 "rl78-decode.opc"
+#line 446 "rl78-decode.opc"
ID(mov); DR(A); DB(bit); SC(0);
}
@@ -4072,7 +4074,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfc:
{
/** 0111 0001 1bit 1100 mov1 cy, %e1 */
-#line 794 "rl78-decode.opc"
+#line 796 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -4082,7 +4084,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("mov1 cy, %e1");
-#line 794 "rl78-decode.opc"
+#line 796 "rl78-decode.opc"
ID(mov); DCY(); SR(A); SB(bit);
}
@@ -4097,7 +4099,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfd:
{
/** 0111 0001 1bit 1101 and1 cy, %1 */
-#line 320 "rl78-decode.opc"
+#line 322 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -4107,7 +4109,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("and1 cy, %1");
-#line 320 "rl78-decode.opc"
+#line 322 "rl78-decode.opc"
ID(and); DCY(); SR(A); SB(bit);
}
@@ -4122,7 +4124,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfe:
{
/** 0111 0001 1bit 1110 or1 cy, %1 */
-#line 975 "rl78-decode.opc"
+#line 977 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -4132,7 +4134,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("or1 cy, %1");
-#line 975 "rl78-decode.opc"
+#line 977 "rl78-decode.opc"
ID(or); DCY(); SR(A); SB(bit);
}
@@ -4147,7 +4149,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xff:
{
/** 0111 0001 1bit 1111 xor1 cy, %1 */
-#line 1279 "rl78-decode.opc"
+#line 1281 "rl78-decode.opc"
int bit AU = (op[1] >> 4) & 0x07;
if (trace)
{
@@ -4157,7 +4159,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("xor1 cy, %1");
-#line 1279 "rl78-decode.opc"
+#line 1281 "rl78-decode.opc"
ID(xor); DCY(); SR(A); SB(bit);
}
@@ -4172,7 +4174,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("not1 cy");
-#line 916 "rl78-decode.opc"
+#line 918 "rl78-decode.opc"
ID(xor); DCY(); SC(1);
/*----------------------------------------------------------------------*/
@@ -4192,7 +4194,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %e0, %1");
-#line 877 "rl78-decode.opc"
+#line 879 "rl78-decode.opc"
ID(mov); W(); DM(BC, IMMU(2)); SR(AX);
}
@@ -4207,7 +4209,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %e1");
-#line 868 "rl78-decode.opc"
+#line 870 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(BC, IMMU(2));
}
@@ -4222,7 +4224,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("xor %0, #%1");
-#line 1271 "rl78-decode.opc"
+#line 1273 "rl78-decode.opc"
ID(xor); DM(None, SADDR); SC(IMMU(1)); Fz;
/*----------------------------------------------------------------------*/
@@ -4239,7 +4241,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("xor %0, %1");
-#line 1268 "rl78-decode.opc"
+#line 1270 "rl78-decode.opc"
ID(xor); DR(A); SM(None, SADDR); Fz;
}
@@ -4254,7 +4256,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("xor %0, #%1");
-#line 1259 "rl78-decode.opc"
+#line 1261 "rl78-decode.opc"
ID(xor); DR(A); SC(IMMU(1)); Fz;
}
@@ -4269,7 +4271,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("xor %0, %e1");
-#line 1247 "rl78-decode.opc"
+#line 1249 "rl78-decode.opc"
ID(xor); DR(A); SM(HL, 0); Fz;
}
@@ -4284,7 +4286,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("xor %0, %ea1");
-#line 1253 "rl78-decode.opc"
+#line 1255 "rl78-decode.opc"
ID(xor); DR(A); SM(HL, IMMU(1)); Fz;
}
@@ -4299,7 +4301,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("xor %0, %e!1");
-#line 1244 "rl78-decode.opc"
+#line 1246 "rl78-decode.opc"
ID(xor); DR(A); SM(None, IMMU(2)); Fz;
}
@@ -4314,7 +4316,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x87:
{
/** 1000 0reg inc %0 */
-#line 587 "rl78-decode.opc"
+#line 589 "rl78-decode.opc"
int reg AU = op[0] & 0x07;
if (trace)
{
@@ -4324,7 +4326,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("inc %0");
-#line 587 "rl78-decode.opc"
+#line 589 "rl78-decode.opc"
ID(add); DRB(reg); SC(1); Fza;
}
@@ -4339,7 +4341,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %ea1");
-#line 666 "rl78-decode.opc"
+#line 668 "rl78-decode.opc"
ID(mov); DR(A); SM(SP, IMMU(1));
}
@@ -4354,7 +4356,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e1");
-#line 648 "rl78-decode.opc"
+#line 650 "rl78-decode.opc"
ID(mov); DR(A); SM(DE, 0);
}
@@ -4369,7 +4371,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %ea1");
-#line 651 "rl78-decode.opc"
+#line 653 "rl78-decode.opc"
ID(mov); DR(A); SM(DE, IMMU(1));
}
@@ -4384,7 +4386,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e1");
-#line 654 "rl78-decode.opc"
+#line 656 "rl78-decode.opc"
ID(mov); DR(A); SM(HL, 0);
}
@@ -4399,7 +4401,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %ea1");
-#line 657 "rl78-decode.opc"
+#line 659 "rl78-decode.opc"
ID(mov); DR(A); SM(HL, IMMU(1));
}
@@ -4414,7 +4416,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %1");
-#line 690 "rl78-decode.opc"
+#line 692 "rl78-decode.opc"
ID(mov); DR(A); SM(None, SADDR);
}
@@ -4429,7 +4431,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %s1");
-#line 687 "rl78-decode.opc"
+#line 689 "rl78-decode.opc"
ID(mov); DR(A); SM(None, SFR);
}
@@ -4444,7 +4446,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e!1");
-#line 645 "rl78-decode.opc"
+#line 647 "rl78-decode.opc"
ID(mov); DR(A); SM(None, IMMU(2));
}
@@ -4459,7 +4461,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0x97:
{
/** 1001 0reg dec %0 */
-#line 554 "rl78-decode.opc"
+#line 556 "rl78-decode.opc"
int reg AU = op[0] & 0x07;
if (trace)
{
@@ -4469,7 +4471,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" reg = 0x%x\n", reg);
}
SYNTAX("dec %0");
-#line 554 "rl78-decode.opc"
+#line 556 "rl78-decode.opc"
ID(sub); DRB(reg); SC(1); Fza;
}
@@ -4484,7 +4486,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %a0, %1");
-#line 642 "rl78-decode.opc"
+#line 644 "rl78-decode.opc"
ID(mov); DM(SP, IMMU(1)); SR(A);
}
@@ -4499,7 +4501,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e0, %1");
-#line 615 "rl78-decode.opc"
+#line 617 "rl78-decode.opc"
ID(mov); DM(DE, 0); SR(A);
}
@@ -4514,7 +4516,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %ea0, %1");
-#line 621 "rl78-decode.opc"
+#line 623 "rl78-decode.opc"
ID(mov); DM(DE, IMMU(1)); SR(A);
}
@@ -4529,7 +4531,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e0, %1");
-#line 624 "rl78-decode.opc"
+#line 626 "rl78-decode.opc"
ID(mov); DM(HL, 0); SR(A);
}
@@ -4544,7 +4546,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %ea0, %1");
-#line 633 "rl78-decode.opc"
+#line 635 "rl78-decode.opc"
ID(mov); DM(HL, IMMU(1)); SR(A);
}
@@ -4559,7 +4561,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %1");
-#line 747 "rl78-decode.opc"
+#line 749 "rl78-decode.opc"
ID(mov); DM(None, SADDR); SR(A);
}
@@ -4574,7 +4576,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %s0, %1");
-#line 780 "rl78-decode.opc"
+#line 782 "rl78-decode.opc"
ID(mov); DM(None, SFR); SR(A);
/*----------------------------------------------------------------------*/
@@ -4591,7 +4593,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e!0, %1");
-#line 612 "rl78-decode.opc"
+#line 614 "rl78-decode.opc"
ID(mov); DM(None, IMMU(2)); SR(A);
}
@@ -4606,7 +4608,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("inc %e!0");
-#line 581 "rl78-decode.opc"
+#line 583 "rl78-decode.opc"
ID(add); DM(None, IMMU(2)); SC(1); Fza;
}
@@ -4617,7 +4619,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xa7:
{
/** 1010 0rg1 incw %0 */
-#line 601 "rl78-decode.opc"
+#line 603 "rl78-decode.opc"
int rg AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -4627,7 +4629,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("incw %0");
-#line 601 "rl78-decode.opc"
+#line 603 "rl78-decode.opc"
ID(add); W(); DRW(rg); SC(1);
}
@@ -4642,7 +4644,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("incw %e!0");
-#line 595 "rl78-decode.opc"
+#line 597 "rl78-decode.opc"
ID(add); W(); DM(None, IMMU(2)); SC(1);
}
@@ -4657,7 +4659,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("inc %0");
-#line 590 "rl78-decode.opc"
+#line 592 "rl78-decode.opc"
ID(add); DM(None, SADDR); SC(1); Fza;
/*----------------------------------------------------------------------*/
@@ -4674,7 +4676,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("incw %0");
-#line 604 "rl78-decode.opc"
+#line 606 "rl78-decode.opc"
ID(add); W(); DM(None, SADDR); SC(1);
/*----------------------------------------------------------------------*/
@@ -4691,7 +4693,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %a1");
-#line 850 "rl78-decode.opc"
+#line 852 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(SP, IMMU(1));
}
@@ -4706,7 +4708,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %e1");
-#line 838 "rl78-decode.opc"
+#line 840 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(DE, 0);
}
@@ -4721,7 +4723,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %ea1");
-#line 841 "rl78-decode.opc"
+#line 843 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(DE, IMMU(1));
}
@@ -4736,7 +4738,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %e1");
-#line 844 "rl78-decode.opc"
+#line 846 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(HL, 0);
}
@@ -4751,7 +4753,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %ea1");
-#line 847 "rl78-decode.opc"
+#line 849 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(HL, IMMU(1));
}
@@ -4766,7 +4768,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %1");
-#line 880 "rl78-decode.opc"
+#line 882 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(None, SADDR);
}
@@ -4781,7 +4783,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %s1");
-#line 883 "rl78-decode.opc"
+#line 885 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(None, SFR);
}
@@ -4796,7 +4798,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %e!1");
-#line 834 "rl78-decode.opc"
+#line 836 "rl78-decode.opc"
ID(mov); W(); DR(AX); SM(None, IMMU(2));
@@ -4812,7 +4814,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("dec %e!0");
-#line 548 "rl78-decode.opc"
+#line 550 "rl78-decode.opc"
ID(sub); DM(None, IMMU(2)); SC(1); Fza;
}
@@ -4823,7 +4825,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xb7:
{
/** 1011 0rg1 decw %0 */
-#line 568 "rl78-decode.opc"
+#line 570 "rl78-decode.opc"
int rg AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -4833,7 +4835,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("decw %0");
-#line 568 "rl78-decode.opc"
+#line 570 "rl78-decode.opc"
ID(sub); W(); DRW(rg); SC(1);
}
@@ -4848,7 +4850,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("decw %e!0");
-#line 562 "rl78-decode.opc"
+#line 564 "rl78-decode.opc"
ID(sub); W(); DM(None, IMMU(2)); SC(1);
}
@@ -4863,7 +4865,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("dec %0");
-#line 557 "rl78-decode.opc"
+#line 559 "rl78-decode.opc"
ID(sub); DM(None, SADDR); SC(1); Fza;
/*----------------------------------------------------------------------*/
@@ -4880,7 +4882,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("decw %0");
-#line 571 "rl78-decode.opc"
+#line 573 "rl78-decode.opc"
ID(sub); W(); DM(None, SADDR); SC(1);
/*----------------------------------------------------------------------*/
@@ -4897,7 +4899,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %a0, %1");
-#line 831 "rl78-decode.opc"
+#line 833 "rl78-decode.opc"
ID(mov); W(); DM(SP, IMMU(1)); SR(AX);
}
@@ -4912,7 +4914,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %e0, %1");
-#line 819 "rl78-decode.opc"
+#line 821 "rl78-decode.opc"
ID(mov); W(); DM(DE, 0); SR(AX);
}
@@ -4927,7 +4929,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %ea0, %1");
-#line 822 "rl78-decode.opc"
+#line 824 "rl78-decode.opc"
ID(mov); W(); DM(DE, IMMU(1)); SR(AX);
}
@@ -4942,7 +4944,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %e0, %1");
-#line 825 "rl78-decode.opc"
+#line 827 "rl78-decode.opc"
ID(mov); W(); DM(HL, 0); SR(AX);
}
@@ -4957,7 +4959,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %ea0, %1");
-#line 828 "rl78-decode.opc"
+#line 830 "rl78-decode.opc"
ID(mov); W(); DM(HL, IMMU(1)); SR(AX);
}
@@ -4972,7 +4974,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, %1");
-#line 895 "rl78-decode.opc"
+#line 897 "rl78-decode.opc"
ID(mov); W(); DM(None, SADDR); SR(AX);
}
@@ -4987,7 +4989,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %s0, %1");
-#line 901 "rl78-decode.opc"
+#line 903 "rl78-decode.opc"
ID(mov); W(); DM(None, SFR); SR(AX);
/*----------------------------------------------------------------------*/
@@ -5004,7 +5006,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %e!0, %1");
-#line 816 "rl78-decode.opc"
+#line 818 "rl78-decode.opc"
ID(mov); W(); DM(None, IMMU(2)); SR(AX);
}
@@ -5015,7 +5017,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xc6:
{
/** 1100 0rg0 pop %0 */
-#line 986 "rl78-decode.opc"
+#line 988 "rl78-decode.opc"
int rg AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -5025,7 +5027,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("pop %0");
-#line 986 "rl78-decode.opc"
+#line 988 "rl78-decode.opc"
ID(mov); W(); DRW(rg); SPOP();
}
@@ -5036,7 +5038,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xc7:
{
/** 1100 0rg1 push %1 */
-#line 994 "rl78-decode.opc"
+#line 996 "rl78-decode.opc"
int rg AU = (op[0] >> 1) & 0x03;
if (trace)
{
@@ -5046,7 +5048,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("push %1");
-#line 994 "rl78-decode.opc"
+#line 996 "rl78-decode.opc"
ID(mov); W(); DPUSH(); SRW(rg);
}
@@ -5061,7 +5063,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %a0, #%1");
-#line 639 "rl78-decode.opc"
+#line 641 "rl78-decode.opc"
ID(mov); DM(SP, IMMU(1)); SC(IMMU(1));
}
@@ -5076,7 +5078,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %0, #%1");
-#line 892 "rl78-decode.opc"
+#line 894 "rl78-decode.opc"
ID(mov); W(); DM(None, SADDR); SC(IMMU(2));
}
@@ -5091,7 +5093,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %ea0, #%1");
-#line 618 "rl78-decode.opc"
+#line 620 "rl78-decode.opc"
ID(mov); DM(DE, IMMU(1)); SC(IMMU(1));
}
@@ -5106,7 +5108,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("movw %s0, #%1");
-#line 898 "rl78-decode.opc"
+#line 900 "rl78-decode.opc"
ID(mov); W(); DM(None, SFR); SC(IMMU(2));
}
@@ -5121,7 +5123,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %ea0, #%1");
-#line 630 "rl78-decode.opc"
+#line 632 "rl78-decode.opc"
ID(mov); DM(HL, IMMU(1)); SC(IMMU(1));
}
@@ -5136,7 +5138,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, #%1");
-#line 744 "rl78-decode.opc"
+#line 746 "rl78-decode.opc"
ID(mov); DM(None, SADDR); SC(IMMU(1));
}
@@ -5151,7 +5153,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %s0, #%1");
-#line 750 "rl78-decode.opc"
+#line 752 "rl78-decode.opc"
op0 = SFR;
op1 = IMMU(1);
ID(mov); DM(None, op0); SC(op1);
@@ -5193,7 +5195,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %e!0, #%1");
-#line 609 "rl78-decode.opc"
+#line 611 "rl78-decode.opc"
ID(mov); DM(None, IMMU(2)); SC(IMMU(1));
}
@@ -5204,7 +5206,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xd3:
{
/** 1101 00rg cmp0 %0 */
-#line 518 "rl78-decode.opc"
+#line 520 "rl78-decode.opc"
int rg AU = op[0] & 0x03;
if (trace)
{
@@ -5214,7 +5216,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("cmp0 %0");
-#line 518 "rl78-decode.opc"
+#line 520 "rl78-decode.opc"
ID(cmp); DRB(rg); SC(0); Fzac;
}
@@ -5229,7 +5231,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp0 %0");
-#line 521 "rl78-decode.opc"
+#line 523 "rl78-decode.opc"
ID(cmp); DM(None, SADDR); SC(0); Fzac;
/*----------------------------------------------------------------------*/
@@ -5246,7 +5248,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("cmp0 %e!0");
-#line 515 "rl78-decode.opc"
+#line 517 "rl78-decode.opc"
ID(cmp); DM(None, IMMU(2)); SC(0); Fzac;
}
@@ -5261,7 +5263,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mulu x");
-#line 906 "rl78-decode.opc"
+#line 908 "rl78-decode.opc"
ID(mulu);
/*----------------------------------------------------------------------*/
@@ -5278,7 +5280,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("ret");
-#line 1002 "rl78-decode.opc"
+#line 1004 "rl78-decode.opc"
ID(ret);
}
@@ -5293,7 +5295,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %1");
-#line 711 "rl78-decode.opc"
+#line 713 "rl78-decode.opc"
ID(mov); DR(X); SM(None, SADDR);
}
@@ -5308,7 +5310,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e!1");
-#line 708 "rl78-decode.opc"
+#line 710 "rl78-decode.opc"
ID(mov); DR(X); SM(None, IMMU(2));
}
@@ -5318,7 +5320,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfa:
{
/** 11ra 1010 movw %0, %1 */
-#line 889 "rl78-decode.opc"
+#line 891 "rl78-decode.opc"
int ra AU = (op[0] >> 4) & 0x03;
if (trace)
{
@@ -5328,7 +5330,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" ra = 0x%x\n", ra);
}
SYNTAX("movw %0, %1");
-#line 889 "rl78-decode.opc"
+#line 891 "rl78-decode.opc"
ID(mov); W(); DRW(ra); SM(None, SADDR);
}
@@ -5338,7 +5340,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xfb:
{
/** 11ra 1011 movw %0, %es!1 */
-#line 886 "rl78-decode.opc"
+#line 888 "rl78-decode.opc"
int ra AU = (op[0] >> 4) & 0x03;
if (trace)
{
@@ -5348,7 +5350,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" ra = 0x%x\n", ra);
}
SYNTAX("movw %0, %es!1");
-#line 886 "rl78-decode.opc"
+#line 888 "rl78-decode.opc"
ID(mov); W(); DRW(ra); SM(None, IMMU(2));
}
@@ -5363,7 +5365,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bc $%a0");
-#line 334 "rl78-decode.opc"
+#line 336 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+2); SR(None); COND(C);
}
@@ -5378,7 +5380,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bz $%a0");
-#line 346 "rl78-decode.opc"
+#line 348 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+2); SR(None); COND(Z);
}
@@ -5393,7 +5395,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bnc $%a0");
-#line 337 "rl78-decode.opc"
+#line 339 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+2); SR(None); COND(NC);
}
@@ -5408,7 +5410,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bnz $%a0");
-#line 349 "rl78-decode.opc"
+#line 351 "rl78-decode.opc"
ID(branch_cond); DC(pc+IMMS(1)+2); SR(None); COND(NZ);
/*----------------------------------------------------------------------*/
@@ -5421,7 +5423,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xe3:
{
/** 1110 00rg oneb %0 */
-#line 924 "rl78-decode.opc"
+#line 926 "rl78-decode.opc"
int rg AU = op[0] & 0x03;
if (trace)
{
@@ -5431,7 +5433,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("oneb %0");
-#line 924 "rl78-decode.opc"
+#line 926 "rl78-decode.opc"
ID(mov); DRB(rg); SC(1);
}
@@ -5446,7 +5448,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("oneb %0");
-#line 927 "rl78-decode.opc"
+#line 929 "rl78-decode.opc"
ID(mov); DM(None, SADDR); SC(1);
/*----------------------------------------------------------------------*/
@@ -5463,7 +5465,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("oneb %e!0");
-#line 921 "rl78-decode.opc"
+#line 923 "rl78-decode.opc"
ID(mov); DM(None, IMMU(2)); SC(1);
}
@@ -5478,7 +5480,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("onew %0");
-#line 932 "rl78-decode.opc"
+#line 934 "rl78-decode.opc"
ID(mov); DR(AX); SC(1);
}
@@ -5493,7 +5495,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("onew %0");
-#line 935 "rl78-decode.opc"
+#line 937 "rl78-decode.opc"
ID(mov); DR(BC); SC(1);
/*----------------------------------------------------------------------*/
@@ -5510,7 +5512,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %1");
-#line 699 "rl78-decode.opc"
+#line 701 "rl78-decode.opc"
ID(mov); DR(B); SM(None, SADDR);
}
@@ -5525,7 +5527,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e!1");
-#line 693 "rl78-decode.opc"
+#line 695 "rl78-decode.opc"
ID(mov); DR(B); SM(None, IMMU(2));
}
@@ -5540,7 +5542,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("br !%!a0");
-#line 368 "rl78-decode.opc"
+#line 370 "rl78-decode.opc"
ID(branch); DC(IMMU(3));
}
@@ -5555,7 +5557,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("br %!a0");
-#line 371 "rl78-decode.opc"
+#line 373 "rl78-decode.opc"
ID(branch); DC(IMMU(2));
}
@@ -5570,7 +5572,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("br $%!a0");
-#line 374 "rl78-decode.opc"
+#line 376 "rl78-decode.opc"
ID(branch); DC(pc+IMMS(2)+3);
}
@@ -5585,7 +5587,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("br $%a0");
-#line 377 "rl78-decode.opc"
+#line 379 "rl78-decode.opc"
ID(branch); DC(pc+IMMS(1)+2);
}
@@ -5596,7 +5598,7 @@ rl78_decode_opcode (unsigned long pc AU,
case 0xf3:
{
/** 1111 00rg clrb %0 */
-#line 464 "rl78-decode.opc"
+#line 466 "rl78-decode.opc"
int rg AU = op[0] & 0x03;
if (trace)
{
@@ -5606,7 +5608,7 @@ rl78_decode_opcode (unsigned long pc AU,
printf (" rg = 0x%x\n", rg);
}
SYNTAX("clrb %0");
-#line 464 "rl78-decode.opc"
+#line 466 "rl78-decode.opc"
ID(mov); DRB(rg); SC(0);
}
@@ -5621,7 +5623,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("clrb %0");
-#line 467 "rl78-decode.opc"
+#line 469 "rl78-decode.opc"
ID(mov); DM(None, SADDR); SC(0);
/*----------------------------------------------------------------------*/
@@ -5638,7 +5640,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("clrb %e!0");
-#line 461 "rl78-decode.opc"
+#line 463 "rl78-decode.opc"
ID(mov); DM(None, IMMU(2)); SC(0);
}
@@ -5653,7 +5655,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("clrw %0");
-#line 472 "rl78-decode.opc"
+#line 474 "rl78-decode.opc"
ID(mov); DR(AX); SC(0);
}
@@ -5668,7 +5670,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("clrw %0");
-#line 475 "rl78-decode.opc"
+#line 477 "rl78-decode.opc"
ID(mov); DR(BC); SC(0);
/*----------------------------------------------------------------------*/
@@ -5685,7 +5687,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %1");
-#line 705 "rl78-decode.opc"
+#line 707 "rl78-decode.opc"
ID(mov); DR(C); SM(None, SADDR);
}
@@ -5700,7 +5702,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("mov %0, %e!1");
-#line 702 "rl78-decode.opc"
+#line 704 "rl78-decode.opc"
ID(mov); DR(C); SM(None, IMMU(2));
}
@@ -5715,7 +5717,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("call !%!a0");
-#line 421 "rl78-decode.opc"
+#line 423 "rl78-decode.opc"
ID(call); DC(IMMU(3));
}
@@ -5730,7 +5732,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("call %!a0");
-#line 424 "rl78-decode.opc"
+#line 426 "rl78-decode.opc"
ID(call); DC(IMMU(2));
}
@@ -5745,7 +5747,7 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("call $%!a0");
-#line 427 "rl78-decode.opc"
+#line 429 "rl78-decode.opc"
ID(call); DC(pc+IMMS(2)+3);
}
@@ -5760,13 +5762,13 @@ rl78_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("brk1");
-#line 385 "rl78-decode.opc"
+#line 387 "rl78-decode.opc"
ID(break);
}
break;
}
-#line 1290 "rl78-decode.opc"
+#line 1292 "rl78-decode.opc"
return rl78->n_bytes;
}
diff --git a/opcodes/rl78-decode.opc b/opcodes/rl78-decode.opc
index 6212f08..b25e441 100644
--- a/opcodes/rl78-decode.opc
+++ b/opcodes/rl78-decode.opc
@@ -50,7 +50,9 @@ typedef struct
#define W() rl78->size = RL78_Word
#define AU ATTRIBUTE_UNUSED
-#define GETBYTE() (ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr))
+
+#define OP_BUF_LEN 20
+#define GETBYTE() (ld->rl78->n_bytes < (OP_BUF_LEN - 1) ? ld->op [ld->rl78->n_bytes++] = ld->getbyte (ld->ptr): 0)
#define B ((unsigned long) GETBYTE())
#define SYNTAX(x) rl78->syntax = x
@@ -168,7 +170,7 @@ rl78_decode_opcode (unsigned long pc AU,
RL78_Dis_Isa isa)
{
LocalData lds, * ld = &lds;
- unsigned char op_buf[20] = {0};
+ unsigned char op_buf[OP_BUF_LEN] = {0};
unsigned char *op = op_buf;
int op0, op1;
diff --git a/opcodes/rx-decode.c b/opcodes/rx-decode.c
index 2db8611..ee2f396 100644
--- a/opcodes/rx-decode.c
+++ b/opcodes/rx-decode.c
@@ -27,6 +27,7 @@
#include <string.h>
#include "ansidecl.h"
#include "opcode/rx.h"
+#include "libiberty.h"
#define RX_OPCODE_BIG_ENDIAN 0
@@ -45,7 +46,7 @@ static int trace = 0;
#define LSIZE 2
/* These are for when the upper bits are "don't care" or "undefined". */
-static int bwl[] =
+static int bwl[4] =
{
RX_Byte,
RX_Word,
@@ -53,7 +54,7 @@ static int bwl[] =
RX_Bad_Size /* Bogus instructions can have a size field set to 3. */
};
-static int sbwl[] =
+static int sbwl[4] =
{
RX_SByte,
RX_SWord,
@@ -61,7 +62,7 @@ static int sbwl[] =
RX_Bad_Size /* Bogus instructions can have a size field set to 3. */
};
-static int ubw[] =
+static int ubw[4] =
{
RX_UByte,
RX_UWord,
@@ -69,7 +70,7 @@ static int ubw[] =
RX_Bad_Size /* Bogus instructions can have a size field set to 3. */
};
-static int memex[] =
+static int memex[4] =
{
RX_SByte,
RX_SWord,
@@ -89,6 +90,9 @@ static int SCALE[] = { 1, 2, 4, 0 };
/* This is for the prefix size enum. */
static int PSCALE[] = { 4, 1, 1, 1, 2, 2, 2, 3, 4 };
+#define GET_SCALE(_indx) ((unsigned)(_indx) < ARRAY_SIZE (SCALE) ? SCALE[(_indx)] : 0)
+#define GET_PSCALE(_indx) ((unsigned)(_indx) < ARRAY_SIZE (PSCALE) ? PSCALE[(_indx)] : 0)
+
static int flagmap[] = {0, 1, 2, 3, 0, 0, 0, 0,
16, 17, 0, 0, 0, 0, 0, 0 };
@@ -107,7 +111,7 @@ static int dsp3map[] = { 8, 9, 10, 3, 4, 5, 6, 7 };
#define DC(c) OP (0, RX_Operand_Immediate, 0, c)
#define DR(r) OP (0, RX_Operand_Register, r, 0)
#define DI(r,a) OP (0, RX_Operand_Indirect, r, a)
-#define DIs(r,a,s) OP (0, RX_Operand_Indirect, r, (a) * SCALE[s])
+#define DIs(r,a,s) OP (0, RX_Operand_Indirect, r, (a) * GET_SCALE (s))
#define DD(t,r,s) rx_disp (0, t, r, bwl[s], ld);
#define DF(r) OP (0, RX_Operand_Flag, flagmap[r], 0)
@@ -115,7 +119,7 @@ static int dsp3map[] = { 8, 9, 10, 3, 4, 5, 6, 7 };
#define SR(r) OP (1, RX_Operand_Register, r, 0)
#define SRR(r) OP (1, RX_Operand_TwoReg, r, 0)
#define SI(r,a) OP (1, RX_Operand_Indirect, r, a)
-#define SIs(r,a,s) OP (1, RX_Operand_Indirect, r, (a) * SCALE[s])
+#define SIs(r,a,s) OP (1, RX_Operand_Indirect, r, (a) * GET_SCALE (s))
#define SD(t,r,s) rx_disp (1, t, r, bwl[s], ld);
#define SP(t,r) rx_disp (1, t, r, (t!=3) ? RX_UByte : RX_Long, ld); P(t, 1);
#define SPm(t,r,m) rx_disp (1, t, r, memex[m], ld); rx->op[1].size = memex[m];
@@ -124,7 +128,7 @@ static int dsp3map[] = { 8, 9, 10, 3, 4, 5, 6, 7 };
#define S2C(i) OP (2, RX_Operand_Immediate, 0, i)
#define S2R(r) OP (2, RX_Operand_Register, r, 0)
#define S2I(r,a) OP (2, RX_Operand_Indirect, r, a)
-#define S2Is(r,a,s) OP (2, RX_Operand_Indirect, r, (a) * SCALE[s])
+#define S2Is(r,a,s) OP (2, RX_Operand_Indirect, r, (a) * GET_SCALE (s))
#define S2D(t,r,s) rx_disp (2, t, r, bwl[s], ld);
#define S2P(t,r) rx_disp (2, t, r, (t!=3) ? RX_UByte : RX_Long, ld); P(t, 2);
#define S2Pm(t,r,m) rx_disp (2, t, r, memex[m], ld); rx->op[2].size = memex[m];
@@ -211,7 +215,7 @@ immediate (int sfield, int ex, LocalData * ld)
}
static void
-rx_disp (int n, int type, int reg, int size, LocalData * ld)
+rx_disp (int n, int type, int reg, unsigned int size, LocalData * ld)
{
int disp;
@@ -228,7 +232,7 @@ rx_disp (int n, int type, int reg, int size, LocalData * ld)
case 1:
ld->rx->op[n].type = RX_Operand_Indirect;
disp = GETBYTE ();
- ld->rx->op[n].addend = disp * PSCALE[size];
+ ld->rx->op[n].addend = disp * GET_PSCALE (size);
break;
case 2:
ld->rx->op[n].type = RX_Operand_Indirect;
@@ -238,7 +242,7 @@ rx_disp (int n, int type, int reg, int size, LocalData * ld)
#else
disp = disp + GETBYTE () * 256;
#endif
- ld->rx->op[n].addend = disp * PSCALE[size];
+ ld->rx->op[n].addend = disp * GET_PSCALE (size);
break;
default:
abort ();
@@ -294,7 +298,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("brk");
-#line 1025 "rx-decode.opc"
+#line 1029 "rx-decode.opc"
ID(brk);
}
@@ -309,7 +313,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("dbt");
-#line 1028 "rx-decode.opc"
+#line 1032 "rx-decode.opc"
ID(dbt);
}
@@ -324,7 +328,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("rts");
-#line 806 "rx-decode.opc"
+#line 810 "rx-decode.opc"
ID(rts);
/*----------------------------------------------------------------------*/
@@ -342,7 +346,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("nop");
-#line 812 "rx-decode.opc"
+#line 816 "rx-decode.opc"
ID(nop);
/*----------------------------------------------------------------------*/
@@ -360,7 +364,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bra.a %a0");
-#line 784 "rx-decode.opc"
+#line 788 "rx-decode.opc"
ID(branch); DC(pc + IMMex(3));
}
@@ -375,7 +379,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bsr.a %a0");
-#line 800 "rx-decode.opc"
+#line 804 "rx-decode.opc"
ID(jsr); DC(pc + IMMex(3));
}
@@ -392,13 +396,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_1:
{
/** 0000 0110 mx00 00ss rsrc rdst sub %2%S2, %1 */
-#line 542 "rx-decode.opc"
+#line 546 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 542 "rx-decode.opc"
+#line 546 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 542 "rx-decode.opc"
+#line 546 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 542 "rx-decode.opc"
+#line 546 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -411,7 +415,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("sub %2%S2, %1");
-#line 542 "rx-decode.opc"
+#line 546 "rx-decode.opc"
ID(sub); S2Pm(ss, rsrc, mx); SR(rdst); DR(rdst); F_OSZC;
}
@@ -453,13 +457,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_2:
{
/** 0000 0110 mx00 01ss rsrc rdst cmp %2%S2, %1 */
-#line 530 "rx-decode.opc"
+#line 534 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 530 "rx-decode.opc"
+#line 534 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 530 "rx-decode.opc"
+#line 534 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 530 "rx-decode.opc"
+#line 534 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -472,7 +476,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("cmp %2%S2, %1");
-#line 530 "rx-decode.opc"
+#line 534 "rx-decode.opc"
ID(sub); S2Pm(ss, rsrc, mx); SR(rdst); F_OSZC;
/*----------------------------------------------------------------------*/
@@ -517,13 +521,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_3:
{
/** 0000 0110 mx00 10ss rsrc rdst add %1%S1, %0 */
-#line 506 "rx-decode.opc"
+#line 510 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 506 "rx-decode.opc"
+#line 510 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 506 "rx-decode.opc"
+#line 510 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 506 "rx-decode.opc"
+#line 510 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -536,7 +540,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("add %1%S1, %0");
-#line 506 "rx-decode.opc"
+#line 510 "rx-decode.opc"
ID(add); SPm(ss, rsrc, mx); DR(rdst); F_OSZC;
}
@@ -578,13 +582,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_4:
{
/** 0000 0110 mx00 11ss rsrc rdst mul %1%S1, %0 */
-#line 649 "rx-decode.opc"
+#line 653 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 649 "rx-decode.opc"
+#line 653 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 649 "rx-decode.opc"
+#line 653 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 649 "rx-decode.opc"
+#line 653 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -597,7 +601,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mul %1%S1, %0");
-#line 649 "rx-decode.opc"
+#line 653 "rx-decode.opc"
ID(mul); SPm(ss, rsrc, mx); DR(rdst); F_____;
}
@@ -639,13 +643,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_5:
{
/** 0000 0110 mx01 00ss rsrc rdst and %1%S1, %0 */
-#line 419 "rx-decode.opc"
+#line 423 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 419 "rx-decode.opc"
+#line 423 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 419 "rx-decode.opc"
+#line 423 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 419 "rx-decode.opc"
+#line 423 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -658,7 +662,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("and %1%S1, %0");
-#line 419 "rx-decode.opc"
+#line 423 "rx-decode.opc"
ID(and); SPm(ss, rsrc, mx); DR(rdst); F__SZ_;
}
@@ -700,13 +704,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_6:
{
/** 0000 0110 mx01 01ss rsrc rdst or %1%S1, %0 */
-#line 437 "rx-decode.opc"
+#line 441 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 437 "rx-decode.opc"
+#line 441 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 437 "rx-decode.opc"
+#line 441 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 437 "rx-decode.opc"
+#line 441 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -719,7 +723,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("or %1%S1, %0");
-#line 437 "rx-decode.opc"
+#line 441 "rx-decode.opc"
ID(or); SPm(ss, rsrc, mx); DR(rdst); F__SZ_;
}
@@ -765,13 +769,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_7:
{
/** 0000 0110 mx10 00sp 0000 0000 rsrc rdst sbb %1%S1, %0 */
-#line 555 "rx-decode.opc"
+#line 559 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 555 "rx-decode.opc"
+#line 559 "rx-decode.opc"
int sp AU = op[1] & 0x03;
-#line 555 "rx-decode.opc"
+#line 559 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 555 "rx-decode.opc"
+#line 559 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -784,7 +788,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("sbb %1%S1, %0");
-#line 555 "rx-decode.opc"
+#line 559 "rx-decode.opc"
ID(sbb); SPm(sp, rsrc, mx); DR(rdst); F_OSZC;
/*----------------------------------------------------------------------*/
@@ -802,13 +806,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_8:
{
/** 0000 0110 mx10 00ss 0000 0100 rsrc rdst max %1%S1, %0 */
-#line 594 "rx-decode.opc"
+#line 598 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 594 "rx-decode.opc"
+#line 598 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 594 "rx-decode.opc"
+#line 598 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 594 "rx-decode.opc"
+#line 598 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -821,7 +825,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("max %1%S1, %0");
-#line 594 "rx-decode.opc"
+#line 598 "rx-decode.opc"
ID(max); SPm(ss, rsrc, mx); DR(rdst);
/*----------------------------------------------------------------------*/
@@ -839,13 +843,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_9:
{
/** 0000 0110 mx10 00ss 0000 0101 rsrc rdst min %1%S1, %0 */
-#line 606 "rx-decode.opc"
+#line 610 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 606 "rx-decode.opc"
+#line 610 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 606 "rx-decode.opc"
+#line 610 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 606 "rx-decode.opc"
+#line 610 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -858,7 +862,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("min %1%S1, %0");
-#line 606 "rx-decode.opc"
+#line 610 "rx-decode.opc"
ID(min); SPm(ss, rsrc, mx); DR(rdst);
/*----------------------------------------------------------------------*/
@@ -876,13 +880,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_10:
{
/** 0000 0110 mx10 00ss 0000 0110 rsrc rdst emul %1%S1, %0 */
-#line 664 "rx-decode.opc"
+#line 668 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 664 "rx-decode.opc"
+#line 668 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 664 "rx-decode.opc"
+#line 668 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 664 "rx-decode.opc"
+#line 668 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -895,7 +899,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("emul %1%S1, %0");
-#line 664 "rx-decode.opc"
+#line 668 "rx-decode.opc"
ID(emul); SPm(ss, rsrc, mx); DR(rdst);
/*----------------------------------------------------------------------*/
@@ -913,13 +917,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_11:
{
/** 0000 0110 mx10 00ss 0000 0111 rsrc rdst emulu %1%S1, %0 */
-#line 676 "rx-decode.opc"
+#line 680 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 676 "rx-decode.opc"
+#line 680 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 676 "rx-decode.opc"
+#line 680 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 676 "rx-decode.opc"
+#line 680 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -932,7 +936,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("emulu %1%S1, %0");
-#line 676 "rx-decode.opc"
+#line 680 "rx-decode.opc"
ID(emulu); SPm(ss, rsrc, mx); DR(rdst);
/*----------------------------------------------------------------------*/
@@ -950,13 +954,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_12:
{
/** 0000 0110 mx10 00ss 0000 1000 rsrc rdst div %1%S1, %0 */
-#line 688 "rx-decode.opc"
+#line 692 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 688 "rx-decode.opc"
+#line 692 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 688 "rx-decode.opc"
+#line 692 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 688 "rx-decode.opc"
+#line 692 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -969,7 +973,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("div %1%S1, %0");
-#line 688 "rx-decode.opc"
+#line 692 "rx-decode.opc"
ID(div); SPm(ss, rsrc, mx); DR(rdst); F_O___;
/*----------------------------------------------------------------------*/
@@ -987,13 +991,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_13:
{
/** 0000 0110 mx10 00ss 0000 1001 rsrc rdst divu %1%S1, %0 */
-#line 700 "rx-decode.opc"
+#line 704 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 700 "rx-decode.opc"
+#line 704 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 700 "rx-decode.opc"
+#line 704 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 700 "rx-decode.opc"
+#line 704 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -1006,7 +1010,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("divu %1%S1, %0");
-#line 700 "rx-decode.opc"
+#line 704 "rx-decode.opc"
ID(divu); SPm(ss, rsrc, mx); DR(rdst); F_O___;
/*----------------------------------------------------------------------*/
@@ -1024,13 +1028,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_14:
{
/** 0000 0110 mx10 00ss 0000 1100 rsrc rdst tst %1%S1, %2 */
-#line 473 "rx-decode.opc"
+#line 477 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 473 "rx-decode.opc"
+#line 477 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 473 "rx-decode.opc"
+#line 477 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 473 "rx-decode.opc"
+#line 477 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -1043,7 +1047,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("tst %1%S1, %2");
-#line 473 "rx-decode.opc"
+#line 477 "rx-decode.opc"
ID(and); SPm(ss, rsrc, mx); S2R(rdst); F__SZ_;
/*----------------------------------------------------------------------*/
@@ -1061,13 +1065,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_15:
{
/** 0000 0110 mx10 00ss 0000 1101 rsrc rdst xor %1%S1, %0 */
-#line 452 "rx-decode.opc"
+#line 456 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 452 "rx-decode.opc"
+#line 456 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 452 "rx-decode.opc"
+#line 456 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 452 "rx-decode.opc"
+#line 456 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -1080,7 +1084,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("xor %1%S1, %0");
-#line 452 "rx-decode.opc"
+#line 456 "rx-decode.opc"
ID(xor); SPm(ss, rsrc, mx); DR(rdst); F__SZ_;
/*----------------------------------------------------------------------*/
@@ -1098,13 +1102,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_16:
{
/** 0000 0110 mx10 00ss 0001 0000 rsrc rdst xchg %1%S1, %0 */
-#line 386 "rx-decode.opc"
+#line 390 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 386 "rx-decode.opc"
+#line 390 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 386 "rx-decode.opc"
+#line 390 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 386 "rx-decode.opc"
+#line 390 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -1117,7 +1121,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("xchg %1%S1, %0");
-#line 386 "rx-decode.opc"
+#line 390 "rx-decode.opc"
ID(xchg); DR(rdst); SPm(ss, rsrc, mx);
/*----------------------------------------------------------------------*/
@@ -1135,13 +1139,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_17:
{
/** 0000 0110 mx10 00sd 0001 0001 rsrc rdst itof %1%S1, %0 */
-#line 929 "rx-decode.opc"
+#line 933 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 929 "rx-decode.opc"
+#line 933 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 929 "rx-decode.opc"
+#line 933 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 929 "rx-decode.opc"
+#line 933 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -1154,7 +1158,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("itof %1%S1, %0");
-#line 929 "rx-decode.opc"
+#line 933 "rx-decode.opc"
ID(itof); DR (rdst); SPm(sd, rsrc, mx); F__SZ_;
/*----------------------------------------------------------------------*/
@@ -1172,13 +1176,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_18:
{
/** 0000 0110 mx10 00sd 0001 0101 rsrc rdst utof %1%S1, %0 */
-#line 1115 "rx-decode.opc"
+#line 1119 "rx-decode.opc"
int mx AU = (op[1] >> 6) & 0x03;
-#line 1115 "rx-decode.opc"
+#line 1119 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 1115 "rx-decode.opc"
+#line 1119 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 1115 "rx-decode.opc"
+#line 1119 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -1191,7 +1195,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("utof %1%S1, %0");
-#line 1115 "rx-decode.opc"
+#line 1119 "rx-decode.opc"
ID(utof); DR (rdst); SPm(sd, rsrc, mx); F__SZ_;
}
@@ -2459,11 +2463,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_19:
{
/** 0000 0110 1010 00ss 0000 0010 rsrc rdst adc %1%S1, %0 */
-#line 494 "rx-decode.opc"
+#line 498 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 494 "rx-decode.opc"
+#line 498 "rx-decode.opc"
int rsrc AU = (op[3] >> 4) & 0x0f;
-#line 494 "rx-decode.opc"
+#line 498 "rx-decode.opc"
int rdst AU = op[3] & 0x0f;
if (trace)
{
@@ -2475,7 +2479,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("adc %1%S1, %0");
-#line 494 "rx-decode.opc"
+#line 498 "rx-decode.opc"
ID(adc); SPm(ss, rsrc, 2); DR(rdst); F_OSZC;
/*----------------------------------------------------------------------*/
@@ -3648,7 +3652,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x0f:
{
/** 0000 1dsp bra.s %a0 */
-#line 775 "rx-decode.opc"
+#line 779 "rx-decode.opc"
int dsp AU = op[0] & 0x07;
if (trace)
{
@@ -3658,7 +3662,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" dsp = 0x%x\n", dsp);
}
SYNTAX("bra.s %a0");
-#line 775 "rx-decode.opc"
+#line 779 "rx-decode.opc"
ID(branch); DC(pc + dsp3map[dsp]);
}
@@ -3681,9 +3685,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x1f:
{
/** 0001 n dsp b%1.s %a0 */
-#line 765 "rx-decode.opc"
+#line 769 "rx-decode.opc"
int n AU = (op[0] >> 3) & 0x01;
-#line 765 "rx-decode.opc"
+#line 769 "rx-decode.opc"
int dsp AU = op[0] & 0x07;
if (trace)
{
@@ -3694,7 +3698,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" dsp = 0x%x\n", dsp);
}
SYNTAX("b%1.s %a0");
-#line 765 "rx-decode.opc"
+#line 769 "rx-decode.opc"
ID(branch); Scc(n); DC(pc + dsp3map[dsp]);
}
@@ -3716,7 +3720,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x2f:
{
/** 0010 cond b%1.b %a0 */
-#line 768 "rx-decode.opc"
+#line 772 "rx-decode.opc"
int cond AU = op[0] & 0x0f;
if (trace)
{
@@ -3726,7 +3730,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" cond = 0x%x\n", cond);
}
SYNTAX("b%1.b %a0");
-#line 768 "rx-decode.opc"
+#line 772 "rx-decode.opc"
ID(branch); Scc(cond); DC(pc + IMMex (1));
}
@@ -3741,7 +3745,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bra.b %a0");
-#line 778 "rx-decode.opc"
+#line 782 "rx-decode.opc"
ID(branch); DC(pc + IMMex(1));
}
@@ -3756,7 +3760,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bra.w %a0");
-#line 781 "rx-decode.opc"
+#line 785 "rx-decode.opc"
ID(branch); DC(pc + IMMex(2));
}
@@ -3771,7 +3775,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("bsr.w %a0");
-#line 797 "rx-decode.opc"
+#line 801 "rx-decode.opc"
ID(jsr); DC(pc + IMMex(2));
}
@@ -3780,7 +3784,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x3b:
{
/** 0011 101c b%1.w %a0 */
-#line 771 "rx-decode.opc"
+#line 775 "rx-decode.opc"
int c AU = op[0] & 0x01;
if (trace)
{
@@ -3790,7 +3794,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" c = 0x%x\n", c);
}
SYNTAX("b%1.w %a0");
-#line 771 "rx-decode.opc"
+#line 775 "rx-decode.opc"
ID(branch); Scc(c); DC(pc + IMMex (2));
@@ -3804,13 +3808,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_20:
{
/** 0011 11sz d dst sppp mov%s #%1, %0 */
-#line 307 "rx-decode.opc"
+#line 311 "rx-decode.opc"
int sz AU = op[0] & 0x03;
-#line 307 "rx-decode.opc"
+#line 311 "rx-decode.opc"
int d AU = (op[1] >> 7) & 0x01;
-#line 307 "rx-decode.opc"
+#line 311 "rx-decode.opc"
int dst AU = (op[1] >> 4) & 0x07;
-#line 307 "rx-decode.opc"
+#line 311 "rx-decode.opc"
int sppp AU = op[1] & 0x0f;
if (trace)
{
@@ -3823,7 +3827,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" sppp = 0x%x\n", sppp);
}
SYNTAX("mov%s #%1, %0");
-#line 307 "rx-decode.opc"
+#line 311 "rx-decode.opc"
ID(mov); sBWL (sz); DIs(dst, d*16+sppp, sz); SC(IMM(1)); F_____;
}
@@ -3855,9 +3859,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0011 1111 rega regb rtsd #%1, %2-%0 */
-#line 404 "rx-decode.opc"
+#line 408 "rx-decode.opc"
int rega AU = (op[1] >> 4) & 0x0f;
-#line 404 "rx-decode.opc"
+#line 408 "rx-decode.opc"
int regb AU = op[1] & 0x0f;
if (trace)
{
@@ -3868,7 +3872,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" regb = 0x%x\n", regb);
}
SYNTAX("rtsd #%1, %2-%0");
-#line 404 "rx-decode.opc"
+#line 408 "rx-decode.opc"
ID(rtsd); SC(IMM(1) * 4); S2R(rega); DR(regb);
/*----------------------------------------------------------------------*/
@@ -3886,11 +3890,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_21:
{
/** 0100 00ss rsrc rdst sub %2%S2, %1 */
-#line 539 "rx-decode.opc"
+#line 543 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 539 "rx-decode.opc"
+#line 543 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 539 "rx-decode.opc"
+#line 543 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -3902,7 +3906,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("sub %2%S2, %1");
-#line 539 "rx-decode.opc"
+#line 543 "rx-decode.opc"
ID(sub); S2P(ss, rsrc); SR(rdst); DR(rdst); F_OSZC;
}
@@ -3944,11 +3948,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_22:
{
/** 0100 01ss rsrc rdst cmp %2%S2, %1 */
-#line 527 "rx-decode.opc"
+#line 531 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 527 "rx-decode.opc"
+#line 531 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 527 "rx-decode.opc"
+#line 531 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -3960,7 +3964,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("cmp %2%S2, %1");
-#line 527 "rx-decode.opc"
+#line 531 "rx-decode.opc"
ID(sub); S2P(ss, rsrc); SR(rdst); F_OSZC;
}
@@ -4002,11 +4006,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_23:
{
/** 0100 10ss rsrc rdst add %1%S1, %0 */
-#line 503 "rx-decode.opc"
+#line 507 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 503 "rx-decode.opc"
+#line 507 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 503 "rx-decode.opc"
+#line 507 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4018,7 +4022,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("add %1%S1, %0");
-#line 503 "rx-decode.opc"
+#line 507 "rx-decode.opc"
ID(add); SP(ss, rsrc); DR(rdst); F_OSZC;
}
@@ -4060,11 +4064,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_24:
{
/** 0100 11ss rsrc rdst mul %1%S1, %0 */
-#line 646 "rx-decode.opc"
+#line 650 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 646 "rx-decode.opc"
+#line 650 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 646 "rx-decode.opc"
+#line 650 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4076,7 +4080,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mul %1%S1, %0");
-#line 646 "rx-decode.opc"
+#line 650 "rx-decode.opc"
ID(mul); SP(ss, rsrc); DR(rdst); F_____;
}
@@ -4118,11 +4122,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_25:
{
/** 0101 00ss rsrc rdst and %1%S1, %0 */
-#line 416 "rx-decode.opc"
+#line 420 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 416 "rx-decode.opc"
+#line 420 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 416 "rx-decode.opc"
+#line 420 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4134,7 +4138,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("and %1%S1, %0");
-#line 416 "rx-decode.opc"
+#line 420 "rx-decode.opc"
ID(and); SP(ss, rsrc); DR(rdst); F__SZ_;
}
@@ -4176,11 +4180,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_26:
{
/** 0101 01ss rsrc rdst or %1%S1, %0 */
-#line 434 "rx-decode.opc"
+#line 438 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 434 "rx-decode.opc"
+#line 438 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 434 "rx-decode.opc"
+#line 438 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4192,7 +4196,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("or %1%S1, %0");
-#line 434 "rx-decode.opc"
+#line 438 "rx-decode.opc"
ID(or); SP(ss, rsrc); DR(rdst); F__SZ_;
}
@@ -4234,13 +4238,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_27:
{
/** 0101 1 s ss rsrc rdst movu%s %1, %0 */
-#line 355 "rx-decode.opc"
+#line 359 "rx-decode.opc"
int s AU = (op[0] >> 2) & 0x01;
-#line 355 "rx-decode.opc"
+#line 359 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 355 "rx-decode.opc"
+#line 359 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 355 "rx-decode.opc"
+#line 359 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4253,7 +4257,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("movu%s %1, %0");
-#line 355 "rx-decode.opc"
+#line 359 "rx-decode.opc"
ID(mov); uBW(s); SD(ss, rsrc, s); DR(rdst); F_____;
}
@@ -4330,9 +4334,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 0000 immm rdst sub #%2, %0 */
-#line 536 "rx-decode.opc"
+#line 540 "rx-decode.opc"
int immm AU = (op[1] >> 4) & 0x0f;
-#line 536 "rx-decode.opc"
+#line 540 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4343,7 +4347,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("sub #%2, %0");
-#line 536 "rx-decode.opc"
+#line 540 "rx-decode.opc"
ID(sub); S2C(immm); SR(rdst); DR(rdst); F_OSZC;
}
@@ -4357,9 +4361,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 0001 immm rdst cmp #%2, %1 */
-#line 518 "rx-decode.opc"
+#line 522 "rx-decode.opc"
int immm AU = (op[1] >> 4) & 0x0f;
-#line 518 "rx-decode.opc"
+#line 522 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4370,7 +4374,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("cmp #%2, %1");
-#line 518 "rx-decode.opc"
+#line 522 "rx-decode.opc"
ID(sub); S2C(immm); SR(rdst); F_OSZC;
}
@@ -4384,9 +4388,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 0010 immm rdst add #%1, %0 */
-#line 500 "rx-decode.opc"
+#line 504 "rx-decode.opc"
int immm AU = (op[1] >> 4) & 0x0f;
-#line 500 "rx-decode.opc"
+#line 504 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4397,7 +4401,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("add #%1, %0");
-#line 500 "rx-decode.opc"
+#line 504 "rx-decode.opc"
ID(add); SC(immm); DR(rdst); F_OSZC;
}
@@ -4411,9 +4415,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 0011 immm rdst mul #%1, %0 */
-#line 612 "rx-decode.opc"
+#line 616 "rx-decode.opc"
int immm AU = (op[1] >> 4) & 0x0f;
-#line 612 "rx-decode.opc"
+#line 616 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4424,7 +4428,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mul #%1, %0");
-#line 612 "rx-decode.opc"
+#line 616 "rx-decode.opc"
if (immm == 1 && rdst == 0)
{
ID(nop2);
@@ -4447,9 +4451,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 0100 immm rdst and #%1, %0 */
-#line 410 "rx-decode.opc"
+#line 414 "rx-decode.opc"
int immm AU = (op[1] >> 4) & 0x0f;
-#line 410 "rx-decode.opc"
+#line 414 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4460,7 +4464,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("and #%1, %0");
-#line 410 "rx-decode.opc"
+#line 414 "rx-decode.opc"
ID(and); SC(immm); DR(rdst); F__SZ_;
}
@@ -4474,9 +4478,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 0101 immm rdst or #%1, %0 */
-#line 428 "rx-decode.opc"
+#line 432 "rx-decode.opc"
int immm AU = (op[1] >> 4) & 0x0f;
-#line 428 "rx-decode.opc"
+#line 432 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4487,7 +4491,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("or #%1, %0");
-#line 428 "rx-decode.opc"
+#line 432 "rx-decode.opc"
ID(or); SC(immm); DR(rdst); F__SZ_;
}
@@ -4501,9 +4505,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 0110 immm rdst mov%s #%1, %0 */
-#line 304 "rx-decode.opc"
+#line 308 "rx-decode.opc"
int immm AU = (op[1] >> 4) & 0x0f;
-#line 304 "rx-decode.opc"
+#line 308 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4514,7 +4518,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mov%s #%1, %0");
-#line 304 "rx-decode.opc"
+#line 308 "rx-decode.opc"
ID(mov); DR(rdst); SC(immm); F_____;
}
@@ -4531,7 +4535,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0]);
}
SYNTAX("rtsd #%1");
-#line 401 "rx-decode.opc"
+#line 405 "rx-decode.opc"
ID(rtsd); SC(IMM(1) * 4);
}
@@ -4544,11 +4548,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_28:
{
/** 0110 100i mmmm rdst shlr #%2, %0 */
-#line 726 "rx-decode.opc"
+#line 730 "rx-decode.opc"
int i AU = op[0] & 0x01;
-#line 726 "rx-decode.opc"
+#line 730 "rx-decode.opc"
int mmmm AU = (op[1] >> 4) & 0x0f;
-#line 726 "rx-decode.opc"
+#line 730 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4560,7 +4564,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shlr #%2, %0");
-#line 726 "rx-decode.opc"
+#line 730 "rx-decode.opc"
ID(shlr); S2C(i*16+mmmm); SR(rdst); DR(rdst); F__SZC;
}
@@ -4584,11 +4588,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_29:
{
/** 0110 101i mmmm rdst shar #%2, %0 */
-#line 716 "rx-decode.opc"
+#line 720 "rx-decode.opc"
int i AU = op[0] & 0x01;
-#line 716 "rx-decode.opc"
+#line 720 "rx-decode.opc"
int mmmm AU = (op[1] >> 4) & 0x0f;
-#line 716 "rx-decode.opc"
+#line 720 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4600,7 +4604,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shar #%2, %0");
-#line 716 "rx-decode.opc"
+#line 720 "rx-decode.opc"
ID(shar); S2C(i*16+mmmm); SR(rdst); DR(rdst); F_0SZC;
}
@@ -4624,11 +4628,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_30:
{
/** 0110 110i mmmm rdst shll #%2, %0 */
-#line 706 "rx-decode.opc"
+#line 710 "rx-decode.opc"
int i AU = op[0] & 0x01;
-#line 706 "rx-decode.opc"
+#line 710 "rx-decode.opc"
int mmmm AU = (op[1] >> 4) & 0x0f;
-#line 706 "rx-decode.opc"
+#line 710 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4640,7 +4644,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shll #%2, %0");
-#line 706 "rx-decode.opc"
+#line 710 "rx-decode.opc"
ID(shll); S2C(i*16+mmmm); SR(rdst); DR(rdst); F_OSZC;
}
@@ -4663,9 +4667,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 1110 dsta dstb pushm %1-%2 */
-#line 368 "rx-decode.opc"
+#line 372 "rx-decode.opc"
int dsta AU = (op[1] >> 4) & 0x0f;
-#line 368 "rx-decode.opc"
+#line 372 "rx-decode.opc"
int dstb AU = op[1] & 0x0f;
if (trace)
{
@@ -4676,7 +4680,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" dstb = 0x%x\n", dstb);
}
SYNTAX("pushm %1-%2");
-#line 368 "rx-decode.opc"
+#line 372 "rx-decode.opc"
ID(pushm); SR(dsta); S2R(dstb); F_____;
}
@@ -4690,9 +4694,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0110 1111 dsta dstb popm %1-%2 */
-#line 365 "rx-decode.opc"
+#line 369 "rx-decode.opc"
int dsta AU = (op[1] >> 4) & 0x0f;
-#line 365 "rx-decode.opc"
+#line 369 "rx-decode.opc"
int dstb AU = op[1] & 0x0f;
if (trace)
{
@@ -4703,7 +4707,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" dstb = 0x%x\n", dstb);
}
SYNTAX("popm %1-%2");
-#line 365 "rx-decode.opc"
+#line 369 "rx-decode.opc"
ID(popm); SR(dsta); S2R(dstb); F_____;
}
@@ -4718,11 +4722,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_31:
{
/** 0111 00im rsrc rdst add #%1, %2, %0 */
-#line 509 "rx-decode.opc"
+#line 513 "rx-decode.opc"
int im AU = op[0] & 0x03;
-#line 509 "rx-decode.opc"
+#line 513 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 509 "rx-decode.opc"
+#line 513 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4734,7 +4738,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("add #%1, %2, %0");
-#line 509 "rx-decode.opc"
+#line 513 "rx-decode.opc"
ID(add); SC(IMMex(im)); S2R(rsrc); DR(rdst); F_OSZC;
}
@@ -4776,9 +4780,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_32:
{
/** 0111 01im 0000 rsrc cmp #%2, %1%S1 */
-#line 521 "rx-decode.opc"
+#line 525 "rx-decode.opc"
int im AU = op[0] & 0x03;
-#line 521 "rx-decode.opc"
+#line 525 "rx-decode.opc"
int rsrc AU = op[1] & 0x0f;
if (trace)
{
@@ -4789,7 +4793,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("cmp #%2, %1%S1");
-#line 521 "rx-decode.opc"
+#line 525 "rx-decode.opc"
ID(sub); SR(rsrc); S2C(IMMex(im)); F_OSZC;
}
@@ -4798,9 +4802,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_33:
{
/** 0111 01im 0001rdst mul #%1, %0 */
-#line 624 "rx-decode.opc"
+#line 628 "rx-decode.opc"
int im AU = op[0] & 0x03;
-#line 624 "rx-decode.opc"
+#line 628 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4811,7 +4815,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mul #%1, %0");
-#line 624 "rx-decode.opc"
+#line 628 "rx-decode.opc"
int val = IMMex(im);
if (val == 1 && rdst == 0)
{
@@ -4839,9 +4843,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_34:
{
/** 0111 01im 0010 rdst and #%1, %0 */
-#line 413 "rx-decode.opc"
+#line 417 "rx-decode.opc"
int im AU = op[0] & 0x03;
-#line 413 "rx-decode.opc"
+#line 417 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4852,7 +4856,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("and #%1, %0");
-#line 413 "rx-decode.opc"
+#line 417 "rx-decode.opc"
ID(and); SC(IMMex(im)); DR(rdst); F__SZ_;
}
@@ -4861,9 +4865,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_35:
{
/** 0111 01im 0011 rdst or #%1, %0 */
-#line 431 "rx-decode.opc"
+#line 435 "rx-decode.opc"
int im AU = op[0] & 0x03;
-#line 431 "rx-decode.opc"
+#line 435 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4874,7 +4878,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("or #%1, %0");
-#line 431 "rx-decode.opc"
+#line 435 "rx-decode.opc"
ID(or); SC(IMMex(im)); DR(rdst); F__SZ_;
}
@@ -4976,7 +4980,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x4f:
{
/** 0111 0101 0100 rdst mov%s #%1, %0 */
-#line 285 "rx-decode.opc"
+#line 289 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -4986,7 +4990,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mov%s #%1, %0");
-#line 285 "rx-decode.opc"
+#line 289 "rx-decode.opc"
ID(mov); DR(rdst); SC(IMM (1)); F_____;
}
@@ -5009,7 +5013,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x5f:
{
/** 0111 0101 0101 rsrc cmp #%2, %1 */
-#line 524 "rx-decode.opc"
+#line 528 "rx-decode.opc"
int rsrc AU = op[1] & 0x0f;
if (trace)
{
@@ -5019,7 +5023,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("cmp #%2, %1");
-#line 524 "rx-decode.opc"
+#line 528 "rx-decode.opc"
ID(sub); SR(rsrc); S2C(IMM(1)); F_OSZC;
}
@@ -5034,7 +5038,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("int #%1");
-#line 1031 "rx-decode.opc"
+#line 1035 "rx-decode.opc"
ID(int); SC(IMM(1));
}
@@ -5046,7 +5050,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0111 0101 0111 0000 0000 immm mvtipl #%1 */
-#line 998 "rx-decode.opc"
+#line 1002 "rx-decode.opc"
int immm AU = op[2] & 0x0f;
if (trace)
{
@@ -5056,7 +5060,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" immm = 0x%x\n", immm);
}
SYNTAX("mvtipl #%1");
-#line 998 "rx-decode.opc"
+#line 1002 "rx-decode.opc"
ID(mvtipl); SC(immm);
}
@@ -5113,11 +5117,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_36:
{
/** 0111 100b ittt rdst bset #%1, %0 */
-#line 943 "rx-decode.opc"
+#line 947 "rx-decode.opc"
int b AU = op[0] & 0x01;
-#line 943 "rx-decode.opc"
+#line 947 "rx-decode.opc"
int ittt AU = (op[1] >> 4) & 0x0f;
-#line 943 "rx-decode.opc"
+#line 947 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5129,7 +5133,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("bset #%1, %0");
-#line 943 "rx-decode.opc"
+#line 947 "rx-decode.opc"
ID(bset); BWL(LSIZE); SC(b*16+ittt); DR(rdst); F_____;
@@ -5154,11 +5158,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_37:
{
/** 0111 101b ittt rdst bclr #%1, %0 */
-#line 955 "rx-decode.opc"
+#line 959 "rx-decode.opc"
int b AU = op[0] & 0x01;
-#line 955 "rx-decode.opc"
+#line 959 "rx-decode.opc"
int ittt AU = (op[1] >> 4) & 0x0f;
-#line 955 "rx-decode.opc"
+#line 959 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5170,7 +5174,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("bclr #%1, %0");
-#line 955 "rx-decode.opc"
+#line 959 "rx-decode.opc"
ID(bclr); BWL(LSIZE); SC(b*16+ittt); DR(rdst); F_____;
@@ -5195,11 +5199,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_38:
{
/** 0111 110b ittt rdst btst #%2, %1 */
-#line 967 "rx-decode.opc"
+#line 971 "rx-decode.opc"
int b AU = op[0] & 0x01;
-#line 967 "rx-decode.opc"
+#line 971 "rx-decode.opc"
int ittt AU = (op[1] >> 4) & 0x0f;
-#line 967 "rx-decode.opc"
+#line 971 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5211,7 +5215,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("btst #%2, %1");
-#line 967 "rx-decode.opc"
+#line 971 "rx-decode.opc"
ID(btst); BWL(LSIZE); S2C(b*16+ittt); SR(rdst); F___ZC;
@@ -5235,7 +5239,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 0111 1110 0000 rdst not %0 */
-#line 458 "rx-decode.opc"
+#line 462 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5245,7 +5249,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("not %0");
-#line 458 "rx-decode.opc"
+#line 462 "rx-decode.opc"
ID(xor); DR(rdst); SR(rdst); S2C(~0); F__SZ_;
}
@@ -5253,7 +5257,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x10:
{
/** 0111 1110 0001 rdst neg %0 */
-#line 479 "rx-decode.opc"
+#line 483 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5263,7 +5267,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("neg %0");
-#line 479 "rx-decode.opc"
+#line 483 "rx-decode.opc"
ID(sub); DR(rdst); SC(0); S2R(rdst); F_OSZC;
}
@@ -5271,7 +5275,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x20:
{
/** 0111 1110 0010 rdst abs %0 */
-#line 561 "rx-decode.opc"
+#line 565 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5281,7 +5285,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("abs %0");
-#line 561 "rx-decode.opc"
+#line 565 "rx-decode.opc"
ID(abs); DR(rdst); SR(rdst); F_OSZ_;
}
@@ -5289,7 +5293,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x30:
{
/** 0111 1110 0011 rdst sat %0 */
-#line 881 "rx-decode.opc"
+#line 885 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5299,7 +5303,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("sat %0");
-#line 881 "rx-decode.opc"
+#line 885 "rx-decode.opc"
ID(sat); DR (rdst);
}
@@ -5307,7 +5311,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x40:
{
/** 0111 1110 0100 rdst rorc %0 */
-#line 741 "rx-decode.opc"
+#line 745 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5317,7 +5321,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("rorc %0");
-#line 741 "rx-decode.opc"
+#line 745 "rx-decode.opc"
ID(rorc); DR(rdst); F__SZC;
}
@@ -5325,7 +5329,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x50:
{
/** 0111 1110 0101 rdst rolc %0 */
-#line 738 "rx-decode.opc"
+#line 742 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5335,7 +5339,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("rolc %0");
-#line 738 "rx-decode.opc"
+#line 742 "rx-decode.opc"
ID(rolc); DR(rdst); F__SZC;
}
@@ -5345,9 +5349,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0xa0:
{
/** 0111 1110 10sz rsrc push%s %1 */
-#line 374 "rx-decode.opc"
+#line 378 "rx-decode.opc"
int sz AU = (op[1] >> 4) & 0x03;
-#line 374 "rx-decode.opc"
+#line 378 "rx-decode.opc"
int rsrc AU = op[1] & 0x0f;
if (trace)
{
@@ -5358,7 +5362,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("push%s %1");
-#line 374 "rx-decode.opc"
+#line 378 "rx-decode.opc"
ID(mov); BWL(sz); OP(0, RX_Operand_Predec, 0, 0); SR(rsrc); F_____;
}
@@ -5366,7 +5370,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0xb0:
{
/** 0111 1110 1011 rdst pop %0 */
-#line 371 "rx-decode.opc"
+#line 375 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5376,7 +5380,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("pop %0");
-#line 371 "rx-decode.opc"
+#line 375 "rx-decode.opc"
ID(mov); OP(1, RX_Operand_Postinc, 0, 0); DR(rdst); F_____;
}
@@ -5385,7 +5389,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0xd0:
{
/** 0111 1110 110 crsrc pushc %1 */
-#line 1004 "rx-decode.opc"
+#line 1008 "rx-decode.opc"
int crsrc AU = op[1] & 0x1f;
if (trace)
{
@@ -5395,7 +5399,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" crsrc = 0x%x\n", crsrc);
}
SYNTAX("pushc %1");
-#line 1004 "rx-decode.opc"
+#line 1008 "rx-decode.opc"
ID(mov); OP(0, RX_Operand_Predec, 0, 0); SR(crsrc + 16);
}
@@ -5404,7 +5408,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0xf0:
{
/** 0111 1110 111 crdst popc %0 */
-#line 1001 "rx-decode.opc"
+#line 1005 "rx-decode.opc"
int crdst AU = op[1] & 0x1f;
if (trace)
{
@@ -5414,7 +5418,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" crdst = 0x%x\n", crdst);
}
SYNTAX("popc %0");
-#line 1001 "rx-decode.opc"
+#line 1005 "rx-decode.opc"
ID(mov); OP(1, RX_Operand_Postinc, 0, 0); DR(crdst + 16);
}
@@ -5444,7 +5448,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x0f:
{
/** 0111 1111 0000 rsrc jmp %0 */
-#line 791 "rx-decode.opc"
+#line 795 "rx-decode.opc"
int rsrc AU = op[1] & 0x0f;
if (trace)
{
@@ -5454,7 +5458,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("jmp %0");
-#line 791 "rx-decode.opc"
+#line 795 "rx-decode.opc"
ID(branch); DR(rsrc);
}
@@ -5477,7 +5481,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x1f:
{
/** 0111 1111 0001 rsrc jsr %0 */
-#line 794 "rx-decode.opc"
+#line 798 "rx-decode.opc"
int rsrc AU = op[1] & 0x0f;
if (trace)
{
@@ -5487,7 +5491,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("jsr %0");
-#line 794 "rx-decode.opc"
+#line 798 "rx-decode.opc"
ID(jsr); DR(rsrc);
}
@@ -5510,7 +5514,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x4f:
{
/** 0111 1111 0100 rsrc bra.l %0 */
-#line 787 "rx-decode.opc"
+#line 791 "rx-decode.opc"
int rsrc AU = op[1] & 0x0f;
if (trace)
{
@@ -5520,7 +5524,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("bra.l %0");
-#line 787 "rx-decode.opc"
+#line 791 "rx-decode.opc"
ID(branchrel); DR(rsrc);
@@ -5544,7 +5548,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x5f:
{
/** 0111 1111 0101 rsrc bsr.l %0 */
-#line 803 "rx-decode.opc"
+#line 807 "rx-decode.opc"
int rsrc AU = op[1] & 0x0f;
if (trace)
{
@@ -5554,7 +5558,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("bsr.l %0");
-#line 803 "rx-decode.opc"
+#line 807 "rx-decode.opc"
ID(jsrrel); DR(rsrc);
}
@@ -5564,7 +5568,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x82:
{
/** 0111 1111 1000 00sz suntil%s */
-#line 827 "rx-decode.opc"
+#line 831 "rx-decode.opc"
int sz AU = op[1] & 0x03;
if (trace)
{
@@ -5574,7 +5578,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" sz = 0x%x\n", sz);
}
SYNTAX("suntil%s");
-#line 827 "rx-decode.opc"
+#line 831 "rx-decode.opc"
ID(suntil); BWL(sz); F___ZC;
}
@@ -5589,7 +5593,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("scmpu");
-#line 818 "rx-decode.opc"
+#line 822 "rx-decode.opc"
ID(scmpu); F___ZC;
}
@@ -5599,7 +5603,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x86:
{
/** 0111 1111 1000 01sz swhile%s */
-#line 830 "rx-decode.opc"
+#line 834 "rx-decode.opc"
int sz AU = op[1] & 0x03;
if (trace)
{
@@ -5609,7 +5613,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" sz = 0x%x\n", sz);
}
SYNTAX("swhile%s");
-#line 830 "rx-decode.opc"
+#line 834 "rx-decode.opc"
ID(swhile); BWL(sz); F___ZC;
}
@@ -5624,7 +5628,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("smovu");
-#line 821 "rx-decode.opc"
+#line 825 "rx-decode.opc"
ID(smovu);
}
@@ -5634,7 +5638,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x8a:
{
/** 0111 1111 1000 10sz sstr%s */
-#line 836 "rx-decode.opc"
+#line 840 "rx-decode.opc"
int sz AU = op[1] & 0x03;
if (trace)
{
@@ -5644,7 +5648,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" sz = 0x%x\n", sz);
}
SYNTAX("sstr%s");
-#line 836 "rx-decode.opc"
+#line 840 "rx-decode.opc"
ID(sstr); BWL(sz);
/*----------------------------------------------------------------------*/
@@ -5662,7 +5666,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("smovb");
-#line 824 "rx-decode.opc"
+#line 828 "rx-decode.opc"
ID(smovb);
}
@@ -5672,7 +5676,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x8e:
{
/** 0111 1111 1000 11sz rmpa%s */
-#line 842 "rx-decode.opc"
+#line 846 "rx-decode.opc"
int sz AU = op[1] & 0x03;
if (trace)
{
@@ -5682,7 +5686,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" sz = 0x%x\n", sz);
}
SYNTAX("rmpa%s");
-#line 842 "rx-decode.opc"
+#line 846 "rx-decode.opc"
ID(rmpa); BWL(sz); F_OS__;
/*----------------------------------------------------------------------*/
@@ -5700,7 +5704,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("smovf");
-#line 833 "rx-decode.opc"
+#line 837 "rx-decode.opc"
ID(smovf);
}
@@ -5715,7 +5719,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("satr");
-#line 884 "rx-decode.opc"
+#line 888 "rx-decode.opc"
ID(satr);
/*----------------------------------------------------------------------*/
@@ -5733,7 +5737,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("rtfi");
-#line 1019 "rx-decode.opc"
+#line 1023 "rx-decode.opc"
ID(rtfi);
}
@@ -5748,7 +5752,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("rte");
-#line 1022 "rx-decode.opc"
+#line 1026 "rx-decode.opc"
ID(rte);
}
@@ -5763,7 +5767,7 @@ rx_decode_opcode (unsigned long pc AU,
op[0], op[1]);
}
SYNTAX("wait");
-#line 1034 "rx-decode.opc"
+#line 1038 "rx-decode.opc"
ID(wait);
/*----------------------------------------------------------------------*/
@@ -5789,7 +5793,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0xaf:
{
/** 0111 1111 1010 rdst setpsw %0 */
-#line 995 "rx-decode.opc"
+#line 999 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5799,7 +5803,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("setpsw %0");
-#line 995 "rx-decode.opc"
+#line 999 "rx-decode.opc"
ID(setpsw); DF(rdst);
}
@@ -5822,7 +5826,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0xbf:
{
/** 0111 1111 1011 rdst clrpsw %0 */
-#line 992 "rx-decode.opc"
+#line 996 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -5832,7 +5836,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("clrpsw %0");
-#line 992 "rx-decode.opc"
+#line 996 "rx-decode.opc"
ID(clrpsw); DF(rdst);
}
@@ -5848,17 +5852,17 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_39:
{
/** 10sz 0dsp a dst b src mov%s %1, %0 */
-#line 332 "rx-decode.opc"
+#line 336 "rx-decode.opc"
int sz AU = (op[0] >> 4) & 0x03;
-#line 332 "rx-decode.opc"
+#line 336 "rx-decode.opc"
int dsp AU = op[0] & 0x07;
-#line 332 "rx-decode.opc"
+#line 336 "rx-decode.opc"
int a AU = (op[1] >> 7) & 0x01;
-#line 332 "rx-decode.opc"
+#line 336 "rx-decode.opc"
int dst AU = (op[1] >> 4) & 0x07;
-#line 332 "rx-decode.opc"
+#line 336 "rx-decode.opc"
int b AU = (op[1] >> 3) & 0x01;
-#line 332 "rx-decode.opc"
+#line 336 "rx-decode.opc"
int src AU = op[1] & 0x07;
if (trace)
{
@@ -5873,7 +5877,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" src = 0x%x\n", src);
}
SYNTAX("mov%s %1, %0");
-#line 332 "rx-decode.opc"
+#line 336 "rx-decode.opc"
ID(mov); sBWL(sz); DIs(dst, dsp*4+a*2+b, sz); SR(src); F_____;
}
@@ -5951,17 +5955,17 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_40:
{
/** 10sz 1dsp a src b dst mov%s %1, %0 */
-#line 329 "rx-decode.opc"
+#line 333 "rx-decode.opc"
int sz AU = (op[0] >> 4) & 0x03;
-#line 329 "rx-decode.opc"
+#line 333 "rx-decode.opc"
int dsp AU = op[0] & 0x07;
-#line 329 "rx-decode.opc"
+#line 333 "rx-decode.opc"
int a AU = (op[1] >> 7) & 0x01;
-#line 329 "rx-decode.opc"
+#line 333 "rx-decode.opc"
int src AU = (op[1] >> 4) & 0x07;
-#line 329 "rx-decode.opc"
+#line 333 "rx-decode.opc"
int b AU = (op[1] >> 3) & 0x01;
-#line 329 "rx-decode.opc"
+#line 333 "rx-decode.opc"
int dst AU = op[1] & 0x07;
if (trace)
{
@@ -5976,7 +5980,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" dst = 0x%x\n", dst);
}
SYNTAX("mov%s %1, %0");
-#line 329 "rx-decode.opc"
+#line 333 "rx-decode.opc"
ID(mov); sBWL(sz); DR(dst); SIs(src, dsp*4+a*2+b, sz); F_____;
}
@@ -6342,17 +6346,17 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_41:
{
/** 1011 w dsp a src b dst movu%s %1, %0 */
-#line 352 "rx-decode.opc"
+#line 356 "rx-decode.opc"
int w AU = (op[0] >> 3) & 0x01;
-#line 352 "rx-decode.opc"
+#line 356 "rx-decode.opc"
int dsp AU = op[0] & 0x07;
-#line 352 "rx-decode.opc"
+#line 356 "rx-decode.opc"
int a AU = (op[1] >> 7) & 0x01;
-#line 352 "rx-decode.opc"
+#line 356 "rx-decode.opc"
int src AU = (op[1] >> 4) & 0x07;
-#line 352 "rx-decode.opc"
+#line 356 "rx-decode.opc"
int b AU = (op[1] >> 3) & 0x01;
-#line 352 "rx-decode.opc"
+#line 356 "rx-decode.opc"
int dst AU = op[1] & 0x07;
if (trace)
{
@@ -6367,7 +6371,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" dst = 0x%x\n", dst);
}
SYNTAX("movu%s %1, %0");
-#line 352 "rx-decode.opc"
+#line 356 "rx-decode.opc"
ID(mov); uBW(w); DR(dst); SIs(src, dsp*4+a*2+b, w); F_____;
}
@@ -6517,15 +6521,15 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_42:
{
/** 11sz sd ss rsrc rdst mov%s %1, %0 */
-#line 310 "rx-decode.opc"
+#line 314 "rx-decode.opc"
int sz AU = (op[0] >> 4) & 0x03;
-#line 310 "rx-decode.opc"
+#line 314 "rx-decode.opc"
int sd AU = (op[0] >> 2) & 0x03;
-#line 310 "rx-decode.opc"
+#line 314 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 310 "rx-decode.opc"
+#line 314 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 310 "rx-decode.opc"
+#line 314 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
if (trace)
{
@@ -6539,7 +6543,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mov%s %1, %0");
-#line 310 "rx-decode.opc"
+#line 314 "rx-decode.opc"
if (sd == 3 && ss == 3 && sz == 2 && rsrc == 0 && rdst == 0)
{
ID(nop2);
@@ -6993,11 +6997,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_43:
{
/** 1111 00sd rdst 0bit bset #%1, %0%S0 */
-#line 935 "rx-decode.opc"
+#line 939 "rx-decode.opc"
int sd AU = op[0] & 0x03;
-#line 935 "rx-decode.opc"
+#line 939 "rx-decode.opc"
int rdst AU = (op[1] >> 4) & 0x0f;
-#line 935 "rx-decode.opc"
+#line 939 "rx-decode.opc"
int bit AU = op[1] & 0x07;
if (trace)
{
@@ -7009,7 +7013,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bset #%1, %0%S0");
-#line 935 "rx-decode.opc"
+#line 939 "rx-decode.opc"
ID(bset); BWL(BSIZE); SC(bit); DD(sd, rdst, BSIZE); F_____;
}
@@ -7018,11 +7022,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_44:
{
/** 1111 00sd rdst 1bit bclr #%1, %0%S0 */
-#line 947 "rx-decode.opc"
+#line 951 "rx-decode.opc"
int sd AU = op[0] & 0x03;
-#line 947 "rx-decode.opc"
+#line 951 "rx-decode.opc"
int rdst AU = (op[1] >> 4) & 0x0f;
-#line 947 "rx-decode.opc"
+#line 951 "rx-decode.opc"
int bit AU = op[1] & 0x07;
if (trace)
{
@@ -7034,7 +7038,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("bclr #%1, %0%S0");
-#line 947 "rx-decode.opc"
+#line 951 "rx-decode.opc"
ID(bclr); BWL(BSIZE); SC(bit); DD(sd, rdst, BSIZE); F_____;
}
@@ -7086,11 +7090,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_45:
{
/** 1111 01sd rdst 0bit btst #%2, %1%S1 */
-#line 959 "rx-decode.opc"
+#line 963 "rx-decode.opc"
int sd AU = op[0] & 0x03;
-#line 959 "rx-decode.opc"
+#line 963 "rx-decode.opc"
int rdst AU = (op[1] >> 4) & 0x0f;
-#line 959 "rx-decode.opc"
+#line 963 "rx-decode.opc"
int bit AU = op[1] & 0x07;
if (trace)
{
@@ -7102,7 +7106,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" bit = 0x%x\n", bit);
}
SYNTAX("btst #%2, %1%S1");
-#line 959 "rx-decode.opc"
+#line 963 "rx-decode.opc"
ID(btst); BWL(BSIZE); S2C(bit); SD(sd, rdst, BSIZE); F___ZC;
}
@@ -7111,11 +7115,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_46:
{
/** 1111 01ss rsrc 10sz push%s %1 */
-#line 377 "rx-decode.opc"
+#line 381 "rx-decode.opc"
int ss AU = op[0] & 0x03;
-#line 377 "rx-decode.opc"
+#line 381 "rx-decode.opc"
int rsrc AU = (op[1] >> 4) & 0x0f;
-#line 377 "rx-decode.opc"
+#line 381 "rx-decode.opc"
int sz AU = op[1] & 0x03;
if (trace)
{
@@ -7127,7 +7131,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" sz = 0x%x\n", sz);
}
SYNTAX("push%s %1");
-#line 377 "rx-decode.opc"
+#line 381 "rx-decode.opc"
ID(mov); BWL(sz); OP(0, RX_Operand_Predec, 0, 0); SD(ss, rsrc, sz); F_____;
/*----------------------------------------------------------------------*/
@@ -7188,13 +7192,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_47:
{
/** 1111 10sd rdst im sz mov%s #%1, %0 */
-#line 288 "rx-decode.opc"
+#line 292 "rx-decode.opc"
int sd AU = op[0] & 0x03;
-#line 288 "rx-decode.opc"
+#line 292 "rx-decode.opc"
int rdst AU = (op[1] >> 4) & 0x0f;
-#line 288 "rx-decode.opc"
+#line 292 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 288 "rx-decode.opc"
+#line 292 "rx-decode.opc"
int sz AU = op[1] & 0x03;
if (trace)
{
@@ -7207,7 +7211,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" sz = 0x%x\n", sz);
}
SYNTAX("mov%s #%1, %0");
-#line 288 "rx-decode.opc"
+#line 292 "rx-decode.opc"
ID(mov); DD(sd, rdst, sz);
if ((im == 1 && sz == 0)
|| (im == 2 && sz == 1)
@@ -7265,9 +7269,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1100 0000 0011 rsrc rdst sbb %1, %0 */
-#line 551 "rx-decode.opc"
+#line 555 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 551 "rx-decode.opc"
+#line 555 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7278,7 +7282,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("sbb %1, %0");
-#line 551 "rx-decode.opc"
+#line 555 "rx-decode.opc"
ID(sbb); SR (rsrc); DR(rdst); F_OSZC;
/* FIXME: only supports .L */
@@ -7293,9 +7297,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1100 0000 0111 rsrc rdst neg %2, %0 */
-#line 482 "rx-decode.opc"
+#line 486 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 482 "rx-decode.opc"
+#line 486 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7306,7 +7310,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("neg %2, %0");
-#line 482 "rx-decode.opc"
+#line 486 "rx-decode.opc"
ID(sub); DR(rdst); SC(0); S2R(rsrc); F_OSZC;
/*----------------------------------------------------------------------*/
@@ -7323,9 +7327,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1100 0000 1011 rsrc rdst adc %1, %0 */
-#line 491 "rx-decode.opc"
+#line 495 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 491 "rx-decode.opc"
+#line 495 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7336,7 +7340,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("adc %1, %0");
-#line 491 "rx-decode.opc"
+#line 495 "rx-decode.opc"
ID(adc); SR(rsrc); DR(rdst); F_OSZC;
}
@@ -7350,9 +7354,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1100 0000 1111 rsrc rdst abs %1, %0 */
-#line 564 "rx-decode.opc"
+#line 568 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 564 "rx-decode.opc"
+#line 568 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7363,7 +7367,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("abs %1, %0");
-#line 564 "rx-decode.opc"
+#line 568 "rx-decode.opc"
ID(abs); DR(rdst); SR(rsrc); F_OSZ_;
/*----------------------------------------------------------------------*/
@@ -7381,11 +7385,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_48:
{
/** 1111 1100 0001 00ss rsrc rdst max %1%S1, %0 */
-#line 583 "rx-decode.opc"
+#line 587 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 583 "rx-decode.opc"
+#line 587 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 583 "rx-decode.opc"
+#line 587 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7397,7 +7401,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("max %1%S1, %0");
-#line 583 "rx-decode.opc"
+#line 587 "rx-decode.opc"
if (ss == 3 && rsrc == 0 && rdst == 0)
{
ID(nop3);
@@ -7447,11 +7451,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_49:
{
/** 1111 1100 0001 01ss rsrc rdst min %1%S1, %0 */
-#line 603 "rx-decode.opc"
+#line 607 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 603 "rx-decode.opc"
+#line 607 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 603 "rx-decode.opc"
+#line 607 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7463,7 +7467,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("min %1%S1, %0");
-#line 603 "rx-decode.opc"
+#line 607 "rx-decode.opc"
ID(min); SP(ss, rsrc); DR(rdst);
}
@@ -7505,11 +7509,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_50:
{
/** 1111 1100 0001 10ss rsrc rdst emul %1%S1, %0 */
-#line 661 "rx-decode.opc"
+#line 665 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 661 "rx-decode.opc"
+#line 665 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 661 "rx-decode.opc"
+#line 665 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7521,7 +7525,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("emul %1%S1, %0");
-#line 661 "rx-decode.opc"
+#line 665 "rx-decode.opc"
ID(emul); SP(ss, rsrc); DR(rdst);
}
@@ -7563,11 +7567,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_51:
{
/** 1111 1100 0001 11ss rsrc rdst emulu %1%S1, %0 */
-#line 673 "rx-decode.opc"
+#line 677 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 673 "rx-decode.opc"
+#line 677 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 673 "rx-decode.opc"
+#line 677 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7579,7 +7583,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("emulu %1%S1, %0");
-#line 673 "rx-decode.opc"
+#line 677 "rx-decode.opc"
ID(emulu); SP(ss, rsrc); DR(rdst);
}
@@ -7621,11 +7625,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_52:
{
/** 1111 1100 0010 00ss rsrc rdst div %1%S1, %0 */
-#line 685 "rx-decode.opc"
+#line 689 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 685 "rx-decode.opc"
+#line 689 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 685 "rx-decode.opc"
+#line 689 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7637,7 +7641,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("div %1%S1, %0");
-#line 685 "rx-decode.opc"
+#line 689 "rx-decode.opc"
ID(div); SP(ss, rsrc); DR(rdst); F_O___;
}
@@ -7679,11 +7683,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_53:
{
/** 1111 1100 0010 01ss rsrc rdst divu %1%S1, %0 */
-#line 697 "rx-decode.opc"
+#line 701 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 697 "rx-decode.opc"
+#line 701 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 697 "rx-decode.opc"
+#line 701 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7695,7 +7699,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("divu %1%S1, %0");
-#line 697 "rx-decode.opc"
+#line 701 "rx-decode.opc"
ID(divu); SP(ss, rsrc); DR(rdst); F_O___;
}
@@ -7737,11 +7741,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_54:
{
/** 1111 1100 0011 00ss rsrc rdst tst %1%S1, %2 */
-#line 470 "rx-decode.opc"
+#line 474 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 470 "rx-decode.opc"
+#line 474 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 470 "rx-decode.opc"
+#line 474 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7753,7 +7757,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("tst %1%S1, %2");
-#line 470 "rx-decode.opc"
+#line 474 "rx-decode.opc"
ID(and); SP(ss, rsrc); S2R(rdst); F__SZ_;
}
@@ -7795,11 +7799,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_55:
{
/** 1111 1100 0011 01ss rsrc rdst xor %1%S1, %0 */
-#line 449 "rx-decode.opc"
+#line 453 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 449 "rx-decode.opc"
+#line 453 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 449 "rx-decode.opc"
+#line 453 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7811,7 +7815,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("xor %1%S1, %0");
-#line 449 "rx-decode.opc"
+#line 453 "rx-decode.opc"
ID(xor); SP(ss, rsrc); DR(rdst); F__SZ_;
}
@@ -7852,9 +7856,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1100 0011 1011 rsrc rdst not %1, %0 */
-#line 461 "rx-decode.opc"
+#line 465 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 461 "rx-decode.opc"
+#line 465 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7865,7 +7869,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("not %1, %0");
-#line 461 "rx-decode.opc"
+#line 465 "rx-decode.opc"
ID(xor); DR(rdst); SR(rsrc); S2C(~0); F__SZ_;
/*----------------------------------------------------------------------*/
@@ -7883,11 +7887,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_56:
{
/** 1111 1100 0100 00ss rsrc rdst xchg %1%S1, %0 */
-#line 383 "rx-decode.opc"
+#line 387 "rx-decode.opc"
int ss AU = op[1] & 0x03;
-#line 383 "rx-decode.opc"
+#line 387 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 383 "rx-decode.opc"
+#line 387 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7899,7 +7903,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("xchg %1%S1, %0");
-#line 383 "rx-decode.opc"
+#line 387 "rx-decode.opc"
ID(xchg); DR(rdst); SP(ss, rsrc);
}
@@ -7941,11 +7945,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_57:
{
/** 1111 1100 0100 01sd rsrc rdst itof %1%S1, %0 */
-#line 926 "rx-decode.opc"
+#line 930 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 926 "rx-decode.opc"
+#line 930 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 926 "rx-decode.opc"
+#line 930 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -7957,7 +7961,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("itof %1%S1, %0");
-#line 926 "rx-decode.opc"
+#line 930 "rx-decode.opc"
ID(itof); DR (rdst); SP(sd, rsrc); F__SZ_;
}
@@ -7998,9 +8002,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1100 0100 1011 rsrc rdst stz %1, %0 */
-#line 1052 "rx-decode.opc"
+#line 1056 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 1052 "rx-decode.opc"
+#line 1056 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8011,7 +8015,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("stz %1, %0");
-#line 1052 "rx-decode.opc"
+#line 1056 "rx-decode.opc"
ID(stcc); SR(rsrc); DR(rdst); S2cc(RXC_z);
}
@@ -8025,9 +8029,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1100 0100 1111 rsrc rdst stnz %1, %0 */
-#line 1055 "rx-decode.opc"
+#line 1059 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 1055 "rx-decode.opc"
+#line 1059 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8038,7 +8042,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("stnz %1, %0");
-#line 1055 "rx-decode.opc"
+#line 1059 "rx-decode.opc"
ID(stcc); SR(rsrc); DR(rdst); S2cc(RXC_nz);
}
@@ -8053,11 +8057,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_58:
{
/** 1111 1100 0101 01sd rsrc rdst utof %1%S1, %0 */
-#line 1112 "rx-decode.opc"
+#line 1116 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 1112 "rx-decode.opc"
+#line 1116 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 1112 "rx-decode.opc"
+#line 1116 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8069,7 +8073,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("utof %1%S1, %0");
-#line 1112 "rx-decode.opc"
+#line 1116 "rx-decode.opc"
ID(utof); DR (rdst); SP(sd, rsrc); F__SZ_;
}
@@ -8111,11 +8115,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_59:
{
/** 1111 1100 0110 00sd rdst rsrc bset %1, %0%S0 */
-#line 938 "rx-decode.opc"
+#line 942 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 938 "rx-decode.opc"
+#line 942 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
-#line 938 "rx-decode.opc"
+#line 942 "rx-decode.opc"
int rsrc AU = op[2] & 0x0f;
if (trace)
{
@@ -8127,7 +8131,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("bset %1, %0%S0");
-#line 938 "rx-decode.opc"
+#line 942 "rx-decode.opc"
ID(bset); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE); F_____;
if (sd == 3) /* bset reg,reg */
BWL(LSIZE);
@@ -8171,11 +8175,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_60:
{
/** 1111 1100 0110 01sd rdst rsrc bclr %1, %0%S0 */
-#line 950 "rx-decode.opc"
+#line 954 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 950 "rx-decode.opc"
+#line 954 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
-#line 950 "rx-decode.opc"
+#line 954 "rx-decode.opc"
int rsrc AU = op[2] & 0x0f;
if (trace)
{
@@ -8187,7 +8191,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("bclr %1, %0%S0");
-#line 950 "rx-decode.opc"
+#line 954 "rx-decode.opc"
ID(bclr); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE); F_____;
if (sd == 3) /* bset reg,reg */
BWL(LSIZE);
@@ -8231,11 +8235,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_61:
{
/** 1111 1100 0110 10sd rdst rsrc btst %2, %1%S1 */
-#line 962 "rx-decode.opc"
+#line 966 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 962 "rx-decode.opc"
+#line 966 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
-#line 962 "rx-decode.opc"
+#line 966 "rx-decode.opc"
int rsrc AU = op[2] & 0x0f;
if (trace)
{
@@ -8247,7 +8251,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("btst %2, %1%S1");
-#line 962 "rx-decode.opc"
+#line 966 "rx-decode.opc"
ID(btst); BWL(BSIZE); S2R(rsrc); SD(sd, rdst, BSIZE); F___ZC;
if (sd == 3) /* bset reg,reg */
BWL(LSIZE);
@@ -8291,11 +8295,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_62:
{
/** 1111 1100 0110 11sd rdst rsrc bnot %1, %0%S0 */
-#line 974 "rx-decode.opc"
+#line 978 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 974 "rx-decode.opc"
+#line 978 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
-#line 974 "rx-decode.opc"
+#line 978 "rx-decode.opc"
int rsrc AU = op[2] & 0x0f;
if (trace)
{
@@ -8307,7 +8311,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("bnot %1, %0%S0");
-#line 974 "rx-decode.opc"
+#line 978 "rx-decode.opc"
ID(bnot); BWL(BSIZE); SR(rsrc); DD(sd, rdst, BSIZE);
if (sd == 3) /* bset reg,reg */
BWL(LSIZE);
@@ -8351,11 +8355,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_63:
{
/** 1111 1100 1000 00sd rsrc rdst fsub %1%S1, %0 */
-#line 905 "rx-decode.opc"
+#line 909 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 905 "rx-decode.opc"
+#line 909 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 905 "rx-decode.opc"
+#line 909 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8367,7 +8371,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fsub %1%S1, %0");
-#line 905 "rx-decode.opc"
+#line 909 "rx-decode.opc"
ID(fsub); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_;
}
@@ -8409,11 +8413,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_64:
{
/** 1111 1100 1000 01sd rsrc rdst fcmp %1%S1, %0 */
-#line 899 "rx-decode.opc"
+#line 903 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 899 "rx-decode.opc"
+#line 903 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 899 "rx-decode.opc"
+#line 903 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8425,7 +8429,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fcmp %1%S1, %0");
-#line 899 "rx-decode.opc"
+#line 903 "rx-decode.opc"
ID(fcmp); DR(rdst); SD(sd, rsrc, LSIZE); F_OSZ_;
}
@@ -8467,11 +8471,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_65:
{
/** 1111 1100 1000 10sd rsrc rdst fadd %1%S1, %0 */
-#line 893 "rx-decode.opc"
+#line 897 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 893 "rx-decode.opc"
+#line 897 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 893 "rx-decode.opc"
+#line 897 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8483,7 +8487,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fadd %1%S1, %0");
-#line 893 "rx-decode.opc"
+#line 897 "rx-decode.opc"
ID(fadd); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_;
}
@@ -8525,11 +8529,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_66:
{
/** 1111 1100 1000 11sd rsrc rdst fmul %1%S1, %0 */
-#line 914 "rx-decode.opc"
+#line 918 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 914 "rx-decode.opc"
+#line 918 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 914 "rx-decode.opc"
+#line 918 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8541,7 +8545,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fmul %1%S1, %0");
-#line 914 "rx-decode.opc"
+#line 918 "rx-decode.opc"
ID(fmul); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_;
}
@@ -8583,11 +8587,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_67:
{
/** 1111 1100 1001 00sd rsrc rdst fdiv %1%S1, %0 */
-#line 920 "rx-decode.opc"
+#line 924 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 920 "rx-decode.opc"
+#line 924 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 920 "rx-decode.opc"
+#line 924 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8599,7 +8603,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fdiv %1%S1, %0");
-#line 920 "rx-decode.opc"
+#line 924 "rx-decode.opc"
ID(fdiv); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_;
}
@@ -8641,11 +8645,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_68:
{
/** 1111 1100 1001 01sd rsrc rdst ftoi %1%S1, %0 */
-#line 908 "rx-decode.opc"
+#line 912 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 908 "rx-decode.opc"
+#line 912 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 908 "rx-decode.opc"
+#line 912 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8657,7 +8661,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("ftoi %1%S1, %0");
-#line 908 "rx-decode.opc"
+#line 912 "rx-decode.opc"
ID(ftoi); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_;
}
@@ -8699,11 +8703,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_69:
{
/** 1111 1100 1001 10sd rsrc rdst round %1%S1, %0 */
-#line 923 "rx-decode.opc"
+#line 927 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 923 "rx-decode.opc"
+#line 927 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 923 "rx-decode.opc"
+#line 927 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8715,7 +8719,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("round %1%S1, %0");
-#line 923 "rx-decode.opc"
+#line 927 "rx-decode.opc"
ID(round); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_;
}
@@ -8757,11 +8761,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_70:
{
/** 1111 1100 1010 00sd rsrc rdst fsqrt %1%S1, %0 */
-#line 1106 "rx-decode.opc"
+#line 1110 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 1106 "rx-decode.opc"
+#line 1110 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 1106 "rx-decode.opc"
+#line 1110 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8773,7 +8777,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fsqrt %1%S1, %0");
-#line 1106 "rx-decode.opc"
+#line 1110 "rx-decode.opc"
ID(fsqrt); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_;
}
@@ -8815,11 +8819,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_71:
{
/** 1111 1100 1010 01sd rsrc rdst ftou %1%S1, %0 */
-#line 1109 "rx-decode.opc"
+#line 1113 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 1109 "rx-decode.opc"
+#line 1113 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 1109 "rx-decode.opc"
+#line 1113 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -8831,7 +8835,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("ftou %1%S1, %0");
-#line 1109 "rx-decode.opc"
+#line 1113 "rx-decode.opc"
ID(ftou); DR(rdst); SD(sd, rsrc, LSIZE); F__SZ_;
}
@@ -8873,13 +8877,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_72:
{
/** 1111 1100 1101 sz sd rdst cond sc%1%s %0 */
-#line 1040 "rx-decode.opc"
+#line 1044 "rx-decode.opc"
int sz AU = (op[1] >> 2) & 0x03;
-#line 1040 "rx-decode.opc"
+#line 1044 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 1040 "rx-decode.opc"
+#line 1044 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
-#line 1040 "rx-decode.opc"
+#line 1044 "rx-decode.opc"
int cond AU = op[2] & 0x0f;
if (trace)
{
@@ -8892,7 +8896,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" cond = 0x%x\n", cond);
}
SYNTAX("sc%1%s %0");
-#line 1040 "rx-decode.opc"
+#line 1044 "rx-decode.opc"
ID(sccnd); BWL(sz); DD (sd, rdst, sz); Scc(cond);
/*----------------------------------------------------------------------*/
@@ -9023,13 +9027,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_73:
{
/** 1111 1100 111bit sd rdst cond bm%2 #%1, %0%S0 */
-#line 983 "rx-decode.opc"
+#line 987 "rx-decode.opc"
int bit AU = (op[1] >> 2) & 0x07;
-#line 983 "rx-decode.opc"
+#line 987 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 983 "rx-decode.opc"
+#line 987 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
-#line 983 "rx-decode.opc"
+#line 987 "rx-decode.opc"
int cond AU = op[2] & 0x0f;
if (trace)
{
@@ -9042,7 +9046,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" cond = 0x%x\n", cond);
}
SYNTAX("bm%2 #%1, %0%S0");
-#line 983 "rx-decode.opc"
+#line 987 "rx-decode.opc"
ID(bmcc); BWL(BSIZE); S2cc(cond); SC(bit); DD(sd, rdst, BSIZE);
}
@@ -9051,11 +9055,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_74:
{
/** 1111 1100 111bit sd rdst 1111 bnot #%1, %0%S0 */
-#line 971 "rx-decode.opc"
+#line 975 "rx-decode.opc"
int bit AU = (op[1] >> 2) & 0x07;
-#line 971 "rx-decode.opc"
+#line 975 "rx-decode.opc"
int sd AU = op[1] & 0x03;
-#line 971 "rx-decode.opc"
+#line 975 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
if (trace)
{
@@ -9067,7 +9071,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("bnot #%1, %0%S0");
-#line 971 "rx-decode.opc"
+#line 975 "rx-decode.opc"
ID(bnot); BWL(BSIZE); SC(bit); DD(sd, rdst, BSIZE);
}
@@ -9895,11 +9899,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_75:
{
/** 1111 1101 0000 a000 srca srcb mulhi %1, %2, %0 */
-#line 848 "rx-decode.opc"
+#line 852 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 848 "rx-decode.opc"
+#line 852 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 848 "rx-decode.opc"
+#line 852 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -9911,7 +9915,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("mulhi %1, %2, %0");
-#line 848 "rx-decode.opc"
+#line 852 "rx-decode.opc"
ID(mulhi); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -9926,11 +9930,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_76:
{
/** 1111 1101 0000 a001 srca srcb mullo %1, %2, %0 */
-#line 851 "rx-decode.opc"
+#line 855 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 851 "rx-decode.opc"
+#line 855 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 851 "rx-decode.opc"
+#line 855 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -9942,7 +9946,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("mullo %1, %2, %0");
-#line 851 "rx-decode.opc"
+#line 855 "rx-decode.opc"
ID(mullo); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -9957,11 +9961,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_77:
{
/** 1111 1101 0000 a010 srca srcb mullh %1, %2, %0 */
-#line 1079 "rx-decode.opc"
+#line 1083 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 1079 "rx-decode.opc"
+#line 1083 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1079 "rx-decode.opc"
+#line 1083 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -9973,7 +9977,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("mullh %1, %2, %0");
-#line 1079 "rx-decode.opc"
+#line 1083 "rx-decode.opc"
ID(mullh); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -9988,11 +9992,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_78:
{
/** 1111 1101 0000 a011 srca srcb emula %1, %2, %0 */
-#line 1064 "rx-decode.opc"
+#line 1068 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 1064 "rx-decode.opc"
+#line 1068 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1064 "rx-decode.opc"
+#line 1068 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10004,7 +10008,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("emula %1, %2, %0");
-#line 1064 "rx-decode.opc"
+#line 1068 "rx-decode.opc"
ID(emula); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10019,11 +10023,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_79:
{
/** 1111 1101 0000 a100 srca srcb machi %1, %2, %0 */
-#line 854 "rx-decode.opc"
+#line 858 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 854 "rx-decode.opc"
+#line 858 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 854 "rx-decode.opc"
+#line 858 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10035,7 +10039,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("machi %1, %2, %0");
-#line 854 "rx-decode.opc"
+#line 858 "rx-decode.opc"
ID(machi); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10050,11 +10054,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_80:
{
/** 1111 1101 0000 a101 srca srcb maclo %1, %2, %0 */
-#line 857 "rx-decode.opc"
+#line 861 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 857 "rx-decode.opc"
+#line 861 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 857 "rx-decode.opc"
+#line 861 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10066,7 +10070,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("maclo %1, %2, %0");
-#line 857 "rx-decode.opc"
+#line 861 "rx-decode.opc"
ID(maclo); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10081,11 +10085,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_81:
{
/** 1111 1101 0000 a110 srca srcb maclh %1, %2, %0 */
-#line 1067 "rx-decode.opc"
+#line 1071 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 1067 "rx-decode.opc"
+#line 1071 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1067 "rx-decode.opc"
+#line 1071 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10097,7 +10101,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("maclh %1, %2, %0");
-#line 1067 "rx-decode.opc"
+#line 1071 "rx-decode.opc"
ID(maclh); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10112,11 +10116,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_82:
{
/** 1111 1101 0000 a111 srca srcb emaca %1, %2, %0 */
-#line 1058 "rx-decode.opc"
+#line 1062 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 1058 "rx-decode.opc"
+#line 1062 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1058 "rx-decode.opc"
+#line 1062 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10128,7 +10132,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("emaca %1, %2, %0");
-#line 1058 "rx-decode.opc"
+#line 1062 "rx-decode.opc"
ID(emaca); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10214,9 +10218,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0001 0111 a000 rsrc mvtachi %1, %0 */
-#line 860 "rx-decode.opc"
+#line 864 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 860 "rx-decode.opc"
+#line 864 "rx-decode.opc"
int rsrc AU = op[2] & 0x0f;
if (trace)
{
@@ -10227,7 +10231,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("mvtachi %1, %0");
-#line 860 "rx-decode.opc"
+#line 864 "rx-decode.opc"
ID(mvtachi); DR(a+32); SR(rsrc); F_____;
}
@@ -10235,9 +10239,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x10:
{
/** 1111 1101 0001 0111 a001 rsrc mvtaclo %1, %0 */
-#line 863 "rx-decode.opc"
+#line 867 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 863 "rx-decode.opc"
+#line 867 "rx-decode.opc"
int rsrc AU = op[2] & 0x0f;
if (trace)
{
@@ -10248,7 +10252,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("mvtaclo %1, %0");
-#line 863 "rx-decode.opc"
+#line 867 "rx-decode.opc"
ID(mvtaclo); DR(a+32); SR(rsrc); F_____;
}
@@ -10256,9 +10260,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x30:
{
/** 1111 1101 0001 0111 a011 rdst mvtacgu %0, %1 */
-#line 1085 "rx-decode.opc"
+#line 1089 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 1085 "rx-decode.opc"
+#line 1089 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10269,7 +10273,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mvtacgu %0, %1");
-#line 1085 "rx-decode.opc"
+#line 1089 "rx-decode.opc"
ID(mvtacgu); DR(a+32); SR(rdst); F_____;
}
@@ -10284,9 +10288,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0001 1000 a00i 0000 racw #%1, %0 */
-#line 875 "rx-decode.opc"
+#line 879 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 875 "rx-decode.opc"
+#line 879 "rx-decode.opc"
int i AU = (op[2] >> 4) & 0x01;
if (trace)
{
@@ -10297,7 +10301,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" i = 0x%x\n", i);
}
SYNTAX("racw #%1, %0");
-#line 875 "rx-decode.opc"
+#line 879 "rx-decode.opc"
ID(racw); SC(i+1); DR(a+32); F_____;
/*----------------------------------------------------------------------*/
@@ -10308,9 +10312,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x40:
{
/** 1111 1101 0001 1000 a10i 0000 rdacw #%1, %0 */
-#line 1094 "rx-decode.opc"
+#line 1098 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 1094 "rx-decode.opc"
+#line 1098 "rx-decode.opc"
int i AU = (op[2] >> 4) & 0x01;
if (trace)
{
@@ -10321,7 +10325,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" i = 0x%x\n", i);
}
SYNTAX("rdacw #%1, %0");
-#line 1094 "rx-decode.opc"
+#line 1098 "rx-decode.opc"
ID(rdacw); SC(i+1); DR(a+32); F_____;
}
@@ -10336,9 +10340,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0001 1001 a00i 0000 racl #%1, %0 */
-#line 1088 "rx-decode.opc"
+#line 1092 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 1088 "rx-decode.opc"
+#line 1092 "rx-decode.opc"
int i AU = (op[2] >> 4) & 0x01;
if (trace)
{
@@ -10349,7 +10353,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" i = 0x%x\n", i);
}
SYNTAX("racl #%1, %0");
-#line 1088 "rx-decode.opc"
+#line 1092 "rx-decode.opc"
ID(racl); SC(i+1); DR(a+32); F_____;
}
@@ -10357,9 +10361,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x40:
{
/** 1111 1101 0001 1001 a10i 0000 rdacl #%1, %0 */
-#line 1091 "rx-decode.opc"
+#line 1095 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 1091 "rx-decode.opc"
+#line 1095 "rx-decode.opc"
int i AU = (op[2] >> 4) & 0x01;
if (trace)
{
@@ -10370,7 +10374,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" i = 0x%x\n", i);
}
SYNTAX("rdacl #%1, %0");
-#line 1091 "rx-decode.opc"
+#line 1095 "rx-decode.opc"
ID(rdacl); SC(i+1); DR(a+32); F_____;
}
@@ -10386,13 +10390,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_83:
{
/** 1111 1101 0001 111i a m00 rdst mvfachi #%2, %1, %0 */
-#line 866 "rx-decode.opc"
+#line 870 "rx-decode.opc"
int i AU = op[1] & 0x01;
-#line 866 "rx-decode.opc"
+#line 870 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 866 "rx-decode.opc"
+#line 870 "rx-decode.opc"
int m AU = (op[2] >> 6) & 0x01;
-#line 866 "rx-decode.opc"
+#line 870 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10405,7 +10409,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mvfachi #%2, %1, %0");
-#line 866 "rx-decode.opc"
+#line 870 "rx-decode.opc"
ID(mvfachi); S2C(((i^1)<<1)|m); SR(a+32); DR(rdst); F_____;
}
@@ -10414,13 +10418,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_84:
{
/** 1111 1101 0001 111i a m01 rdst mvfaclo #%2, %1, %0 */
-#line 872 "rx-decode.opc"
+#line 876 "rx-decode.opc"
int i AU = op[1] & 0x01;
-#line 872 "rx-decode.opc"
+#line 876 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 872 "rx-decode.opc"
+#line 876 "rx-decode.opc"
int m AU = (op[2] >> 6) & 0x01;
-#line 872 "rx-decode.opc"
+#line 876 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10433,7 +10437,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mvfaclo #%2, %1, %0");
-#line 872 "rx-decode.opc"
+#line 876 "rx-decode.opc"
ID(mvfaclo); S2C(((i^1)<<1)|m); SR(a+32); DR(rdst); F_____;
}
@@ -10442,13 +10446,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_85:
{
/** 1111 1101 0001 111i a m10 rdst mvfacmi #%2, %1, %0 */
-#line 869 "rx-decode.opc"
+#line 873 "rx-decode.opc"
int i AU = op[1] & 0x01;
-#line 869 "rx-decode.opc"
+#line 873 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 869 "rx-decode.opc"
+#line 873 "rx-decode.opc"
int m AU = (op[2] >> 6) & 0x01;
-#line 869 "rx-decode.opc"
+#line 873 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10461,7 +10465,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mvfacmi #%2, %1, %0");
-#line 869 "rx-decode.opc"
+#line 873 "rx-decode.opc"
ID(mvfacmi); S2C(((i^1)<<1)|m); SR(a+32); DR(rdst); F_____;
}
@@ -10470,13 +10474,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_86:
{
/** 1111 1101 0001 111i a m11 rdst mvfacgu #%2, %1, %0 */
-#line 1082 "rx-decode.opc"
+#line 1086 "rx-decode.opc"
int i AU = op[1] & 0x01;
-#line 1082 "rx-decode.opc"
+#line 1086 "rx-decode.opc"
int a AU = (op[2] >> 7) & 0x01;
-#line 1082 "rx-decode.opc"
+#line 1086 "rx-decode.opc"
int m AU = (op[2] >> 6) & 0x01;
-#line 1082 "rx-decode.opc"
+#line 1086 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10489,7 +10493,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mvfacgu #%2, %1, %0");
-#line 1082 "rx-decode.opc"
+#line 1086 "rx-decode.opc"
ID(mvfacgu); S2C(((i^1)<<1)|m); SR(a+32); DR(rdst); F_____;
}
@@ -10522,13 +10526,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_87:
{
/** 1111 1101 0010 0p sz rdst rsrc mov%s %1, %0 */
-#line 344 "rx-decode.opc"
+#line 348 "rx-decode.opc"
int p AU = (op[1] >> 2) & 0x01;
-#line 344 "rx-decode.opc"
+#line 348 "rx-decode.opc"
int sz AU = op[1] & 0x03;
-#line 344 "rx-decode.opc"
+#line 348 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
-#line 344 "rx-decode.opc"
+#line 348 "rx-decode.opc"
int rsrc AU = op[2] & 0x0f;
if (trace)
{
@@ -10541,7 +10545,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("mov%s %1, %0");
-#line 344 "rx-decode.opc"
+#line 348 "rx-decode.opc"
ID(mov); sBWL (sz); SR(rsrc); F_____;
OP(0, p ? RX_Operand_Predec : RX_Operand_Postinc, rdst, 0);
@@ -10601,9 +10605,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0010 0111 rdst rsrc movco %1, [%0] */
-#line 1046 "rx-decode.opc"
+#line 1050 "rx-decode.opc"
int rdst AU = (op[2] >> 4) & 0x0f;
-#line 1046 "rx-decode.opc"
+#line 1050 "rx-decode.opc"
int rsrc AU = op[2] & 0x0f;
if (trace)
{
@@ -10614,7 +10618,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rsrc = 0x%x\n", rsrc);
}
SYNTAX("movco %1, [%0]");
-#line 1046 "rx-decode.opc"
+#line 1050 "rx-decode.opc"
ID(movco); SR(rsrc); DR(rdst); F_____;
}
@@ -10629,13 +10633,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_88:
{
/** 1111 1101 0010 1p sz rsrc rdst mov%s %1, %0 */
-#line 348 "rx-decode.opc"
+#line 352 "rx-decode.opc"
int p AU = (op[1] >> 2) & 0x01;
-#line 348 "rx-decode.opc"
+#line 352 "rx-decode.opc"
int sz AU = op[1] & 0x03;
-#line 348 "rx-decode.opc"
+#line 352 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 348 "rx-decode.opc"
+#line 352 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10648,7 +10652,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mov%s %1, %0");
-#line 348 "rx-decode.opc"
+#line 352 "rx-decode.opc"
ID(mov); sBWL (sz); DR(rdst); F_____;
OP(1, p ? RX_Operand_Predec : RX_Operand_Postinc, rsrc, 0);
@@ -10708,9 +10712,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0010 1111 rsrc rdst movli [%1], %0 */
-#line 1049 "rx-decode.opc"
+#line 1053 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 1049 "rx-decode.opc"
+#line 1053 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10721,7 +10725,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("movli [%1], %0");
-#line 1049 "rx-decode.opc"
+#line 1053 "rx-decode.opc"
ID(movli); SR(rsrc); DR(rdst); F_____;
}
@@ -10736,13 +10740,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_89:
{
/** 1111 1101 0011 1p sz rsrc rdst movu%s %1, %0 */
-#line 358 "rx-decode.opc"
+#line 362 "rx-decode.opc"
int p AU = (op[1] >> 2) & 0x01;
-#line 358 "rx-decode.opc"
+#line 362 "rx-decode.opc"
int sz AU = op[1] & 0x03;
-#line 358 "rx-decode.opc"
+#line 362 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 358 "rx-decode.opc"
+#line 362 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10755,7 +10759,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("movu%s %1, %0");
-#line 358 "rx-decode.opc"
+#line 362 "rx-decode.opc"
ID(mov); uBW (sz); DR(rdst); F_____;
OP(1, p ? RX_Operand_Predec : RX_Operand_Postinc, rsrc, 0);
@@ -10819,11 +10823,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_90:
{
/** 1111 1101 0100 a100 srca srcb msbhi %1, %2, %0 */
-#line 1070 "rx-decode.opc"
+#line 1074 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 1070 "rx-decode.opc"
+#line 1074 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1070 "rx-decode.opc"
+#line 1074 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10835,7 +10839,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("msbhi %1, %2, %0");
-#line 1070 "rx-decode.opc"
+#line 1074 "rx-decode.opc"
ID(msbhi); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10850,11 +10854,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_91:
{
/** 1111 1101 0100 a101 srca srcb msblo %1, %2, %0 */
-#line 1076 "rx-decode.opc"
+#line 1080 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 1076 "rx-decode.opc"
+#line 1080 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1076 "rx-decode.opc"
+#line 1080 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10866,7 +10870,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("msblo %1, %2, %0");
-#line 1076 "rx-decode.opc"
+#line 1080 "rx-decode.opc"
ID(msblo); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10881,11 +10885,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_92:
{
/** 1111 1101 0100 a110 srca srcb msblh %1, %2, %0 */
-#line 1073 "rx-decode.opc"
+#line 1077 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 1073 "rx-decode.opc"
+#line 1077 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1073 "rx-decode.opc"
+#line 1077 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10897,7 +10901,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("msblh %1, %2, %0");
-#line 1073 "rx-decode.opc"
+#line 1077 "rx-decode.opc"
ID(msblh); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10912,11 +10916,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_93:
{
/** 1111 1101 0100 a111 srca srcb emsba %1, %2, %0 */
-#line 1061 "rx-decode.opc"
+#line 1065 "rx-decode.opc"
int a AU = (op[1] >> 3) & 0x01;
-#line 1061 "rx-decode.opc"
+#line 1065 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1061 "rx-decode.opc"
+#line 1065 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -10928,7 +10932,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("emsba %1, %2, %0");
-#line 1061 "rx-decode.opc"
+#line 1065 "rx-decode.opc"
ID(emsba); DR(a+32); SR(srca); S2R(srcb); F_____;
}
@@ -10978,9 +10982,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0110 0000 rsrc rdst shlr %2, %0 */
-#line 729 "rx-decode.opc"
+#line 733 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 729 "rx-decode.opc"
+#line 733 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -10991,7 +10995,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shlr %2, %0");
-#line 729 "rx-decode.opc"
+#line 733 "rx-decode.opc"
ID(shlr); S2R(rsrc); SR(rdst); DR(rdst); F__SZC;
}
@@ -11005,9 +11009,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0110 0001 rsrc rdst shar %2, %0 */
-#line 719 "rx-decode.opc"
+#line 723 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 719 "rx-decode.opc"
+#line 723 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11018,7 +11022,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shar %2, %0");
-#line 719 "rx-decode.opc"
+#line 723 "rx-decode.opc"
ID(shar); S2R(rsrc); SR(rdst); DR(rdst); F_0SZC;
}
@@ -11032,9 +11036,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0110 0010 rsrc rdst shll %2, %0 */
-#line 709 "rx-decode.opc"
+#line 713 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 709 "rx-decode.opc"
+#line 713 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11045,7 +11049,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shll %2, %0");
-#line 709 "rx-decode.opc"
+#line 713 "rx-decode.opc"
ID(shll); S2R(rsrc); SR(rdst); DR(rdst); F_OSZC;
}
@@ -11059,9 +11063,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0110 0100 rsrc rdst rotr %1, %0 */
-#line 753 "rx-decode.opc"
+#line 757 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 753 "rx-decode.opc"
+#line 757 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11072,7 +11076,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("rotr %1, %0");
-#line 753 "rx-decode.opc"
+#line 757 "rx-decode.opc"
ID(rotr); SR(rsrc); DR(rdst); F__SZC;
}
@@ -11086,9 +11090,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0110 0101 rsrc rdst revw %1, %0 */
-#line 756 "rx-decode.opc"
+#line 760 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 756 "rx-decode.opc"
+#line 760 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11099,7 +11103,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("revw %1, %0");
-#line 756 "rx-decode.opc"
+#line 760 "rx-decode.opc"
ID(revw); SR(rsrc); DR(rdst);
}
@@ -11113,9 +11117,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0110 0110 rsrc rdst rotl %1, %0 */
-#line 747 "rx-decode.opc"
+#line 751 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 747 "rx-decode.opc"
+#line 751 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11126,7 +11130,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("rotl %1, %0");
-#line 747 "rx-decode.opc"
+#line 751 "rx-decode.opc"
ID(rotl); SR(rsrc); DR(rdst); F__SZC;
}
@@ -11140,9 +11144,9 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0110 0111 rsrc rdst revl %1, %0 */
-#line 759 "rx-decode.opc"
+#line 763 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 759 "rx-decode.opc"
+#line 763 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11153,7 +11157,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("revl %1, %0");
-#line 759 "rx-decode.opc"
+#line 763 "rx-decode.opc"
ID(revl); SR(rsrc); DR(rdst);
/*----------------------------------------------------------------------*/
@@ -11171,11 +11175,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_94:
{
/** 1111 1101 0110 100c rsrc rdst mvtc %1, %0 */
-#line 1010 "rx-decode.opc"
+#line 1014 "rx-decode.opc"
int c AU = op[1] & 0x01;
-#line 1010 "rx-decode.opc"
+#line 1014 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 1010 "rx-decode.opc"
+#line 1014 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11187,7 +11191,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mvtc %1, %0");
-#line 1010 "rx-decode.opc"
+#line 1014 "rx-decode.opc"
ID(mov); SR(rsrc); DR(c*16+rdst + 16);
}
@@ -11211,11 +11215,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_95:
{
/** 1111 1101 0110 101s rsrc rdst mvfc %1, %0 */
-#line 1013 "rx-decode.opc"
+#line 1017 "rx-decode.opc"
int s AU = op[1] & 0x01;
-#line 1013 "rx-decode.opc"
+#line 1017 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 1013 "rx-decode.opc"
+#line 1017 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11227,7 +11231,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mvfc %1, %0");
-#line 1013 "rx-decode.opc"
+#line 1017 "rx-decode.opc"
ID(mov); SR((s*16+rsrc) + 16); DR(rdst);
/*----------------------------------------------------------------------*/
@@ -11254,11 +11258,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_96:
{
/** 1111 1101 0110 110i mmmm rdst rotr #%1, %0 */
-#line 750 "rx-decode.opc"
+#line 754 "rx-decode.opc"
int i AU = op[1] & 0x01;
-#line 750 "rx-decode.opc"
+#line 754 "rx-decode.opc"
int mmmm AU = (op[2] >> 4) & 0x0f;
-#line 750 "rx-decode.opc"
+#line 754 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11270,7 +11274,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("rotr #%1, %0");
-#line 750 "rx-decode.opc"
+#line 754 "rx-decode.opc"
ID(rotr); SC(i*16+mmmm); DR(rdst); F__SZC;
}
@@ -11294,11 +11298,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_97:
{
/** 1111 1101 0110 111i mmmm rdst rotl #%1, %0 */
-#line 744 "rx-decode.opc"
+#line 748 "rx-decode.opc"
int i AU = op[1] & 0x01;
-#line 744 "rx-decode.opc"
+#line 748 "rx-decode.opc"
int mmmm AU = (op[2] >> 4) & 0x0f;
-#line 744 "rx-decode.opc"
+#line 748 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11310,7 +11314,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("rotl #%1, %0");
-#line 744 "rx-decode.opc"
+#line 748 "rx-decode.opc"
ID(rotl); SC(i*16+mmmm); DR(rdst); F__SZC;
}
@@ -11334,9 +11338,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_98:
{
/** 1111 1101 0111 im00 0010rdst adc #%1, %0 */
-#line 488 "rx-decode.opc"
+#line 492 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 488 "rx-decode.opc"
+#line 492 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11347,7 +11351,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("adc #%1, %0");
-#line 488 "rx-decode.opc"
+#line 492 "rx-decode.opc"
ID(adc); SC(IMMex(im)); DR(rdst); F_OSZC;
}
@@ -11356,9 +11360,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_99:
{
/** 1111 1101 0111 im00 0100rdst max #%1, %0 */
-#line 570 "rx-decode.opc"
+#line 574 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 570 "rx-decode.opc"
+#line 574 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11369,7 +11373,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("max #%1, %0");
-#line 570 "rx-decode.opc"
+#line 574 "rx-decode.opc"
int val = IMMex (im);
if (im == 0 && (unsigned) val == 0x80000000 && rdst == 0)
{
@@ -11388,9 +11392,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_100:
{
/** 1111 1101 0111 im00 0101rdst min #%1, %0 */
-#line 600 "rx-decode.opc"
+#line 604 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 600 "rx-decode.opc"
+#line 604 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11401,7 +11405,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("min #%1, %0");
-#line 600 "rx-decode.opc"
+#line 604 "rx-decode.opc"
ID(min); DR(rdst); SC(IMMex(im));
}
@@ -11410,9 +11414,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_101:
{
/** 1111 1101 0111 im00 0110rdst emul #%1, %0 */
-#line 658 "rx-decode.opc"
+#line 662 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 658 "rx-decode.opc"
+#line 662 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11423,7 +11427,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("emul #%1, %0");
-#line 658 "rx-decode.opc"
+#line 662 "rx-decode.opc"
ID(emul); DR(rdst); SC(IMMex(im));
}
@@ -11432,9 +11436,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_102:
{
/** 1111 1101 0111 im00 0111rdst emulu #%1, %0 */
-#line 670 "rx-decode.opc"
+#line 674 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 670 "rx-decode.opc"
+#line 674 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11445,7 +11449,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("emulu #%1, %0");
-#line 670 "rx-decode.opc"
+#line 674 "rx-decode.opc"
ID(emulu); DR(rdst); SC(IMMex(im));
}
@@ -11454,9 +11458,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_103:
{
/** 1111 1101 0111 im00 1000rdst div #%1, %0 */
-#line 682 "rx-decode.opc"
+#line 686 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 682 "rx-decode.opc"
+#line 686 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11467,7 +11471,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("div #%1, %0");
-#line 682 "rx-decode.opc"
+#line 686 "rx-decode.opc"
ID(div); DR(rdst); SC(IMMex(im)); F_O___;
}
@@ -11476,9 +11480,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_104:
{
/** 1111 1101 0111 im00 1001rdst divu #%1, %0 */
-#line 694 "rx-decode.opc"
+#line 698 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 694 "rx-decode.opc"
+#line 698 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11489,7 +11493,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("divu #%1, %0");
-#line 694 "rx-decode.opc"
+#line 698 "rx-decode.opc"
ID(divu); DR(rdst); SC(IMMex(im)); F_O___;
}
@@ -11498,9 +11502,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_105:
{
/** 1111 1101 0111 im00 1100rdst tst #%1, %2 */
-#line 467 "rx-decode.opc"
+#line 471 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 467 "rx-decode.opc"
+#line 471 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11511,7 +11515,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("tst #%1, %2");
-#line 467 "rx-decode.opc"
+#line 471 "rx-decode.opc"
ID(and); SC(IMMex(im)); S2R(rdst); F__SZ_;
}
@@ -11520,9 +11524,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_106:
{
/** 1111 1101 0111 im00 1101rdst xor #%1, %0 */
-#line 446 "rx-decode.opc"
+#line 450 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 446 "rx-decode.opc"
+#line 450 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11533,7 +11537,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("xor #%1, %0");
-#line 446 "rx-decode.opc"
+#line 450 "rx-decode.opc"
ID(xor); SC(IMMex(im)); DR(rdst); F__SZ_;
}
@@ -11542,9 +11546,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_107:
{
/** 1111 1101 0111 im00 1110rdst stz #%1, %0 */
-#line 392 "rx-decode.opc"
+#line 396 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 392 "rx-decode.opc"
+#line 396 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11555,7 +11559,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("stz #%1, %0");
-#line 392 "rx-decode.opc"
+#line 396 "rx-decode.opc"
ID(stcc); SC(IMMex(im)); DR(rdst); S2cc(RXC_z);
}
@@ -11564,9 +11568,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_108:
{
/** 1111 1101 0111 im00 1111rdst stnz #%1, %0 */
-#line 395 "rx-decode.opc"
+#line 399 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 395 "rx-decode.opc"
+#line 399 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11577,7 +11581,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("stnz #%1, %0");
-#line 395 "rx-decode.opc"
+#line 399 "rx-decode.opc"
ID(stcc); SC(IMMex(im)); DR(rdst); S2cc(RXC_nz);
/*----------------------------------------------------------------------*/
@@ -11595,7 +11599,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x00:
{
/** 1111 1101 0111 0010 0000 rdst fsub #%1, %0 */
-#line 902 "rx-decode.opc"
+#line 906 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11605,7 +11609,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fsub #%1, %0");
-#line 902 "rx-decode.opc"
+#line 906 "rx-decode.opc"
ID(fsub); DR(rdst); SC(IMM(0)); F__SZ_;
}
@@ -11613,7 +11617,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x10:
{
/** 1111 1101 0111 0010 0001 rdst fcmp #%1, %0 */
-#line 896 "rx-decode.opc"
+#line 900 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11623,7 +11627,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fcmp #%1, %0");
-#line 896 "rx-decode.opc"
+#line 900 "rx-decode.opc"
ID(fcmp); DR(rdst); SC(IMM(0)); F_OSZ_;
}
@@ -11631,7 +11635,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x20:
{
/** 1111 1101 0111 0010 0010 rdst fadd #%1, %0 */
-#line 890 "rx-decode.opc"
+#line 894 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11641,7 +11645,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fadd #%1, %0");
-#line 890 "rx-decode.opc"
+#line 894 "rx-decode.opc"
ID(fadd); DR(rdst); SC(IMM(0)); F__SZ_;
}
@@ -11649,7 +11653,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x30:
{
/** 1111 1101 0111 0010 0011 rdst fmul #%1, %0 */
-#line 911 "rx-decode.opc"
+#line 915 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11659,7 +11663,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fmul #%1, %0");
-#line 911 "rx-decode.opc"
+#line 915 "rx-decode.opc"
ID(fmul); DR(rdst); SC(IMM(0)); F__SZ_;
}
@@ -11667,7 +11671,7 @@ rx_decode_opcode (unsigned long pc AU,
case 0x40:
{
/** 1111 1101 0111 0010 0100 rdst fdiv #%1, %0 */
-#line 917 "rx-decode.opc"
+#line 921 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11677,7 +11681,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("fdiv #%1, %0");
-#line 917 "rx-decode.opc"
+#line 921 "rx-decode.opc"
ID(fdiv); DR(rdst); SC(IMM(0)); F__SZ_;
}
@@ -11693,9 +11697,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_109:
{
/** 1111 1101 0111 im11 000crdst mvtc #%1, %0 */
-#line 1007 "rx-decode.opc"
+#line 1011 "rx-decode.opc"
int im AU = (op[1] >> 2) & 0x03;
-#line 1007 "rx-decode.opc"
+#line 1011 "rx-decode.opc"
int crdst AU = op[2] & 0x1f;
if (trace)
{
@@ -11706,7 +11710,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" crdst = 0x%x\n", crdst);
}
SYNTAX("mvtc #%1, %0");
-#line 1007 "rx-decode.opc"
+#line 1011 "rx-decode.opc"
ID(mov); SC(IMMex(im)); DR(crdst + 16);
}
@@ -11872,11 +11876,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_110:
{
/** 1111 1101 100immmm rsrc rdst shlr #%2, %1, %0 */
-#line 732 "rx-decode.opc"
+#line 736 "rx-decode.opc"
int immmm AU = op[1] & 0x1f;
-#line 732 "rx-decode.opc"
+#line 736 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 732 "rx-decode.opc"
+#line 736 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -11888,7 +11892,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shlr #%2, %1, %0");
-#line 732 "rx-decode.opc"
+#line 736 "rx-decode.opc"
ID(shlr); S2C(immmm); SR(rsrc); DR(rdst); F__SZC;
/*----------------------------------------------------------------------*/
@@ -12185,11 +12189,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_111:
{
/** 1111 1101 101immmm rsrc rdst shar #%2, %1, %0 */
-#line 722 "rx-decode.opc"
+#line 726 "rx-decode.opc"
int immmm AU = op[1] & 0x1f;
-#line 722 "rx-decode.opc"
+#line 726 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 722 "rx-decode.opc"
+#line 726 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -12201,7 +12205,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shar #%2, %1, %0");
-#line 722 "rx-decode.opc"
+#line 726 "rx-decode.opc"
ID(shar); S2C(immmm); SR(rsrc); DR(rdst); F_0SZC;
@@ -12496,11 +12500,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_112:
{
/** 1111 1101 110immmm rsrc rdst shll #%2, %1, %0 */
-#line 712 "rx-decode.opc"
+#line 716 "rx-decode.opc"
int immmm AU = op[1] & 0x1f;
-#line 712 "rx-decode.opc"
+#line 716 "rx-decode.opc"
int rsrc AU = (op[2] >> 4) & 0x0f;
-#line 712 "rx-decode.opc"
+#line 716 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -12512,7 +12516,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("shll #%2, %1, %0");
-#line 712 "rx-decode.opc"
+#line 716 "rx-decode.opc"
ID(shll); S2C(immmm); SR(rsrc); DR(rdst); F_OSZC;
@@ -12821,11 +12825,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_113:
{
/** 1111 1101 111 bittt cond rdst bm%2 #%1, %0%S0 */
-#line 986 "rx-decode.opc"
+#line 990 "rx-decode.opc"
int bittt AU = op[1] & 0x1f;
-#line 986 "rx-decode.opc"
+#line 990 "rx-decode.opc"
int cond AU = (op[2] >> 4) & 0x0f;
-#line 986 "rx-decode.opc"
+#line 990 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -12837,7 +12841,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("bm%2 #%1, %0%S0");
-#line 986 "rx-decode.opc"
+#line 990 "rx-decode.opc"
ID(bmcc); BWL(LSIZE); S2cc(cond); SC(bittt); DR(rdst);
/*----------------------------------------------------------------------*/
@@ -12849,9 +12853,9 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_114:
{
/** 1111 1101 111bittt 1111 rdst bnot #%1, %0 */
-#line 979 "rx-decode.opc"
+#line 983 "rx-decode.opc"
int bittt AU = op[1] & 0x1f;
-#line 979 "rx-decode.opc"
+#line 983 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -12862,7 +12866,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("bnot #%1, %0");
-#line 979 "rx-decode.opc"
+#line 983 "rx-decode.opc"
ID(bnot); BWL(LSIZE); SC(bittt); DR(rdst);
@@ -13691,13 +13695,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_115:
{
/** 1111 1110 00sz isrc bsrc rdst mov%s %0, [%1, %2] */
-#line 338 "rx-decode.opc"
+#line 342 "rx-decode.opc"
int sz AU = (op[1] >> 4) & 0x03;
-#line 338 "rx-decode.opc"
+#line 342 "rx-decode.opc"
int isrc AU = op[1] & 0x0f;
-#line 338 "rx-decode.opc"
+#line 342 "rx-decode.opc"
int bsrc AU = (op[2] >> 4) & 0x0f;
-#line 338 "rx-decode.opc"
+#line 342 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -13710,7 +13714,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mov%s %0, [%1, %2]");
-#line 338 "rx-decode.opc"
+#line 342 "rx-decode.opc"
ID(movbir); sBWL(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____;
}
@@ -14148,13 +14152,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_116:
{
/** 1111 1110 01sz isrc bsrc rdst mov%s [%1, %2], %0 */
-#line 335 "rx-decode.opc"
+#line 339 "rx-decode.opc"
int sz AU = (op[1] >> 4) & 0x03;
-#line 335 "rx-decode.opc"
+#line 339 "rx-decode.opc"
int isrc AU = op[1] & 0x0f;
-#line 335 "rx-decode.opc"
+#line 339 "rx-decode.opc"
int bsrc AU = (op[2] >> 4) & 0x0f;
-#line 335 "rx-decode.opc"
+#line 339 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -14167,7 +14171,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("mov%s [%1, %2], %0");
-#line 335 "rx-decode.opc"
+#line 339 "rx-decode.opc"
ID(movbi); sBWL(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____;
}
@@ -14605,13 +14609,13 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_117:
{
/** 1111 1110 11sz isrc bsrc rdst movu%s [%1, %2], %0 */
-#line 341 "rx-decode.opc"
+#line 345 "rx-decode.opc"
int sz AU = (op[1] >> 4) & 0x03;
-#line 341 "rx-decode.opc"
+#line 345 "rx-decode.opc"
int isrc AU = op[1] & 0x0f;
-#line 341 "rx-decode.opc"
+#line 345 "rx-decode.opc"
int bsrc AU = (op[2] >> 4) & 0x0f;
-#line 341 "rx-decode.opc"
+#line 345 "rx-decode.opc"
int rdst AU = op[2] & 0x0f;
if (trace)
{
@@ -14624,7 +14628,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" rdst = 0x%x\n", rdst);
}
SYNTAX("movu%s [%1, %2], %0");
-#line 341 "rx-decode.opc"
+#line 345 "rx-decode.opc"
ID(movbi); uBW(sz); DR(rdst); SRR(isrc); S2R(bsrc); F_____;
}
@@ -15069,11 +15073,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_118:
{
/** 1111 1111 0000 rdst srca srcb sub %2, %1, %0 */
-#line 545 "rx-decode.opc"
+#line 549 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
-#line 545 "rx-decode.opc"
+#line 549 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 545 "rx-decode.opc"
+#line 549 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -15085,7 +15089,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("sub %2, %1, %0");
-#line 545 "rx-decode.opc"
+#line 549 "rx-decode.opc"
ID(sub); DR(rdst); SR(srcb); S2R(srca); F_OSZC;
/*----------------------------------------------------------------------*/
@@ -15238,11 +15242,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_119:
{
/** 1111 1111 0010 rdst srca srcb add %2, %1, %0 */
-#line 512 "rx-decode.opc"
+#line 516 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
-#line 512 "rx-decode.opc"
+#line 516 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 512 "rx-decode.opc"
+#line 516 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -15254,7 +15258,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("add %2, %1, %0");
-#line 512 "rx-decode.opc"
+#line 516 "rx-decode.opc"
ID(add); DR(rdst); SR(srcb); S2R(srca); F_OSZC;
/*----------------------------------------------------------------------*/
@@ -15407,11 +15411,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_120:
{
/** 1111 1111 0011 rdst srca srcb mul %2, %1, %0 */
-#line 652 "rx-decode.opc"
+#line 656 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
-#line 652 "rx-decode.opc"
+#line 656 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 652 "rx-decode.opc"
+#line 656 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -15423,7 +15427,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("mul %2, %1, %0");
-#line 652 "rx-decode.opc"
+#line 656 "rx-decode.opc"
ID(mul); DR(rdst); SR(srcb); S2R(srca); F_____;
/*----------------------------------------------------------------------*/
@@ -15576,11 +15580,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_121:
{
/** 1111 1111 0100 rdst srca srcb and %2, %1, %0 */
-#line 422 "rx-decode.opc"
+#line 426 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
-#line 422 "rx-decode.opc"
+#line 426 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 422 "rx-decode.opc"
+#line 426 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -15592,7 +15596,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("and %2, %1, %0");
-#line 422 "rx-decode.opc"
+#line 426 "rx-decode.opc"
ID(and); DR(rdst); SR(srcb); S2R(srca); F__SZ_;
/*----------------------------------------------------------------------*/
@@ -15745,11 +15749,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_122:
{
/** 1111 1111 0101 rdst srca srcb or %2, %1, %0 */
-#line 440 "rx-decode.opc"
+#line 444 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
-#line 440 "rx-decode.opc"
+#line 444 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 440 "rx-decode.opc"
+#line 444 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -15761,7 +15765,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("or %2, %1, %0");
-#line 440 "rx-decode.opc"
+#line 444 "rx-decode.opc"
ID(or); DR(rdst); SR(srcb); S2R(srca); F__SZ_;
/*----------------------------------------------------------------------*/
@@ -15914,11 +15918,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_123:
{
/** 1111 1111 1000 rdst srca srcb fsub %2, %1, %0 */
-#line 1100 "rx-decode.opc"
+#line 1104 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
-#line 1100 "rx-decode.opc"
+#line 1104 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1100 "rx-decode.opc"
+#line 1104 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -15930,7 +15934,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("fsub %2, %1, %0");
-#line 1100 "rx-decode.opc"
+#line 1104 "rx-decode.opc"
ID(fsub); DR(rdst); SR(srcb); S2R(srca); F__SZ_;
}
@@ -16080,11 +16084,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_124:
{
/** 1111 1111 1010 rdst srca srcb fadd %2, %1, %0 */
-#line 1097 "rx-decode.opc"
+#line 1101 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
-#line 1097 "rx-decode.opc"
+#line 1101 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1097 "rx-decode.opc"
+#line 1101 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -16096,7 +16100,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("fadd %2, %1, %0");
-#line 1097 "rx-decode.opc"
+#line 1101 "rx-decode.opc"
ID(fadd); DR(rdst); SR(srcb); S2R(srca); F__SZ_;
}
@@ -16246,11 +16250,11 @@ rx_decode_opcode (unsigned long pc AU,
op_semantics_125:
{
/** 1111 1111 1011 rdst srca srcb fmul %2, %1, %0 */
-#line 1103 "rx-decode.opc"
+#line 1107 "rx-decode.opc"
int rdst AU = op[1] & 0x0f;
-#line 1103 "rx-decode.opc"
+#line 1107 "rx-decode.opc"
int srca AU = (op[2] >> 4) & 0x0f;
-#line 1103 "rx-decode.opc"
+#line 1107 "rx-decode.opc"
int srcb AU = op[2] & 0x0f;
if (trace)
{
@@ -16262,7 +16266,7 @@ rx_decode_opcode (unsigned long pc AU,
printf (" srcb = 0x%x\n", srcb);
}
SYNTAX("fmul %2, %1, %0");
-#line 1103 "rx-decode.opc"
+#line 1107 "rx-decode.opc"
ID(fmul); DR(rdst); SR(srcb); S2R(srca); F__SZ_;
}
@@ -16409,7 +16413,7 @@ rx_decode_opcode (unsigned long pc AU,
break;
default: UNSUPPORTED(); break;
}
-#line 1118 "rx-decode.opc"
+#line 1122 "rx-decode.opc"
return rx->n_bytes;
}
diff --git a/opcodes/rx-decode.opc b/opcodes/rx-decode.opc
index ffbb273..3fe542f 100644
--- a/opcodes/rx-decode.opc
+++ b/opcodes/rx-decode.opc
@@ -26,6 +26,7 @@
#include <string.h>
#include "ansidecl.h"
#include "opcode/rx.h"
+#include "libiberty.h"
#define RX_OPCODE_BIG_ENDIAN 0
@@ -44,7 +45,7 @@ static int trace = 0;
#define LSIZE 2
/* These are for when the upper bits are "don't care" or "undefined". */
-static int bwl[] =
+static int bwl[4] =
{
RX_Byte,
RX_Word,
@@ -52,7 +53,7 @@ static int bwl[] =
RX_Bad_Size /* Bogus instructions can have a size field set to 3. */
};
-static int sbwl[] =
+static int sbwl[4] =
{
RX_SByte,
RX_SWord,
@@ -60,7 +61,7 @@ static int sbwl[] =
RX_Bad_Size /* Bogus instructions can have a size field set to 3. */
};
-static int ubw[] =
+static int ubw[4] =
{
RX_UByte,
RX_UWord,
@@ -68,7 +69,7 @@ static int ubw[] =
RX_Bad_Size /* Bogus instructions can have a size field set to 3. */
};
-static int memex[] =
+static int memex[4] =
{
RX_SByte,
RX_SWord,
@@ -88,6 +89,9 @@ static int SCALE[] = { 1, 2, 4, 0 };
/* This is for the prefix size enum. */
static int PSCALE[] = { 4, 1, 1, 1, 2, 2, 2, 3, 4 };
+#define GET_SCALE(_indx) ((unsigned)(_indx) < ARRAY_SIZE (SCALE) ? SCALE[(_indx)] : 0)
+#define GET_PSCALE(_indx) ((unsigned)(_indx) < ARRAY_SIZE (PSCALE) ? PSCALE[(_indx)] : 0)
+
static int flagmap[] = {0, 1, 2, 3, 0, 0, 0, 0,
16, 17, 0, 0, 0, 0, 0, 0 };
@@ -106,7 +110,7 @@ static int dsp3map[] = { 8, 9, 10, 3, 4, 5, 6, 7 };
#define DC(c) OP (0, RX_Operand_Immediate, 0, c)
#define DR(r) OP (0, RX_Operand_Register, r, 0)
#define DI(r,a) OP (0, RX_Operand_Indirect, r, a)
-#define DIs(r,a,s) OP (0, RX_Operand_Indirect, r, (a) * SCALE[s])
+#define DIs(r,a,s) OP (0, RX_Operand_Indirect, r, (a) * GET_SCALE (s))
#define DD(t,r,s) rx_disp (0, t, r, bwl[s], ld);
#define DF(r) OP (0, RX_Operand_Flag, flagmap[r], 0)
@@ -114,7 +118,7 @@ static int dsp3map[] = { 8, 9, 10, 3, 4, 5, 6, 7 };
#define SR(r) OP (1, RX_Operand_Register, r, 0)
#define SRR(r) OP (1, RX_Operand_TwoReg, r, 0)
#define SI(r,a) OP (1, RX_Operand_Indirect, r, a)
-#define SIs(r,a,s) OP (1, RX_Operand_Indirect, r, (a) * SCALE[s])
+#define SIs(r,a,s) OP (1, RX_Operand_Indirect, r, (a) * GET_SCALE (s))
#define SD(t,r,s) rx_disp (1, t, r, bwl[s], ld);
#define SP(t,r) rx_disp (1, t, r, (t!=3) ? RX_UByte : RX_Long, ld); P(t, 1);
#define SPm(t,r,m) rx_disp (1, t, r, memex[m], ld); rx->op[1].size = memex[m];
@@ -123,7 +127,7 @@ static int dsp3map[] = { 8, 9, 10, 3, 4, 5, 6, 7 };
#define S2C(i) OP (2, RX_Operand_Immediate, 0, i)
#define S2R(r) OP (2, RX_Operand_Register, r, 0)
#define S2I(r,a) OP (2, RX_Operand_Indirect, r, a)
-#define S2Is(r,a,s) OP (2, RX_Operand_Indirect, r, (a) * SCALE[s])
+#define S2Is(r,a,s) OP (2, RX_Operand_Indirect, r, (a) * GET_SCALE (s))
#define S2D(t,r,s) rx_disp (2, t, r, bwl[s], ld);
#define S2P(t,r) rx_disp (2, t, r, (t!=3) ? RX_UByte : RX_Long, ld); P(t, 2);
#define S2Pm(t,r,m) rx_disp (2, t, r, memex[m], ld); rx->op[2].size = memex[m];
@@ -210,7 +214,7 @@ immediate (int sfield, int ex, LocalData * ld)
}
static void
-rx_disp (int n, int type, int reg, int size, LocalData * ld)
+rx_disp (int n, int type, int reg, unsigned int size, LocalData * ld)
{
int disp;
@@ -227,7 +231,7 @@ rx_disp (int n, int type, int reg, int size, LocalData * ld)
case 1:
ld->rx->op[n].type = RX_Operand_Indirect;
disp = GETBYTE ();
- ld->rx->op[n].addend = disp * PSCALE[size];
+ ld->rx->op[n].addend = disp * GET_PSCALE (size);
break;
case 2:
ld->rx->op[n].type = RX_Operand_Indirect;
@@ -237,7 +241,7 @@ rx_disp (int n, int type, int reg, int size, LocalData * ld)
#else
disp = disp + GETBYTE () * 256;
#endif
- ld->rx->op[n].addend = disp * PSCALE[size];
+ ld->rx->op[n].addend = disp * GET_PSCALE (size);
break;
default:
abort ();
diff --git a/opcodes/s390-opc.txt b/opcodes/s390-opc.txt
index bd252b2..535d6c9 100644
--- a/opcodes/s390-opc.txt
+++ b/opcodes/s390-opc.txt
@@ -79,7 +79,7 @@ b224 iac RRE_R0 "insert address space control" g5 esa,zarch
bf icm RS_RURD "insert characters under mask" g5 esa,zarch
b20b ipk S_00 "insert PSW key" g5 esa,zarch
b222 ipm RRE_R0 "insert program mask" g5 esa,zarch
-b221 ipte RRE_RR "invalidate page table entry" g5 esa,zarch
+b221 ipte RRF_RURR "invalidate page table entry" g5 esa,zarch optparm2
b229 iske RRE_RR "insert storage key extended" g5 esa,zarch
b223 ivsk RRE_RR "insert virtual storage key" g5 esa,zarch
58 l RX_RRRD "load" g5 esa,zarch
@@ -700,7 +700,7 @@ eb000000008f clclu RSY_RRRD "compare logical long unicode with long offset" z990
eb0000000096 lmh RSY_RRRD "load multiple high" z990 zarch
# new z990 instructions
b98a cspg RRE_RR "compare and swap and purge" z990 zarch
-b98e idte RRF_R0RR "invalidate dat table entry" z990 zarch
+b98e idte RRF_RURR2 "invalidate dat table entry" z990 zarch optparm
b33e madr RRF_F0FF "multiply and add long hfp" z990 esa,zarch
ed000000003e mad RXF_FRRDF "multiply and add long hfp" z990 esa,zarch
b32e maer RRF_F0FF "multiply and add short hfp" z990 esa,zarch
@@ -1116,7 +1116,6 @@ b92b kmo RRE_RR "cipher message with OFB" z196 zarch
b92c pcc RRE_00 "perform cryptographic computation" z196 zarch
b92d kmctr RRF_R0RR "cipher message with counter" z196 zarch
b928 pckmo RRE_00 "perform cryptographic key management operation" z196 zarch
-b221 ipte RRF_R0RR2 "invalidate page table entry" z196 zarch optparm
# The new instructions of the IBM zEnterprise EC12
b2ec etnd RRE_R0 "extract transaction nesting depth" zEC12 zarch htm
@@ -1144,8 +1143,6 @@ ed00000000aa cdzt RSL_LRDFU "convert from zoned long" zEC12 zarch
ed00000000ab cxzt RSL_LRDFEU "convert from zoned extended" zEC12 zarch
ed00000000a8 czdt RSL_LRDFU "convert to zoned long" zEC12 zarch
ed00000000a9 czxt RSL_LRDFEU "convert to zoned extended" zEC12 zarch
-b98e idte RRF_RURR2 "invalidate dat table entry" zEC12 zarch optparm
-b221 ipte RRF_RURR "invalidate page table entry" zEC12 zarch optparm2
# The new instructions of IBM z13
diff --git a/opcodes/score-dis.c b/opcodes/score-dis.c
index fdfc4a0..d68e2b9 100644
--- a/opcodes/score-dis.c
+++ b/opcodes/score-dis.c
@@ -473,6 +473,7 @@ static struct score_opcode score_opcodes[] =
{0x00003454, 0x3e007fff, "tvc"},
{0x00000026, 0x3e0003ff, "xor\t\t%20-24r, %15-19r, %10-14r"},
{0x00000027, 0x3e0003ff, "xor.c\t\t%20-24r, %15-19r, %10-14r"},
+ {0,0,NULL}
};
diff --git a/opcodes/score7-dis.c b/opcodes/score7-dis.c
index c50a60f..8d0d969 100644
--- a/opcodes/score7-dis.c
+++ b/opcodes/score7-dis.c
@@ -513,7 +513,8 @@ static struct score_opcode score_opcodes[] =
{0x00000d05, 0x00007f0f, "tvc!"},
{0x00000026, 0x3e0003ff, "xor\t\t%20-24r, %15-19r, %10-14r"},
{0x00000027, 0x3e0003ff, "xor.c\t\t%20-24r, %15-19r, %10-14r"},
- {0x00002007, 0x0000700f, "xor!\t\t%8-11r, %4-7r"}
+ {0x00002007, 0x0000700f, "xor!\t\t%8-11r, %4-7r"},
+ { 0, 0, NULL }
};
typedef struct
diff --git a/opcodes/spu-dis.c b/opcodes/spu-dis.c
index 3009463..b57faf5 100644
--- a/opcodes/spu-dis.c
+++ b/opcodes/spu-dis.c
@@ -21,7 +21,7 @@
#include "sysdep.h"
#include <stdio.h>
-#include "dis-asm.h"
+#include "disassemble.h"
#include "opcode/spu.h"
/* This file provides a disassembler function which uses
diff --git a/sim/microblaze/ChangeLog b/sim/microblaze/ChangeLog
index 67de9f4..a1d742d 100644
--- a/sim/microblaze/ChangeLog
+++ b/sim/microblaze/ChangeLog
@@ -1,3 +1,7 @@
+2017-05-30 Andrea Corallo <andrea_corallo@yahoo.it>
+
+ * interp.c: (target_big_endian): target endianess recognition fix.
+
2016-01-10 Mike Frysinger <vapier@gentoo.org>
* config.in, configure: Regenerate.
diff --git a/sim/microblaze/interp.c b/sim/microblaze/interp.c
index e619cf8..75fc98b 100644
--- a/sim/microblaze/interp.c
+++ b/sim/microblaze/interp.c
@@ -31,7 +31,7 @@
#include "microblaze-dis.h"
-#define target_big_endian (CURRENT_TARGET_BYTE_ORDER == BIG_ENDIAN)
+#define target_big_endian (CURRENT_TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
static unsigned long
microblaze_extract_unsigned_integer (unsigned char *addr, int len)