1#!/usr/local/bin/bash
2# Copyright (C) 2014 Red Hat, Inc.
3# Copyright (C) 2016 Oracle, Inc.
4# This file is part of elfutils.
5#
6# This file is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# elfutils is distributed in the hope that it will be useful, but
12# WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
19. $srcdir/test-subr.sh
20
21# See run-addrcfi.sh for testfilearm.
22
23# = testfileppc32attrs.s =
24# .gnu_attribute 8,1
25# .gnu_attribute 12,1
26#
27# gcc -m32 -c testfileppc32attrs.s
28
29# = testfilesparc64attrs.s =
30# .gnu_attribute 4,0x0aaaaaaa
31# .gnu_attribute 8,0x00000055
32#
33# gcc -c testfilesparc64attrs.s
34
35# = testfileppc64attrs.s =
36# .gnu_attribute 4,3
37#
38# gcc -c testfileppc64attrs.s
39
40testfiles testfilearm testfileppc32attrs.o testfilesparc64attrs.o testfileppc64attrs.o
41
42testrun_compare ${abs_top_builddir}/src/readelf -A testfilearm <<\EOF
43
44Object attributes section [27] '.ARM.attributes' of 53 bytes at offset 0x718:
45  Owner          Size
46  aeabi            52
47    File:          42
48      CPU_name: 7-A
49      CPU_arch: v7
50      CPU_arch_profile: Application
51      ARM_ISA_use: Yes
52      THUMB_ISA_use: Thumb-2
53      VFP_arch: VFPv3-D16
54      ABI_PCS_wchar_t: 4
55      ABI_FP_rounding: Needed
56      ABI_FP_denormal: Needed
57      ABI_FP_exceptions: Needed
58      ABI_FP_number_model: IEEE 754
59      ABI_align8_needed: Yes
60      ABI_align8_preserved: Yes, except leaf SP
61      ABI_enum_size: int
62      ABI_HardFP_use: SP and DP
63      ABI_VFP_args: VFP registers
64      CPU_unaligned_access: v6
65EOF
66
67testrun_compare ${abs_top_builddir}/src/readelf -A testfileppc32attrs.o <<\EOF
68
69Object attributes section [ 4] '.gnu.attributes' of 18 bytes at offset 0x34:
70  Owner          Size
71  gnu              17
72    File:           9
73      GNU_Power_ABI_Vector: Generic
74      GNU_Power_ABI_Struct_Return: r3/r4
75EOF
76
77testrun_compare ${abs_top_builddir}/src/readelf -A testfilesparc64attrs.o <<\EOF
78
79Object attributes section [ 4] '.gnu.attributes' of 21 bytes at offset 0x40:
80  Owner          Size
81  gnu              20
82    File:          12
83      GNU_Sparc_HWCAPS: div32,v8plus,vis,asi_blk_init,vis3,random,fjfmau,asi_cache_sparing,des,camellia,sha1,sha512,mont,cbcond
84      GNU_Sparc_HWCAPS2: fjathplus,adp,mwait,xmont
85EOF
86
87testrun_compare ${abs_top_builddir}/src/readelf -A testfileppc64attrs.o <<\EOF
88
89Object attributes section [ 4] '.gnu.attributes' of 16 bytes at offset 0x40:
90  Owner          Size
91  gnu              15
92    File:           7
93      GNU_Power_ABI_FP: Single-precision hard float
94EOF
95
96exit 0
97