set exec_output [run_host_cmd "sh" \
                              "-c \"ulimit -n 20; \
-                             $CC_FOR_TARGET -Btmpdir/ld -o tmpdir/pr28138 \
+                             $CC_FOR_TARGET $gcc_B_opt $CFLAGS_FOR_TARGET \
+                             $ld_L_opt -o tmpdir/pr28138 \
                              tmpdir/pr28138.o tmpdir/pr28138.a\""]
 set exec_output [prune_warnings $exec_output]
 if [string match "" $exec_output] then {
 
     global subdir
     global env
     global CC_FOR_TARGET
-    global CFLAGS_FOR_TARGET
     global runtests
     global exec_output
 
                set objfile "tmpdir/$fileroot.o"
                if { [file extension $src_file] == ".c" } {
                    set as_file "tmpdir/$fileroot.s"
-                   if ![ld_compile "$CC_FOR_TARGET -S $CFLAGS_FOR_TARGET $cflags" $srcdir/$subdir/$src_file $as_file] {
+                   if ![ld_compile "$CC_FOR_TARGET -S $cflags" $srcdir/$subdir/$src_file $as_file] {
                        set is_unsupported 1
                        break
                    }
     global env
     global CC_FOR_TARGET
     global CXX_FOR_TARGET
-    global CFLAGS_FOR_TARGET
-    global CXXFLAGS_FOR_TARGET
     global errcnt
     global exec_output
     global board_cflags
            lappend objfiles $objfile
 
            if { [ string match "c++" $lang ] } {
-               set cmd "$CXX_FOR_TARGET -c $CXXFLAGS_FOR_TARGET $cflags"
+               set cmd "$CXX_FOR_TARGET -c $cflags"
            } else {
-               set cmd "$CC_FOR_TARGET -c $CFLAGS_FOR_TARGET $cflags"
+               set cmd "$CC_FOR_TARGET -c $cflags"
            }
            if ![ld_compile $cmd $srcdir/$subdir/$src_file $objfile] {
                set failed 1
     global env
     global CC_FOR_TARGET
     global CXX_FOR_TARGET
-    global CFLAGS_FOR_TARGET
-    global CXXFLAGS_FOR_TARGET
     global ar
     global exec_output
     global board_cflags
            lappend objfiles $objfile
 
            if { [ string match "c++" $lang ] } {
-               set cmd "$CXX_FOR_TARGET -c $CXXFLAGS_FOR_TARGET $cflags"
+               set cmd "$CXX_FOR_TARGET -c $cflags"
            } else {
-               set cmd "$CC_FOR_TARGET -c $CFLAGS_FOR_TARGET $cflags"
+               set cmd "$CC_FOR_TARGET -c $cflags"
            }
            if ![ld_compile $cmd $srcdir/$subdir/$src_file $objfile] {
                set failed 1