This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] backends: Add support for EM_PPC64 GNU_ATTRIBUTES.


ppc64 and ppc64le ELF files can also contain a power specific
.gnu.attributes section. Add support for those and recognize the new
GNU_Power_ABI_FP Single-precision hard float value.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 backends/ChangeLog             |   6 ++++++
 backends/ppc64_init.c          |   1 +
 backends/ppc_attrs.c           |   1 +
 tests/ChangeLog                |   5 +++++
 tests/Makefile.am              |   4 ++--
 tests/run-readelf-A.sh         |  16 +++++++++++++++-
 tests/testfileppc64attrs.o.bz2 | Bin 0 -> 222 bytes
 7 files changed, 30 insertions(+), 3 deletions(-)
 create mode 100644 tests/testfileppc64attrs.o.bz2

diff --git a/backends/ChangeLog b/backends/ChangeLog
index 1c561b5..39390cb 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,9 @@
+2017-02-15  Mark Wielaard  <mark@klomp.org>
+
+	* ppc64_init.c (ppc64_init): Add check_object_attribute HOOK.
+	* ppc_attrs.c (ppc_check_object_attribute): Add Single-precision hard
+	float.
+
 2016-11-02  Mark Wielaard  <mjw@redhat.com>
 
 	* i386_regs.c (i386_register_info): Add fallthrough comment.
diff --git a/backends/ppc64_init.c b/backends/ppc64_init.c
index 2ba8232..11d3a77 100644
--- a/backends/ppc64_init.c
+++ b/backends/ppc64_init.c
@@ -67,6 +67,7 @@ ppc64_init (Elf *elf __attribute__ ((unused)),
   HOOK (eh, syscall_abi);
   HOOK (eh, core_note);
   HOOK (eh, auxv_info);
+  HOOK (eh, check_object_attribute);
   HOOK (eh, abi_cfi);
   /* gcc/config/ #define DWARF_FRAME_REGISTERS.  */
   eh->frame_nregs = (114 - 1) + 32;
diff --git a/backends/ppc_attrs.c b/backends/ppc_attrs.c
index 612c576..48d7129 100644
--- a/backends/ppc_attrs.c
+++ b/backends/ppc_attrs.c
@@ -51,6 +51,7 @@ ppc_check_object_attribute (Ebl *ebl __attribute__ ((unused)),
 	    "Hard or soft float",
 	    "Hard float",
 	    "Soft float",
+	    "Single-precision hard float",
 	  };
 	if (value < sizeof fp_kinds / sizeof fp_kinds[0])
 	  *value_name = fp_kinds[value];
diff --git a/tests/ChangeLog b/tests/ChangeLog
index bca47be..994ff1f 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-15  Ulf Hermann  <ulf.hermann@qt.io>
+
+	* Makefile.am (EXTRA_DIST): Add testfileppc64attrs.o.bz2.
+	* run-readelf-A.sh: Add testfileppc64.o test.
+
 2017-02-09  Ulf Hermann  <ulf.hermann@qt.io>
 
 	* backtrace.c: Add an option to allow unknown symbols in the trace
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d4659cd..a27e868 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 ##
-## Copyright (C) 1996-2016 Red Hat, Inc.
+## Copyright (C) 1996-2017 Red Hat, Inc.
 ## This file is part of elfutils.
 ##
 ## This file is free software; you can redistribute it and/or modify
@@ -317,7 +317,7 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh \
 	     run-aggregate-size.sh testfile-sizes1.o.bz2 testfile-sizes2.o.bz2 \
 	     testfile-sizes3.o.bz2 \
 	     run-readelf-A.sh testfileppc32attrs.o.bz2 \
-	     testfilesparc64attrs.o.bz2 \
+	     testfilesparc64attrs.o.bz2 testfileppc64attrs.o.bz2 \
 	     testfile-debug-types.bz2 \
 	     run-getsrc-die.sh run-strptr.sh \
 	     testfile-x32-core.bz2 testfile-x32.bz2 \
diff --git a/tests/run-readelf-A.sh b/tests/run-readelf-A.sh
index 03d511c..b7432be 100755
--- a/tests/run-readelf-A.sh
+++ b/tests/run-readelf-A.sh
@@ -32,7 +32,12 @@
 #
 # gcc -c testfilesparc64attrs.s
 
-testfiles testfilearm testfileppc32attrs.o testfilesparc64attrs.o
+# = testfileppc64attrs.s =
+# .gnu_attribute 4,3
+#
+# gcc -c testfileppc64attrs.s
+
+testfiles testfilearm testfileppc32attrs.o testfilesparc64attrs.o testfileppc64attrs.o
 
 testrun_compare ${abs_top_builddir}/src/readelf -A testfilearm <<\EOF
 
@@ -79,4 +84,13 @@ Object attributes section [ 4] '.gnu.attributes' of 21 bytes at offset 0x40:
       GNU_Sparc_HWCAPS2: fjathplus,adp,mwait,xmont
 EOF
 
+testrun_compare ${abs_top_builddir}/src/readelf -A testfileppc64attrs.o <<\EOF
+
+Object attributes section [ 4] '.gnu.attributes' of 16 bytes at offset 0x40:
+  Owner          Size
+  gnu              15
+    File:           7
+      GNU_Power_ABI_FP: Single-precision hard float
+EOF
+
 exit 0
diff --git a/tests/testfileppc64attrs.o.bz2 b/tests/testfileppc64attrs.o.bz2
new file mode 100644
index 0000000000000000000000000000000000000000..5af2ab6f1cb99e3a7e9bd7cdcb872da218a8f9b1
GIT binary patch
literal 222
zcmV<403rWET4*^jL0KkKS)xBPg#ZAve}w<+>PR4k00d(MKma!5o?w7r0syc8wqVgD
z@=rv<Flhj3fJSH$G(ZDDXaE2J0z{+@0MIlI0iXtfCw#(Yys=<_Xc7V20_-O`Kw_1W
z4-?M%pm?Q7ghPc;QLY3nG(dq-f(n@o8%eZYWXuI^(^fuewiZ~mF4KB-#>uCE<k6#S
z>OfMvj55gxRJ23rB0<REO5p_>S@lG;hTU@51^4zN{Con@-$wr%I$5dThoR>K?K)EO
Y!nF@|<d#Z0N4DbbNT&)C6i4Q8pfqk?p#T5?

literal 0
HcmV?d00001

-- 
1.8.3.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]