svn commit: r357826 - in head/contrib/elftoolchain: elfcopy libelftc
Ed Maste
emaste at FreeBSD.org
Wed Feb 12 16:00:01 UTC 2020
Author: emaste
Date: Wed Feb 12 15:59:59 2020
New Revision: 357826
URL: https://svnweb.freebsd.org/changeset/base/357826
Log:
elfcopy: set ELF OS/ABI field when converting from binary
PR: 228934
Submitted by: Tiger Gao <tig at freebsdfoundation.org>
Reviewed by: markj, jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23504
Modified:
head/contrib/elftoolchain/elfcopy/main.c
head/contrib/elftoolchain/libelftc/elftc.3
head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
head/contrib/elftoolchain/libelftc/elftc_bfdtarget.c
head/contrib/elftoolchain/libelftc/libelftc.h
Modified: head/contrib/elftoolchain/elfcopy/main.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/main.c Wed Feb 12 15:51:29 2020 (r357825)
+++ head/contrib/elftoolchain/elfcopy/main.c Wed Feb 12 15:59:59 2020 (r357826)
@@ -1394,6 +1394,7 @@ set_output_target(struct elfcopy *ecp, const char *tar
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);
Modified: head/contrib/elftoolchain/libelftc/elftc.3
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc.3 Wed Feb 12 15:51:29 2020 (r357825)
+++ head/contrib/elftoolchain/libelftc/elftc.3 Wed Feb 12 15:59:59 2020 (r357826)
@@ -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
Modified: head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Wed Feb 12 15:51:29 2020 (r357825)
+++ head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 Wed Feb 12 15:59:59 2020 (r357826)
@@ -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
Modified: head/contrib/elftoolchain/libelftc/elftc_bfdtarget.c
==============================================================================
--- head/contrib/elftoolchain/libelftc/elftc_bfdtarget.c Wed Feb 12 15:51:29 2020 (r357825)
+++ head/contrib/elftoolchain/libelftc/elftc_bfdtarget.c Wed Feb 12 15:59:59 2020 (r357826)
@@ -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);
+}
Modified: head/contrib/elftoolchain/libelftc/libelftc.h
==============================================================================
--- head/contrib/elftoolchain/libelftc/libelftc.h Wed Feb 12 15:51:29 2020 (r357825)
+++ head/contrib/elftoolchain/libelftc/libelftc.h Wed Feb 12 15:59:59 2020 (r357826)
@@ -72,6 +72,7 @@ Elftc_Bfd_Target_Flavor elftc_bfd_target_flavor(Elftc
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);
More information about the svn-src-all
mailing list