]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
backends: Add support for EM_PPC64 GNU_ATTRIBUTES.
authorMark Wielaard <mark@klomp.org>
Wed, 15 Feb 2017 13:30:27 +0000 (14:30 +0100)
committerMark Wielaard <mark@klomp.org>
Fri, 24 Mar 2017 16:34:33 +0000 (17:34 +0100)
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
backends/ppc64_init.c
backends/ppc_attrs.c
tests/ChangeLog
tests/Makefile.am
tests/run-readelf-A.sh
tests/testfileppc64attrs.o.bz2 [new file with mode: 0644]

index 1c561b50183b8e2b86add4cdc8e55b0f92402683..39390cb834c0bf769688fd01f39b9119cfe7499d 100644 (file)
@@ -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.
index 2ba823271861ba927b087a699791f98ade05fec7..11d3a77ffd4b515310adbb39e9e5f40fb7d3f96d 100644 (file)
@@ -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;
index 612c5769ee0acd4c47d133a399702d7acd2f3a6f..48d7129d01b814d8d1798880d9904258f653f22a 100644 (file)
@@ -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];
index cc6a19bf1351ca86d95e48cf2e7f0daa69033e10..e6656c75e712ce0124c90525f731cc9153147456 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-15  Mark Wielaard  <mark@klomp.org>
+
+       * Makefile.am (EXTRA_DIST): Add testfileppc64attrs.o.bz2.
+       * run-readelf-A.sh: Add testfileppc64.o test.
+
 2017-02-15  Ulf Hermann  <ulf.hermann@qt.io>
 
        * elfstrmerge.c: Include system.h.
index d4659cdb1fbbbbb53694a4e4eaeee424c02728db..a27e8687fd120ca6243d65c34fcc0cb268e071cb 100644 (file)
@@ -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 \
index 03d511c9909413c15a8672372c31edcf2419fb5c..b7432becbd4d4c5211e985bdc426f7aed7a9f648 100755 (executable)
 #
 # 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 (file)
index 0000000..5af2ab6
Binary files /dev/null and b/tests/testfileppc64attrs.o.bz2 differ