[PATCH 1/3] Implement new Linux target vectors on BFD

Sergio Durigan Junior
2013-01-30T06:53:03Z

Hi all,

As a followup of my previous patch series, which can be found here:

<http://sourceware.org/ml/gdb-patches/2012-12/msg00534.html>
<http://sourceware.org/ml/gdb-patches/2012-12/msg00536.html>

...and (for this particular patch) as also a followup for Pedro's
comments on:

<http://sourceware.org/ml/gdb-patches/2013-01/msg00233.html>

I am sending this patch for appreciation and review. It is the first
patch of the new PRPSINFO series, and all it does is basically:

1) Add new target vectors on the BFD configury system in order to handle
Linux targets, which will then make it possible to use certain functions
only on such targets, and

2) Hack the existing arch files on BFD (and one specifically on GDB) in
order to correctly declare and use these new targets.

I have chosen not to implement this to all architectures because for now
I only needed the ones which actually implemented the *_write_core_note
function, so you'll see that it touches basically ARM, i*86, x86_64, PPC
and PPC64. As I mentioned above, I had to do modify a GDB file
(ppc-linux-tdep.c) because it declared its BFD target by hand. Not a
big deal.

My first attempt to implement this (suggested by Pedro) was to actually
create a Linux-specific file (e.g., elf64-linux-x86-64.c) which would
#include the original implementation (elf64-x86-64.c in this example)
and extend it by reimplementing some functions. In the end this
approach didn't work because of the way things are laid out in the
original file, so I started looking at the normal procedure for this.

I spent quite some time understanding how the BFD build system worked,
and how to actually hack it, so I hope I did not make any miserable
mistakes here.

Comments are welcome.

--
Sergio

bfd/ChangeLog:

2013-01-30 Sergio Durigan Junior <sergiodj@redhat.com>

* config.bfd: Add or modify ARM, i*86, x86_64, PPC and PPC64 targets
for Linux kernel.
* configure.in: Add *_vec definitions for ARM, i*86, x86_64, PPC and
PPC64 targets for Linux kernel.
* configure: Regenerate.
* elf32-arm.c: Add support for Linux kernel.
* elf32-i386.c: Likewise.
* elf32-ppc.c: Likewise.
* elf64-ppc.c: Likewise.
* elf64-x86-64.c: Likewise.
* targets.c (<bfd_elf32_bigarm_linux_vec>, <bfd_elf32_i386_linux_vec>,
<bfd_elf32_littlearm_linux_vec>, <bfd_elf32_powerpc_linux_vec>,
<bfd_elf32_powerpcle_linux_vec>, <bfd_elf64_powerpc_linux_vec>,
<bfd_elf64_powerpcle_linux_vec>, <bfd_elf64_x86_64_linux_vec>,
<bfd_elf32_x86_64_linux_vec>): New *_vec definitions for ARM, i*86,
x86_64, PPC and PPC64 targets for Linux kernel.

gdb/ChangeLog:

2013-01-30 Sergio Durigan Junior <sergiodj@redhat.com>

* ppc-linux-tdep.c (ppc_linux_init_abi): Properly setting
`gcore_bfd_target' with the Linux kernel variant.

---
bfd/config.bfd | 48 +++++++++++++++++++++++++++++++++++++-----------
bfd/configure | 11 ++++++++++-
bfd/configure.in | 11 ++++++++++-
bfd/elf32-arm.c | 15 +++++++++++++++
bfd/elf32-i386.c | 11 +++++++++++
bfd/elf32-ppc.c | 15 +++++++++++++++
bfd/elf64-ppc.c | 15 +++++++++++++++
bfd/elf64-x86-64.c | 31 +++++++++++++++++++++++++++++++
bfd/targets.c | 18 ++++++++++++++++++
gdb/ppc-linux-tdep.c | 8 ++++----
11 files changed, 167 insertions(+), 18 deletions(-)

diff --git a/bfd/config.bfd b/bfd/config.bfd
index cd19936..d2d9c32 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -322,20 +322,28 @@ case "${targ}" in
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
- armeb-*-elf | arm*b-*-linux-*)
+ armeb-*-elf)
targ_defvec=bfd_elf32_bigarm_vec
targ_selvecs=bfd_elf32_littlearm_vec
;;
+ arm*b-*-linux-*)
+ targ_defvec=bfd_elf32_bigarm_linux_vec
+ targ_selvecs=bfd_elf32_littlearm_linux_vec
+ ;;
arm-*-kaos*)
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
- arm-*-elf | arm-*-freebsd* | arm*-*-linux-* | arm*-*-conix* | \
+ arm-*-elf | arm-*-freebsd* | arm*-*-conix* | \
arm*-*-uclinux* | arm-*-kfreebsd*-gnu | \
arm*-*-eabi* )
targ_defvec=bfd_elf32_littlearm_vec
targ_selvecs=bfd_elf32_bigarm_vec
;;
+ arm*-*-linux-*)
+ targ_defvec=bfd_elf32_littlearm_linux_vec
+ targ_selvecs=bfd_elf32_bigarm_linux_vec
+ ;;
arm*-*-vxworks | arm*-*-windiss)
targ_defvec=bfd_elf32_littlearm_vxworks_vec
targ_selvecs=bfd_elf32_bigarm_vxworks_vec
@@ -619,9 +627,9 @@ case "${targ}" in
targ_underscore=yes
;;
i[3-7]86-*-linux-*)
- targ_defvec=bfd_elf32_i386_vec
+ targ_defvec=bfd_elf32_i386_linux_vec
targ_selvecs="i386linux_vec i386pei_vec"
- targ64_selvecs="bfd_elf64_x86_64_vec bfd_elf32_x86_64_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
+ targ64_selvecs="bfd_elf64_x86_64_linux_vec bfd_elf32_x86_64_linux_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
;;
i[3-7]86-*-nacl*)
targ_defvec=bfd_elf32_i386_nacl_vec
@@ -662,8 +670,8 @@ case "${targ}" in
want64=true
;;
x86_64-*-linux-*)
- targ_defvec=bfd_elf64_x86_64_vec
- targ_selvecs="bfd_elf32_i386_vec bfd_elf32_x86_64_vec i386linux_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
+ targ_defvec=bfd_elf64_x86_64_linux_vec
+ targ_selvecs="bfd_elf32_i386_linux_vec bfd_elf32_x86_64_linux_vec i386linux_vec i386pei_vec x86_64pei_vec bfd_elf64_l1om_vec bfd_elf64_k1om_vec"
want64=true
;;
x86_64-*-nacl*)
@@ -1220,17 +1228,26 @@ case "${targ}" in
targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpc_vec bfd_elf32_powerpc_freebsd_vec bfd_elf32_powerpcle_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
want64=true
;;
- powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-linux* | \
- powerpc64-*-*bsd*)
+ powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-*bsd*)
targ_defvec=bfd_elf64_powerpc_vec
targ_selvecs="bfd_elf64_powerpcle_vec bfd_elf32_powerpc_vec bfd_elf32_powerpcle_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
want64=true
;;
+ powerpc64-*-linux*)
+ targ_defvec=bfd_elf64_powerpc_linux_vec
+ targ_selvecs="bfd_elf64_powerpcle_linux_vec bfd_elf32_powerpc_linux_vec bfd_elf32_powerpcle_linux_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
+ want64=true
+ ;;
powerpc64le-*-elf* | powerpcle-*-elf64*)
targ_defvec=bfd_elf64_powerpcle_vec
targ_selvecs="bfd_elf64_powerpc_vec bfd_elf32_powerpcle_vec bfd_elf32_powerpc_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
want64=true
;;
+ powerpc64le-*-linux*)
+ targ_defvec=bfd_elf64_powerpcle_linux_vec
+ targ_selvecs="bfd_elf64_powerpc_linux_vec bfd_elf32_powerpcle_linux_vec bfd_elf32_powerpc_linux_vec rs6000coff_vec rs6000coff64_vec aix5coff64_vec"
+ want64=true
+ ;;
#endif
powerpc-*-*freebsd*)
targ_defvec=bfd_elf32_powerpc_freebsd_vec
@@ -1238,12 +1255,16 @@ case "${targ}" in
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec bfd_elf64_powerpc_freebsd_vec"
;;
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
- powerpc-*-solaris2* | powerpc-*-linux-* | powerpc-*-rtems* | \
- powerpc-*-chorus*)
+ powerpc-*-solaris2* | powerpc-*-rtems* | powerpc-*-chorus*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
;;
+ powerpc-*-linux-*)
+ targ_defvec=bfd_elf32_powerpc_linux_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_linux_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_linux_vec bfd_elf64_powerpcle_linux_vec"
+ ;;
powerpc-*-kaos*)
targ_defvec=bfd_elf32_powerpc_vec
targ_selvecs="bfd_elf32_powerpcle_vec ppcboot_vec"
@@ -1280,11 +1301,16 @@ case "${targ}" in
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
;;
powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
- powerpcle-*-solaris2* | powerpcle-*-linux-* | powerpcle-*-vxworks*)
+ powerpcle-*-solaris2* | powerpcle-*-vxworks*)
targ_defvec=bfd_elf32_powerpcle_vec
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
;;
+ powerpcle-*-linux-*)
+ targ_defvec=bfd_elf32_powerpcle_linux_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_linux_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_linux_vec bfd_elf64_powerpcle_linux_vec"
+ ;;
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
targ_defvec=bfd_powerpcle_pe_vec
targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
diff --git a/bfd/configure b/bfd/configure
index 1279e56..31a7915 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -15219,6 +15219,7 @@ do
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_bigarm_linux_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_nacl_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_symbian_vec)
tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
@@ -15249,6 +15250,7 @@ do
bfd_elf32_i386_nacl_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_linux_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
@@ -15265,6 +15267,7 @@ do
bfd_elf32_littlearm_vxworks_vec)
tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlearm_linux_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlearm_nacl_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_littlemips_vxworks_vec)
@@ -15301,7 +15304,9 @@ do
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_powerpc_linux_vec)tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_powerpcle_linux_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpc_freebsd_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_rl78_vec) tb="$tb elf32-rl78.lo $elf" ;;
@@ -15373,7 +15378,9 @@ do
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
- bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_powerpc_linux_vec)tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_powerpcle_linux_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_powerpc_freebsd_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
@@ -15395,7 +15402,9 @@ do
bfd_elf64_x86_64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_x86_64_sol2_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_x86_64_linux_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf32_x86_64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
+ bfd_elf32_x86_64_linux_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
bfd_elf32_x86_64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
bfd_elf64_l1om_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_l1om_freebsd_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
diff --git a/bfd/configure.in b/bfd/configure.in
index 33f62e3..94651cd 100644
--- a/bfd/configure.in
+++ b/bfd/configure.in
@@ -716,6 +716,7 @@ do
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
bfd_elf32_bigarm_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_bigarm_linux_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_nacl_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_bigarm_symbian_vec)
tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
@@ -746,6 +747,7 @@ do
bfd_elf32_i386_nacl_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vxworks_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_linux_vec) tb="$tb elf32-i386.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
@@ -762,6 +764,7 @@ do
bfd_elf32_littlearm_vxworks_vec)
tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlearm_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
+ bfd_elf32_littlearm_linux_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlearm_nacl_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo" ;;
bfd_elf32_littlemips_vxworks_vec)
@@ -798,7 +801,9 @@ do
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_powerpc_linux_vec)tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
+ bfd_elf32_powerpcle_linux_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpc_freebsd_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_powerpc_vxworks_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
bfd_elf32_rl78_vec) tb="$tb elf32-rl78.lo $elf" ;;
@@ -870,7 +875,9 @@ do
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
bfd_elf64_mmix_vec) tb="$tb elf64-mmix.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_powerpc_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
- bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
+ bfd_elf64_powerpc_linux_vec)tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_powerpcle_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_powerpcle_linux_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_powerpc_freebsd_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
bfd_elf64_s390_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_sh64_vec) tb="$tb elf64-sh64.lo elf64.lo $elf" target_size=64 ;;
@@ -892,7 +899,9 @@ do
bfd_elf64_x86_64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_x86_64_sol2_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_x86_64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
+ bfd_elf64_x86_64_linux_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf32_x86_64_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
+ bfd_elf32_x86_64_linux_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
bfd_elf32_x86_64_nacl_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
bfd_elf64_l1om_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
bfd_elf64_l1om_freebsd_vec) tb="$tb elf64-x86-64.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index e2f8a96..4dfd113 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -15732,6 +15732,21 @@ const struct elf_size_info elf32_arm_size_info =

#include "elf32-target.h"

+/* ARM support on Linux kernel. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_littlearm_linux_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-littlearm-linux"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_bigarm_linux_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-bigarm-linux"
+#undef elf32_bed
+#define elf32_bed elf32_arm_linux_bed
+
+#include "elf32-target.h"
+
/* Native Client targets. */

#undef TARGET_LITTLE_SYM
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 01e50a4..5ef518e 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -5104,6 +5104,17 @@ elf_i386_add_symbol_hook (bfd * abfd,

#include "elf32-target.h"

+/* i386 on Linux. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_i386_linux_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-i386-linux"
+#undef elf32_bed
+#define elf32_bed elf32_i386_linux_bed
+
+#include "elf32-target.h"
+
/* FreeBSD support. */

#undef TARGET_LITTLE_SYM
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c
index 3f4e4bf..1272b5a 100644
--- a/bfd/elf32-ppc.c
+++ b/bfd/elf32-ppc.c
@@ -9806,6 +9806,21 @@ ppc_elf_finish_dynamic_sections (bfd *output_bfd,

#include "elf32-target.h"

+/* PowerPC on Linux. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_powerpcle_linux_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-powerpcle-linux"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf32_powerpc_linux_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf32-powerpc-linux"
+#undef elf32_bed
+#define elf32_bed elf32_powerpc_linux_bed
+
+#include "elf32-target.h"
+
/* FreeBSD Target */

#undef TARGET_LITTLE_SYM
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 2f6999b..e4e9d44 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -14261,6 +14261,21 @@ ppc64_elf_finish_dynamic_sections (bfd *output_bfd,

#include "elf64-target.h"

+/* PowerPC64 support on Linux. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf64_powerpcle_linux_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf64-powerpcle-linux"
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM bfd_elf64_powerpc_linux_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elf64-powerpc-linux"
+#undef elf64_bed
+#define elf64_bed elf64_powerpc_linux_bed
+
+#include "elf64-target.h"
+
/* FreeBSD support */

#undef TARGET_LITTLE_SYM
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 71f33e2..04d46a8 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -5259,6 +5259,18 @@ static const struct bfd_elf_special_section

#include "elf64-target.h"

+/* x86_64 on Linux kernel. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf64_x86_64_linux_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "el64-x86-64-linux"
+
+#undef elf64_bed
+#define elf64_bed elf64_x86_64_linux_bed
+
+#include "elf64-target.h"
+
/* FreeBSD support. */

#undef TARGET_LITTLE_SYM
@@ -5592,6 +5604,25 @@ elf64_k1om_elf_object_p (bfd *abfd)

#include "elf64-target.h"

+/* 32bit x86-64 Linux support. */
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM bfd_elf32_x86_64_linux_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elf32-x86-64-linux"
+#undef elf32_bed
+#define elf32_bed elf32_x86_64_linux_bed
+
+#undef ELF_ARCH
+#define ELF_ARCH bfd_arch_i386
+
+#undef ELF_MACHINE_CODE
+#define ELF_MACHINE_CODE EM_X86_64
+
+#undef ELF_OSABI
+
+#include "elf32-target.h"
+
/* 32bit x86-64 support. */

#undef TARGET_LITTLE_SYM
diff --git a/bfd/targets.c b/bfd/targets.c
index 17553eb..2a73343 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -601,6 +601,7 @@ extern const bfd_target bfd_elf32_bfinfdpic_vec;
extern const bfd_target bfd_elf32_big_generic_vec;
extern const bfd_target bfd_elf32_bigarc_vec;
extern const bfd_target bfd_elf32_bigarm_vec;
+extern const bfd_target bfd_elf32_bigarm_linux_vec;
extern const bfd_target bfd_elf32_bigarm_nacl_vec;
extern const bfd_target bfd_elf32_bigarm_symbian_vec;
extern const bfd_target bfd_elf32_bigarm_vxworks_vec;
@@ -628,6 +629,7 @@ extern const bfd_target bfd_elf32_i386_nacl_vec;
extern const bfd_target bfd_elf32_i386_sol2_vec;
extern const bfd_target bfd_elf32_i386_vxworks_vec;
extern const bfd_target bfd_elf32_i386_vec;
+extern const bfd_target bfd_elf32_i386_linux_vec;
extern const bfd_target bfd_elf32_i860_little_vec;
extern const bfd_target bfd_elf32_i860_vec;
extern const bfd_target bfd_elf32_i960_vec;
@@ -640,6 +642,7 @@ extern const bfd_target bfd_elf32_lm32fdpic_vec;
extern const bfd_target bfd_elf32_little_generic_vec;
extern const bfd_target bfd_elf32_littlearc_vec;
extern const bfd_target bfd_elf32_littlearm_vec;
+extern const bfd_target bfd_elf32_littlearm_linux_vec;
extern const bfd_target bfd_elf32_littlearm_nacl_vec;
extern const bfd_target bfd_elf32_littlearm_symbian_vec;
extern const bfd_target bfd_elf32_littlearm_vxworks_vec;
@@ -677,7 +680,9 @@ extern const bfd_target bfd_elf32_or32_big_vec;
extern const bfd_target bfd_elf32_pj_vec;
extern const bfd_target bfd_elf32_pjl_vec;
extern const bfd_target bfd_elf32_powerpc_vec;
+extern const bfd_target bfd_elf32_powerpc_linux_vec;
extern const bfd_target bfd_elf32_powerpcle_vec;
+extern const bfd_target bfd_elf32_powerpcle_linux_vec;
extern const bfd_target bfd_elf32_powerpc_freebsd_vec;
extern const bfd_target bfd_elf32_powerpc_vxworks_vec;
extern const bfd_target bfd_elf32_rl78_vec;
@@ -746,7 +751,9 @@ extern const bfd_target bfd_elf64_littlemips_vec;
extern const bfd_target bfd_elf64_littleaarch64_vec;
extern const bfd_target bfd_elf64_mmix_vec;
extern const bfd_target bfd_elf64_powerpc_vec;
+extern const bfd_target bfd_elf64_powerpc_linux_vec;
extern const bfd_target bfd_elf64_powerpcle_vec;
+extern const bfd_target bfd_elf64_powerpcle_linux_vec;
extern const bfd_target bfd_elf64_powerpc_freebsd_vec;
extern const bfd_target bfd_elf64_s390_vec;
extern const bfd_target bfd_elf64_sh64_vec;
@@ -768,8 +775,10 @@ extern const bfd_target bfd_elf64_x86_64_freebsd_vec;
extern const bfd_target bfd_elf64_x86_64_nacl_vec;
extern const bfd_target bfd_elf64_x86_64_sol2_vec;
extern const bfd_target bfd_elf64_x86_64_vec;
+extern const bfd_target bfd_elf64_x86_64_linux_vec;
extern const bfd_target bfd_elf32_x86_64_nacl_vec;
extern const bfd_target bfd_elf32_x86_64_vec;
+extern const bfd_target bfd_elf32_x86_64_linux_vec;
extern const bfd_target bfd_elf64_l1om_freebsd_vec;
extern const bfd_target bfd_elf64_l1om_vec;
extern const bfd_target bfd_elf64_k1om_freebsd_vec;
@@ -979,6 +988,7 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf32_big_generic_vec,
&bfd_elf32_bigarc_vec,
&bfd_elf32_bigarm_vec,
+ &bfd_elf32_bigarm_linux_vec,
&bfd_elf32_bigarm_symbian_vec,
&bfd_elf32_bigarm_vxworks_vec,
&bfd_elf32_bigmips_vec,
@@ -1005,6 +1015,7 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf32_i386_sol2_vec,
&bfd_elf32_i386_vxworks_vec,
&bfd_elf32_i386_vec,
+ &bfd_elf32_i386_linux_vec,
&bfd_elf32_i860_little_vec,
&bfd_elf32_i860_vec,
&bfd_elf32_i960_vec,
@@ -1020,6 +1031,7 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf32_little_generic_vec,
&bfd_elf32_littlearc_vec,
&bfd_elf32_littlearm_vec,
+ &bfd_elf32_littlearm_linux_vec,
&bfd_elf32_littlearm_symbian_vec,
&bfd_elf32_littlearm_vxworks_vec,
&bfd_elf32_littlemips_vec,
@@ -1056,8 +1068,10 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf32_pj_vec,
&bfd_elf32_pjl_vec,
&bfd_elf32_powerpc_vec,
+ &bfd_elf32_powerpc_linux_vec,
&bfd_elf32_powerpc_vxworks_vec,
&bfd_elf32_powerpcle_vec,
+ &bfd_elf32_powerpcle_linux_vec,
&bfd_elf32_powerpc_freebsd_vec,
&bfd_elf32_rl78_vec,
&bfd_elf32_rx_be_vec,
@@ -1126,7 +1140,9 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf64_littleaarch64_vec,
&bfd_elf64_mmix_vec,
&bfd_elf64_powerpc_vec,
+ &bfd_elf64_powerpc_linux_vec,
&bfd_elf64_powerpcle_vec,
+ &bfd_elf64_powerpcle_linux_vec,
&bfd_elf64_powerpc_freebsd_vec,
&bfd_elf64_s390_vec,
&bfd_elf64_sh64_vec,
@@ -1148,8 +1164,10 @@ static const bfd_target * const _bfd_target_vector[] =
&bfd_elf64_x86_64_nacl_vec,
&bfd_elf64_x86_64_sol2_vec,
&bfd_elf64_x86_64_vec,
+ &bfd_elf64_x86_64_linux_vec,
&bfd_elf32_x86_64_nacl_vec,
&bfd_elf32_x86_64_vec,
+ &bfd_elf32_x86_64_linux_vec,
&bfd_elf64_l1om_freebsd_vec,
&bfd_elf64_l1om_vec,
&bfd_elf64_k1om_freebsd_vec,
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 135dc75..6cf089c 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -1708,9 +1708,9 @@ ppc_linux_init_abi (struct gdbarch_info info,

/* BFD target for core files. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpcle");
+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpcle-linux");
else
- set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc");
+ set_gdbarch_gcore_bfd_target (gdbarch, "elf32-powerpc-linux");

/* Supported register sections. */
if (tdesc_find_feature (info.target_desc,
@@ -1760,9 +1760,9 @@ ppc_linux_init_abi (struct gdbarch_info info,

/* BFD target for core files. */
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
- set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpcle");
+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpcle-linux");
else
- set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc");
+ set_gdbarch_gcore_bfd_target (gdbarch, "elf64-powerpc-linux");

/* Supported register sections. */
if (tdesc_find_feature (info.target_desc,
--
1.7.7.6