xref: /illumos-gate/usr/src/test/elf-tests/tests/sections/shf-exclude/include-reloc.sh (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
1#!/bin/ksh
2#
3# This file and its contents are supplied under the terms of the
4# Common Development and Distribution License ("CDDL"), version 1.0.
5# You may only use this file in accordance with the terms of version
6# 1.0 of the CDDL.
7#
8# A full copy of the text of the CDDL should have accompanied this
9# source.  A copy of the CDDL is also available via the Internet at
10# http://www.illumos.org/license/CDDL.
11#
12
13# Copyright 2021, Richard Lowe.
14
15TESTDIR=$(dirname $0)
16
17tmpdir=/tmp/test.$$
18mkdir $tmpdir
19cd $tmpdir
20
21cleanup() {
22	cd /
23	rm -fr $tmpdir
24}
25
26trap 'cleanup' EXIT
27
28if [[ $PWD != $tmpdir ]]; then
29	print -u2 "Failed to create temporary directory: $tmpdir"
30	exit 1;
31fi
32
33make -f ${TESTDIR}/Makefile.test SRCDIR=${TESTDIR} test.o
34if (( $? != 0 )); then
35	print -u2 "FAIL: Failed to link relocatable object"
36	exit 1;
37fi
38
39elfdump -cN.test test.o | grep -q SHF_EXCLUDE
40if (( $? != 0 )); then
41	print -u2 "FAIL: SHF_EXCLUDE section was not linked into relocatable object"
42	exit 1;
43fi
44