# Test DEFINED in a linker script.
# By Ian Lance Taylor, Cygnus Support.

if ![ld_assemble $as $srcdir$subdir/defined.s tmpdir/def.o] { return }

set prms_id 5699

if ![ld_simple_link $ld tmpdir/def "-T $srcdir$subdir/defined.t tmpdir/def.o"] {
    fail DEFINED
} else {
    if [ld_nm $nm tmpdir/def] {
	if {![info exists nm_output(value1)] \
	     || ![info exists nm_output(value2)]} {
	    fail "DEFINED (bad output from $nm)"
	} else {
	    if {$nm_output(value1) != 1} {
		fail "DEFINED (value1 == $nm_output(value1))"
	    } else {
		if {$nm_output(value2) != 2} {
		    fail "DEFINED (value2 == $nm_output(value2))"
		} else {
		    pass DEFINED
		}
	    }
	}
    }
}

set prms_id 0
