diff --git a/tests/usr.bin/ld/t_script.sh b/tests/usr.bin/ld/t_script.sh index 448ab2c49780..39d660561ade 100644 --- a/tests/usr.bin/ld/t_script.sh +++ b/tests/usr.bin/ld/t_script.sh @@ -1,4 +1,4 @@ -# $NetBSD: t_script.sh,v 1.2 2014/11/15 03:10:01 uebayasi Exp $ +# $NetBSD: t_script.sh,v 1.3 2014/11/15 03:47:29 uebayasi Exp $ # # Copyright (c) 2014 The NetBSD Foundation, Inc. # All rights reserved. @@ -25,6 +25,40 @@ # POSSIBILITY OF SUCH DAMAGE. # +################################################################################ + +atf_test_case order +order_head() { + atf_set "descr" "check if object ordering work" + atf_set "require.progs" "cc" "ld" "readelf" "nm" "sed" "grep" +} + +order_body() { + for i in a b c; do + cat > $i.c << EOF +#include +char $i __section(".data.$i") = '$i'; +EOF + done + cat > test.c << EOF +int main(void) { return 0; } +EOF + # c -> b -> a + atf_check -s exit:0 -o ignore -e ignore \ + cc -o test test.c c.c b.c a.c + extract_symbol_names test | + grep '^[abc]$' >test.syms + { + match c && + match b && + match a && + : + }