# Expect script for linker support of IFUNC symbols and relocations.
#
#   Copyright 2009, 2010 Free Software Foundation, Inc.
#   Contributed by Red Hat.
#
# This file is part of the GNU Binutils.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
#
# Written by Nick Clifton <nickc@redhat.com>


# IFUNC support has only been implemented for the ix86, x86_64, powerpc,
# and sparc so far.
if {!(([istarget "i?86-*-*"]
       || [istarget "x86_64-*-*"]
       || [istarget "powerpc*-*-*"]
       || [istarget "sparc*-*-*"])
      && ([istarget "*-*-elf*"]
	  || (([istarget "*-*-linux*"]
	       || [istarget "*-*-gnu*"])
	      && ![istarget "*-*-*aout*"]
	      && ![istarget "*-*-*oldld*"]))) } {
    verbose "IFUNC tests not run - target does not support IFUNC"
    return
}

# We need a native system.  FIXME: Strictly speaking this
# is not true, we just need to know how to create a fully
# linked executable, including the C and Z libraries, using
# the linker that is under test.
if ![isnative] {
    verbose "IFUNC tests not run - not a native toolchain"
    return
}

# We need a working compiler.  (Strictly speaking this is
# not true, we could use target specific assembler files).
if { [which $CC] == 0 } {
    verbose "IFUNC tests not run - no compiler available"
    return
}

# A procedure to check the OS/ABI field in the ELF header of a binary file.
proc check_osabi { binary_file expected_osabi } {
    global READELF
    global READELFFLAGS

    catch "exec $READELF $READELFFLAGS --file-header $binary_file > readelf.out" got

    if ![string match "" $got] then {
	verbose "proc check_osabi: Readelf produced unexpected out processing $binary_file: $got"
	return 0
    }

    if { ![regexp "\n\[ \]*OS/ABI:\[ \]*(.+)\n\[ \]*ABI" \
	   [file_contents readelf.out] nil osabi] } {
	verbose "proc check_osabi: Readelf failed to extract an ELF header from $binary_file"
	return 0
    }

    if { $osabi == $expected_osabi } {
	return 1
    }

    verbose "Expected OSABI: $expected_osabi, Obtained osabi: $osabi"
    
    return 0
}

# A procedure to confirm that a file contains the IFUNC symbol.
# Returns -1 upon error, 0 if the symbol was not found and 1 if it was found.
proc contains_ifunc_symbol { binary_file } {
    global READELF
    global READELFFLAGS

    catch "exec $READELF $READELFFLAGS --symbols $binary_file > readelf.out" got

    if ![string match "" $got] then {
	verbose "proc contains_ifunc_symbol: Readelf produced unexpected out processing $binary_file: $got"
	return -1
    }

    # Look for a line like this:
    #    58: 0000000000400600    30 IFUNC   GLOBAL DEFAULT   12 library_func2

    if { ![regexp ".*\[ \]*IFUNC\[ \]+GLOBAL\[ \]+DEFAULT\[ \]+\[UND0-9\]+\[ \]+library_func2\n" [file_contents readelf.out]] } {
	return 0
    }

    return 1
}

# A procedure to confirm that a file contains the R_*_IRELATIVE
# relocation.
# Returns -1 upon error, 0 if the relocation was not found and 1 if
# it was found.
proc contains_irelative_reloc { binary_file } {
    global READELF
    global READELFFLAGS

    catch "exec $READELF $READELFFLAGS --relocs --wide $binary_file > readelf.out" got

    if ![string match "" $got] then {
	verbose "proc contains_irelative_reloc: Readelf produced unexpected out processing $binary_file: $got"
	return -1
    }

    # Look for a line like this:
    #    0000000000600ab0  0000000000000025 R_X86_64_IRELATIVE      000000000040061c
    #    080496f4  0000002a R_386_IRELATIVE


    if { ![regexp "\[0-9a-f\]+\[ \]+\[0-9a-f\]+\[ \]+R_\[_0-9A-Z\]+_IREL(|ATIVE)\[ \]*\[0-9a-f\]*\n" [file_contents readelf.out]] } {
	return 0
    }

    return 1
}

# A procedure to confirm that a file contains a relocation that references an IFUNC symbol.
# Returns -1 upon error, 0 if the reloc was not found and 1 if it was found.
proc contains_ifunc_reloc { binary_file } {
    global READELF
    global READELFFLAGS

    catch "exec $READELF $READELFFLAGS --relocs $binary_file > readelf.out" got

    if ![string match "" $got] then {
	verbose "proc contains_ifunc_reloc: Readelf produced unexpected out processing $binary_file: $got"
	return -1
    }

    if [string match "" [file_contents readelf.out]] then {
	verbose "No relocs found in $binary_file"
	return 0
    }

    if { ![regexp "\\(\\)" [file_contents readelf.out]] } {
	return 0
    }

    return 1
}

set fails 0

# Create the object files, libraries and executables.
if ![ld_compile "$CC -c -fPIC" "$srcdir/$subdir/prog.c" "tmpdir/shared_prog.o"] {
    fail "Could not create a PIC object file"
    set fails [expr $fails + 1]
}
if ![ld_compile "$CC -c" "$srcdir/$subdir/prog.c" "tmpdir/static_prog.o"] {
    fail "Could not create a non-PIC object file"
    set fails [expr $fails + 1]
}
if ![ld_compile "$CC -c -fPIC -DWITH_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/shared_ifunc.o"] {
    fail "Could not create a PIC object file containing an IFUNC symbol"
    set fails [expr $fails + 1]
}
if ![ld_compile "$CC -c -DWITH_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/static_ifunc.o"] {
    fail "Could not create a non-PIC object file containing an IFUNC symbol"
    set fails [expr $fails + 1]
}
if ![ld_compile "$CC -c -DWITHOUT_IFUNC" "$srcdir/$subdir/lib.c" "tmpdir/static_noifunc.o"] {
    fail "Could not create an ordinary non-PIC object file"
    set fails [expr $fails + 1]
}
if ![ld_assemble $as "$srcdir/ld-elf/empty.s" "tmpdir/empty.o"] {
    fail "Could not create an empty object file"
    set fails [expr $fails + 1]
}
if ![ld_compile "$CC -c" "$srcdir/$subdir/test-1.c" "tmpdir/test-1.o"] {
    fail "Could not create test-1.o"
    set fails [expr $fails + 1]
}
if ![ld_compile "$CC -fPIC -c" "$srcdir/$subdir/test-2.c" "tmpdir/test-2.o"] {
    fail "Could not create test-2.o"
    set fails [expr $fails + 1]
}

if { $fails != 0 } {
    return
}

if ![ld_simple_link $ld "tmpdir/libshared_ifunc.so" "-shared tmpdir/shared_ifunc.o"] {
    fail "Could not create a shared library containing an IFUNC symbol"
    set fails [expr $fails + 1]
}
if ![ar_simple_create $ar "" "tmpdir/libifunc.a" "tmpdir/static_ifunc.o"] {
    fail "Could not create a static library containing an IFUNC symbol"
    set fails [expr $fails + 1]
}

if { $fails != 0 } {
    return
}

if ![default_ld_link $ld "tmpdir/dynamic_prog" "-Ltmpdir tmpdir/shared_prog.o -Bdynamic -lshared_ifunc -rpath ./tmpdir"] {
    fail "Could not link a dynamic executable"
    set fails [expr $fails + 1]
}
if ![default_ld_link $ld "tmpdir/local_prog" "-Ltmpdir tmpdir/static_prog.o -lifunc"] {
    fail "Could not link a dynamic executable using local ifunc"
    set fails [expr $fails + 1]
}
if ![default_ld_link $ld "tmpdir/static_prog" "-static -Ltmpdir tmpdir/static_prog.o -lifunc"] {
    fail "Could not link a static executable"
    set fails [expr $fails + 1]
}
if ![ld_simple_link $ld "tmpdir/static_nonifunc_prog" "-static tmpdir/empty.o"] {
    fail "Could not link a non-ifunc using static executable"
    set fails [expr $fails + 1]
}
if ![default_ld_link $ld "tmpdir/test-1" "tmpdir/test-1.o tmpdir/libshared_ifunc.so"] {
    fail "Could not link test-1"
    set fails [expr $fails + 1]
}
if ![ld_simple_link $ld "tmpdir/libtest-2.so" "-shared tmpdir/test-2.o"] {
    fail "Could not link libtest-2.so"
    set fails [expr $fails + 1]
}

if { $fails == 0 } {
  pass "Building ifunc binaries"
  set fails 0
} else {
    return
}

# Check the executables and shared libraries
#
# The linked ifunc using executables and the shared library containing
# ifunc should have an OSABI field of LINUX.  The linked non-ifunc using
# executable should have an OSABI field of NONE (aka System V).

if {! [check_osabi tmpdir/libshared_ifunc.so {UNIX - Linux}]} {
    fail "Shared libraries containing ifunc does not have an OS/ABI field of LINUX"
    set fails [expr $fails + 1]
}
if {! [check_osabi tmpdir/local_prog {UNIX - Linux}]} {
    fail "Local ifunc-using executable does not have an OS/ABI field of LINUX"
    set fails [expr $fails + 1]
}
if {! [check_osabi tmpdir/static_prog {UNIX - Linux}]} {
    fail "Static ifunc-using executable does not have an OS/ABI field of LINUX"
    set fails [expr $fails + 1]
}
if {! [check_osabi tmpdir/dynamic_prog {UNIX - System V}]} {
    fail "Dynamic ifunc-using executable does not have an OS/ABI field of System V"
    set fails [expr $fails + 1]
}
if {! [check_osabi tmpdir/static_nonifunc_prog {UNIX - System V}]} {
    fail "Static non-ifunc-using executable does not have an OS/ABI field of System V"
    set fails [expr $fails + 1]
}

# The linked ifunc using executables and the shared library containing
# ifunc should contain an IFUNC symbol.  The non-ifunc using executable
# should not.

if {[contains_ifunc_symbol tmpdir/libshared_ifunc.so] != 1} {
    fail "Shared libraries containing ifunc does not contain an IFUNC symbol"
    set fails [expr $fails + 1]
}
if {[contains_ifunc_symbol tmpdir/local_prog] != 1} {
    fail "Local ifunc-using executable does not contain an IFUNC symbol"
    set fails [expr $fails + 1]
}
if {[contains_ifunc_symbol tmpdir/static_prog] != 1} {
    fail "Static ifunc-using executable does not contain an IFUNC symbol"
    set fails [expr $fails + 1]
}
if {[contains_ifunc_symbol tmpdir/dynamic_prog] != 0} {
    fail "Dynamic ifunc-using executable contains an IFUNC symbol"
    set fails [expr $fails + 1]
}
if {[contains_ifunc_symbol tmpdir/static_nonifunc_prog] != 0} {
    fail "Static non-ifunc-using executable contains an IFUNC symbol"
    set fails [expr $fails + 1]
}
if {[contains_ifunc_symbol tmpdir/test-1] != 0} {
    fail "test-1 contains IFUNC symbols"
    set fails [expr $fails + 1]
}
if {[contains_ifunc_symbol tmpdir/libtest-2.so] != 0} {
    fail "libtest-2.so contains IFUNC symbols"
    set fails [expr $fails + 1]
}

# The linked ifunc using executables and shared libraries should contain
# a dynamic reloc referencing the IFUNC symbol.  (Even the static
# executable which should have a dynamic section created for it).  The
# non-ifunc using executable should not.

if {[contains_irelative_reloc tmpdir/libshared_ifunc.so] != 1} {
    fail "ifunc-using shared library does not contain R_*_IRELATIVE relocation"
    set fails [expr $fails + 1]
}
if {[contains_irelative_reloc tmpdir/local_prog] != 1} {
    fail "Local ifunc-using executable does not contain R_*_IRELATIVE relocation"
    set fails [expr $fails + 1]
}
if {[contains_irelative_reloc tmpdir/static_prog] != 1} {
    fail "Static ifunc-using executable does not contain R_*_IRELATIVE relocation"
    set fails [expr $fails + 1]
}
if {[contains_ifunc_reloc tmpdir/dynamic_prog] != 0} {
    fail "Dynamic ifunc-using executable contains a reloc against an IFUNC symbol"
    set fails [expr $fails + 1]
}
if {[contains_ifunc_reloc tmpdir/static_nonifunc_prog] == 1} {
    fail "Static non-ifunc-using executable contains a reloc against an IFUNC symbol!"
    set fails [expr $fails + 1]
}

if { $fails == 0 } {
  pass "Checking ifunc binaries"
}

# Clean up, unless we are being verbose, in which case we leave the files available.
if { $verbose < 1 } {
    remote_file host delete "tmpdir/shared_prog.o"
    remote_file host delete "tmpdir/static_prog.o"
    remote_file host delete "tmpdir/shared_ifunc.o"
    remote_file host delete "tmpdir/static_ifunc.o"
    remote_file host delete "tmpdir/static_noifunc.o"
    remote_file host delete "tmpdir/libshared_ifunc.so"
    remote_file host delete "tmpdir/libifunc.a"
    remote_file host delete "tmpdir/dynamic_prog"
    remote_file host delete "tmpdir/local_prog"
    remote_file host delete "tmpdir/static_prog"
    remote_file host delete "tmpdir/static_nonifunc_prog"
}

set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach t $test_list {
    # We need to strip the ".d", but can leave the dirname.
    verbose [file rootname $t]
    run_dump_test [file rootname $t]
}
