Linux Audio

Check our new training course

Loading...
v6.2
 1#!/bin/sh
 2# SPDX-License-Identifier: GPL-2.0
 3#
 4# Check whether linker can handle cross-segment @segrel():
 5#
 6CPPFLAGS=""
 7CC=$1
 8OBJDUMP=$2
 9READELF=$3
10dir=$(dirname $0)
11tmp=${TMPDIR:-/tmp}
12out=$tmp/out$$
13
14# Check whether cross-segment segment-relative relocs work fine.  We need
15# that for building the gate DSO:
16
17$CC -nostdlib -static -Wl,-T$dir/check-segrel.lds $dir/check-segrel.S -o $out
18res=$($OBJDUMP --full --section .rodata $out | fgrep 000 | cut -f3 -d' ')
19rm -f $out
20if [ $res != 00000a00 ]; then
21    CPPFLAGS="$CPPFLAGS -DHAVE_BUGGY_SEGREL"
22    cat >&2 <<EOF
23warning: your linker cannot handle cross-segment segment-relative relocations.
24         please upgrade to a newer version (it is safe to use this linker, but
25         the kernel will be bigger than strictly necessary).
26EOF
27fi
28
29# Check whether .align inside a function works as expected.
30
31$CC -c $dir/check-text-align.S -o $out
32$READELF -u $out | fgrep -q 'prologue(rlen=12)'
33res=$?
34rm -f $out
35if [ $res -eq 0 ]; then
36    CPPFLAGS="$CPPFLAGS -DHAVE_WORKING_TEXT_ALIGN"
37fi
38
39if ! $CC -c $dir/check-model.c -o $out 2>&1 | grep  __model__ | grep -q attrib
40then
41    CPPFLAGS="$CPPFLAGS -DHAVE_MODEL_SMALL_ATTRIBUTE"
42fi
43rm -f $out
44
45# Check whether assembler supports .serialize.{data,instruction} directive.
46
47$CC -c $dir/check-serialize.S -o $out 2>/dev/null
48res=$?
49rm -f $out
50if [ $res -eq 0 ]; then
51    CPPFLAGS="$CPPFLAGS -DHAVE_SERIALIZE_DIRECTIVE"
52fi
53
54echo $CPPFLAGS
v3.1
 1#!/bin/sh
 
 2#
 3# Check whether linker can handle cross-segment @segrel():
 4#
 5CPPFLAGS=""
 6CC=$1
 7OBJDUMP=$2
 8READELF=$3
 9dir=$(dirname $0)
10tmp=${TMPDIR:-/tmp}
11out=$tmp/out$$
12
13# Check whether cross-segment segment-relative relocs work fine.  We need
14# that for building the gate DSO:
15
16$CC -nostdlib -static -Wl,-T$dir/check-segrel.lds $dir/check-segrel.S -o $out
17res=$($OBJDUMP --full --section .rodata $out | fgrep 000 | cut -f3 -d' ')
18rm -f $out
19if [ $res != 00000a00 ]; then
20    CPPFLAGS="$CPPFLAGS -DHAVE_BUGGY_SEGREL"
21    cat >&2 <<EOF
22warning: your linker cannot handle cross-segment segment-relative relocations.
23         please upgrade to a newer version (it is safe to use this linker, but
24         the kernel will be bigger than strictly necessary).
25EOF
26fi
27
28# Check whether .align inside a function works as expected.
29
30$CC -c $dir/check-text-align.S -o $out
31$READELF -u $out | fgrep -q 'prologue(rlen=12)'
32res=$?
33rm -f $out
34if [ $res -eq 0 ]; then
35    CPPFLAGS="$CPPFLAGS -DHAVE_WORKING_TEXT_ALIGN"
36fi
37
38if ! $CC -c $dir/check-model.c -o $out 2>&1 | grep  __model__ | grep -q attrib
39then
40    CPPFLAGS="$CPPFLAGS -DHAVE_MODEL_SMALL_ATTRIBUTE"
41fi
42rm -f $out
43
44# Check whether assembler supports .serialize.{data,instruction} directive.
45
46$CC -c $dir/check-serialize.S -o $out 2>/dev/null
47res=$?
48rm -f $out
49if [ $res -eq 0 ]; then
50    CPPFLAGS="$CPPFLAGS -DHAVE_SERIALIZE_DIRECTIVE"
51fi
52
53echo $CPPFLAGS