aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2020-02-12 15:59:59 +0000
committerEd Maste <emaste@FreeBSD.org>2020-02-12 15:59:59 +0000
commit57d7e4cc2c6f50edf9b1d54567e03066b8eb42c5 (patch)
treef55ebc81cecc0dd5c507f08bee70edacc8f42f24 /contrib
parent348404bce15fb4eb247e7c56d72c3add8e0950d1 (diff)
downloadsrc-57d7e4cc2c6f50edf9b1d54567e03066b8eb42c5.tar.gz
src-57d7e4cc2c6f50edf9b1d54567e03066b8eb42c5.zip
elfcopy: set ELF OS/ABI field when converting from binary
PR: 228934 Submitted by: Tiger Gao <tig@freebsdfoundation.org> Reviewed by: markj, jkoshy MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D23504
Notes
Notes: svn path=/head/; revision=357826
Diffstat (limited to 'contrib')
-rw-r--r--contrib/elftoolchain/elfcopy/main.c1
-rw-r--r--contrib/elftoolchain/libelftc/elftc.34
-rw-r--r--contrib/elftoolchain/libelftc/elftc_bfd_find_target.34
-rw-r--r--contrib/elftoolchain/libelftc/elftc_bfdtarget.c7
-rw-r--r--contrib/elftoolchain/libelftc/libelftc.h1
5 files changed, 15 insertions, 2 deletions
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c
index 7348bbd28156..fa636820e6e6 100644
--- a/contrib/elftoolchain/elfcopy/main.c
+++ b/contrib/elftoolchain/elfcopy/main.c
@@ -1394,6 +1394,7 @@ set_output_target(struct elfcopy *ecp, const char *target_name)
ecp->oec = elftc_bfd_target_class(tgt);
ecp->oed = elftc_bfd_target_byteorder(tgt);
ecp->oem = elftc_bfd_target_machine(tgt);
+ ecp->abi = elftc_bfd_target_osabi(tgt);
}
if (ecp->otf == ETF_EFI || ecp->otf == ETF_PE)
ecp->oem = elftc_bfd_target_machine(tgt);
diff --git a/contrib/elftoolchain/libelftc/elftc.3 b/contrib/elftoolchain/libelftc/elftc.3
index 08b3f5293dc0..54c93b4faf0e 100644
--- a/contrib/elftoolchain/libelftc/elftc.3
+++ b/contrib/elftoolchain/libelftc/elftc.3
@@ -23,7 +23,7 @@
.\"
.\" $Id: elftc.3 3645 2018-10-15 20:17:14Z jkoshy $
.\"
-.Dd December 24, 2012
+.Dd February 12, 2020
.Dt ELFTC 3
.Os
.Sh NAME
@@ -57,6 +57,8 @@ Query the byte order for a binary object descriptor.
Query the object format for a binary object descriptor.
.It Fn elftc_bfd_target_machine
Query the target machine for a binary object descriptor.
+.It Fn elftc_bfd_target_osabi
+Query the target osabi for a binary object descriptor.
.El
.It "C++ support"
.Bl -tag -compact -width indent
diff --git a/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 b/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
index 169c4723d94c..235841aa0136 100644
--- a/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
+++ b/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
@@ -23,7 +23,7 @@
.\"
.\" $Id: elftc_bfd_find_target.3 3752 2019-06-28 01:12:53Z emaste $
.\"
-.Dd June 27, 2019
+.Dd February 12, 2020
.Dt ELFTC_BFD_FIND_TARGET 3
.Os
.Sh NAME
@@ -48,6 +48,8 @@
.Fn elftc_bfd_target_flavor "Elftc_Bfd_Target *target"
.Ft "unsigned int"
.Fn elftc_bfd_target_machine "Elftc_Bfd_Target *target"
+.Ft "unsigned int"
+.Fn elftc_bfd_target_osabi "Elftc_Bfd_Target *target"
.Sh DESCRIPTION
Function
.Fn elftc_bfd_find_target
diff --git a/contrib/elftoolchain/libelftc/elftc_bfdtarget.c b/contrib/elftoolchain/libelftc/elftc_bfdtarget.c
index a5ae1a671893..e74072647cef 100644
--- a/contrib/elftoolchain/libelftc/elftc_bfdtarget.c
+++ b/contrib/elftoolchain/libelftc/elftc_bfdtarget.c
@@ -71,3 +71,10 @@ elftc_bfd_target_machine(Elftc_Bfd_Target *tgt)
return (tgt->bt_machine);
}
+
+unsigned int
+elftc_bfd_target_osabi(Elftc_Bfd_Target *tgt)
+{
+
+ return (tgt->bt_osabi);
+}
diff --git a/contrib/elftoolchain/libelftc/libelftc.h b/contrib/elftoolchain/libelftc/libelftc.h
index 244c029c9fb2..2cd1a3301d90 100644
--- a/contrib/elftoolchain/libelftc/libelftc.h
+++ b/contrib/elftoolchain/libelftc/libelftc.h
@@ -72,6 +72,7 @@ Elftc_Bfd_Target_Flavor elftc_bfd_target_flavor(Elftc_Bfd_Target *_tgt);
unsigned int elftc_bfd_target_byteorder(Elftc_Bfd_Target *_tgt);
unsigned int elftc_bfd_target_class(Elftc_Bfd_Target *_tgt);
unsigned int elftc_bfd_target_machine(Elftc_Bfd_Target *_tgt);
+unsigned int elftc_bfd_target_osabi(Elftc_Bfd_Target *_tgt);
int elftc_copyfile(int _srcfd, int _dstfd);
int elftc_demangle(const char *_mangledname, char *_buffer,
size_t _bufsize, unsigned int _flags);