[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Update bug 814978 to: found in gcc-6 and severity serious



severity 814978 serious
found 814978 6.3.0-5
tags 814978 patch
usertags gnat-6
thanks

Hi,

Looking into the problems with the acats tests not being run reveals problems
with the ada-gcc-name.diff and ada-acats.diff patches.
Adding gcc-6 to the files in ada-gcc-name.diff makes the functions
Locate_Executable in gnatchop.adb and Program_Name called in gnatlink.adb and
gnatmake(make.adb) confused and adds -6 to the full program names, e.g. for
Linux amd64:
x86_64-linux-gnu-gnatchop-6
x86_64-linux-gnu-gnatlink-6
x86_64-linux-gnu-gnatmake-6
causing these to not be found. The first does also disables the acats testsuite.
One solution is to remove the ada-gcc-name.diff patch, and (temporarily) add --
GCC=gcc-6 to the execution of the run_acats script since already installed
versions all carry this bug. Of course modifying the Ada functions would also be
a solution.

The program name problems are easily shown as:
gnatchop:
Via path: OK
gnatchop macrosub.ada
Direct nOK:
/usr/bin/gnatchop macrosub.ada
x86_64-linux-gnu-gcc-6-6: installation problem, executable not found

gnatlink:
Via path: OK
gnatlink macrosub.ali
Direct: OK
/usr/bin/gnatlink macrosub.ali
/usr/bin/x86_64-linux-gnu-gnatlink macrosub.ali
Direct with full name: nOK
/usr/bin/x86_64-linux-gnu-gnatlink-6 macrosub.ali
x86_64-linux-gnu-gnatlink-6: Couldn't locate x86_64-linux-gnu-gcc-6-6

gnatmake:
OK:
gnatmake, gnatmake-6 macrosub.ali
/usr/bin/x86_64-linux-gnu-gnatmake ../test/macrosub.adb
nOK:
/usr/bin/x86_64-linux-gnu-gnatmake-6 ../test/macrosub.adb
x86_64-linux-gnu-gcc-6-6 -c -I../test/ -I- ../test/macrosub.adb
x86_64-linux-gnu-gnatmake-6: error, unable to locate x86_64-linux-gnu-gcc-6-6

Note:
The ada-gcc-name.diff patch also patches three other files:
prj-makr.adb, mlib-utl.adb linked into libgnatprj.so.0.6
mlic-utl.adb: Not compiled.
Maybe they are still needed. This has not been investigated yet.

The second part of the patch includes editing out a blank and a carriage return
when setting the environment variable target_bit [32,64], see below.

The patch changes are summarized below:
1) debian/patches/series: comment out debian/patches/ada-gcc-name.diff
2) Updated patch: debian/patches/ada-acats.diff
diff -u ada-acats.diff.orig ada-acats.diff

gcc-6-6.3.0/src/gcc/testsuite/ada/acats/run_acats
-+echo exec /usr/bin/gnatchop '$*' >> host_gnatchop
++echo exec /usr/bin/gnatchop --GCC=gcc-6 '$*' >> host_gnatchop

gcc-6-6.3.0/src/gcc/testsuite/ada/acats/run_all.sh
-target_bit=`cat $dir/support/impbit.out`
-+target_bit=`cat $dir/support/impbit.out` | sed -e 's/\r//g'
++target_bit=`cat $dir/support/impbit.out | sed -e 's/ //g' -e 's/\r//g'`

Thanks!
# DP: - When running the ACATS, look for the gnat tools in their new
# DP:   directory (build/gnattools), and for the shared libraries in
# DP:   build/gcc/ada/rts, build/libgnatvsn and build/libgnatprj.

Index: gcc-6-6.3.0/src/gcc/testsuite/ada/acats/run_acats
===================================================================
--- gcc-6-6.3.0.orig/src/gcc/testsuite/ada/acats/run_acats
+++ gcc-6-6.3.0/src/gcc/testsuite/ada/acats/run_acats
@@ -20,52 +20,30 @@ which () {
     return 1
 }
 
+echo '#!/bin/sh' > host_gnatchop
+echo exec /usr/bin/gnatchop --GCC=gcc-6 '$*' >> host_gnatchop
+
+chmod +x host_gnatchop
+
+echo '#!/bin/sh' > host_gnatmake
+echo echo '$PATH' '$*' >> host_gnatmake
+echo exec /usr/bin/gnatmake '$*' >> host_gnatmake
+
+chmod +x host_gnatmake
+
 # Set up environment to use the Ada compiler from the object tree
 
-host_gnatchop=`which gnatchop`
-host_gnatmake=`which gnatmake`
 ROOT=`${PWDCMD-pwd}`
 BASE=`cd $ROOT/../../..; ${PWDCMD-pwd}`
-
 PATH=$BASE:$ROOT:$PATH
-ADA_INCLUDE_PATH=$BASE/ada/rts
-LD_LIBRARY_PATH=$ADA_INCLUDE_PATH:$BASE:$LD_LIBRARY_PATH
-ADA_OBJECTS_PATH=$ADA_INCLUDE_PATH
-
-if [ ! -d $ADA_INCLUDE_PATH ]; then
-   echo gnatlib missing, exiting.
-   exit 1
-fi
-
-if [ ! -f $BASE/gnatchop ]; then
-   echo gnattools missing, exiting.
-   exit 1
-fi
-
-if [ ! -f $BASE/gnatmake ]; then
-   echo gnattools missing, exiting.
-   exit 1
-fi
-
 GCC_DRIVER="$BASE/xgcc"
+TARGET=`${GCC_DRIVER} -v  2>&1 |grep '^Target:' | cut -d' ' -f2`
+GNATTOOLS=`cd $BASE/../gnattools; ${PWDCMD-pwd}`
+LIBGNATVSN=`cd $BASE/../${TARGET}/libgnatvsn; ${PWDCMD-pwd}`
+LIBGNATPRJ=`cd $BASE/../${TARGET}/libgnatprj; ${PWDCMD-pwd}`
 GCC="$BASE/xgcc -B$BASE/"
 export PATH ADA_INCLUDE_PATH ADA_OBJECTS_PATH GCC_DRIVER GCC LD_LIBRARY_PATH
-
-echo '#!/bin/sh' > host_gnatchop
-echo PATH=`dirname $host_gnatchop`:'$PATH' >> host_gnatchop
-echo unset ADA_INCLUDE_PATH ADA_OBJECTS_PATH GCC_EXEC_PREFIX >> host_gnatchop
-echo export PATH >> host_gnatchop
-echo exec gnatchop '"$@"' >> host_gnatchop
-
-chmod +x host_gnatchop
-
-echo '#!/bin/sh' > host_gnatmake
-echo PATH=`dirname $host_gnatmake`:'$PATH' >> host_gnatmake
-echo unset ADA_INCLUDE_PATH ADA_OBJECTS_PATH GCC_EXEC_PREFIX >> host_gnatmake
-echo export PATH >> host_gnatmake
-echo exec gnatmake '"$@"' >> host_gnatmake
-
-chmod +x host_gnatmake
+export GNATTOOLS LIBGNATVSN LIBGNATPRJ
 
 # Limit the stack to 16MB for stack checking
 ulimit -s 16384
Index: gcc-6-6.3.0/src/gcc/testsuite/ada/acats/run_all.sh
===================================================================
--- gcc-6-6.3.0.orig/src/gcc/testsuite/ada/acats/run_all.sh
+++ gcc-6-6.3.0/src/gcc/testsuite/ada/acats/run_all.sh
@@ -1,4 +1,5 @@
 #!/bin/sh
+
 # Run ACATS with the GNU Ada compiler
 
 # The following functions are to be customized if you run in cross
@@ -12,6 +13,10 @@
 gccflags="-O2"
 gnatflags="-gnatws"
 
+RTS=`cd $GNATTOOLS/../gcc/ada/rts; ${PWDCMD-pwd}`
+LD_LIBRARY_PATH=$RTS:$LIBGNATVSN:$LIBGNATPRJ
+export LD_LIBRARY_PATH
+
 target_run () {
   eval $EXPECT -f $testdir/run_test.exp $*
 }
@@ -63,12 +68,15 @@ if [ "$dir" = "$testdir" ]; then
 fi
 
 target_gnatchop () {
-  gnatchop --GCC="$GCC_DRIVER" $*
+  ADA_INCLUDE_PATH=$GNATTOOLS/../../src/gcc/ada $GNATTOOLS/gnatchop --GCC="$GCC_DRIVER" $*
 }
 
 target_gnatmake () {
-  echo gnatmake --GCC=\"$GCC\" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC=\"$GCC\"
-  gnatmake --GCC="$GCC" $gnatflags $gccflags $* -largs $EXTERNAL_OBJECTS --GCC="$GCC"
+  EXTERNAL_OBJECTS="$EXTERNAL_OBJECTS $RTS/adaint.o $RTS/sysdep.o $RTS/init.o $RTS/raise-gcc.o"
+  $GNATTOOLS/gnatmake -I- -I$RTS -I. \
+      --GCC="$GCC" --GNATBIND="$GNATTOOLS/gnatbind" \
+      --GNATLINK="$GNATTOOLS/gnatlink" $gnatflags $gccflags $* \
+      -bargs -static -largs $EXTERNAL_OBJECTS --GCC="$GCC -I- -I$RTS -I."
 }
 
 target_gcc () {
@@ -101,8 +109,8 @@ display target gcc is $GCC
 display `$GCC -v 2>&1`
 display host=`gcc -dumpmachine`
 display target=$target
-display `type gnatmake`
-gnatls -v >> $dir/acats.log
+display `type $GNATTOOLS/gnatmake`
+$GNATTOOLS/gnatls -I- -I$RTS -v >> $dir/acats.log
 display ""
 
 if [ -n "$GCC_RUNTEST_PARALLELIZE_DIR" ]; then
@@ -129,7 +137,7 @@ cp $testdir/support/*.ada $testdir/suppo
 # Find out the size in bit of an address on the target
 target_gnatmake $testdir/support/impbit.adb >> $dir/acats.log 2>&1
 target_run $dir/support/impbit > $dir/support/impbit.out 2>&1
-target_bit=`cat $dir/support/impbit.out`
+target_bit=`cat $dir/support/impbit.out | sed -e 's/ //g' -e 's/\r//g'`
 echo target_bit="$target_bit" >> $dir/acats.log
 
 # Find out a suitable asm statement
Index: gcc-6-6.3.0/src/gcc/testsuite/lib/gnat.exp
===================================================================
--- gcc-6-6.3.0.orig/src/gcc/testsuite/lib/gnat.exp
+++ gcc-6-6.3.0/src/gcc/testsuite/lib/gnat.exp
@@ -88,18 +88,25 @@ proc gnat_init { args } {
     global GNAT_UNDER_TEST
     global TOOL_EXECUTABLE
     global gnat_target_current
+    global ld_library_path
 
     set gnat_target_current ""
 
     if { $gnat_initialized == 1 } { return }
 
-    if ![info exists GNAT_UNDER_TEST] then {
-	if [info exists TOOL_EXECUTABLE] {
-	    set GNAT_UNDER_TEST "$TOOL_EXECUTABLE"
-	} else {
-	    set GNAT_UNDER_TEST "[local_find_gnatmake]"
-	}
-    }
+    set target [target_info name]
+    set GNAT_UNDER_TEST "$rootme/../gnattools/gnatmake -I$rootme/ada/rts --GCC=$rootme/xgcc --GNATBIND=$rootme/../gnattools/gnatbind --GNATLINK=$rootme/../gnattools/gnatlink -cargs -B$rootme -largs --GCC=$rootme/xgcc -B$rootme -margs"
+    append ld_library_path ":$rootme/ada/rts"
+    append ld_library_path ":$rootme/../$target/libgnatvsn"
+    append ld_library_path ":$rootme/../$target/libgnatprj"
+    set_ld_library_path_env_vars
+
+    # gnatlink looks for system.ads itself and has no --RTS option, so
+    # specify via environment
+    verbose -log "ADA_INCLUDE_PATH=$rootme/ada/rts"
+    verbose -log "ADA_OBJECTS_PATH=$rootme/ada/rts"
+    setenv ADA_INCLUDE_PATH "$rootme/ada/rts"
+    setenv ADA_OBJECTS_PATH "$rootme/ada/rts"
 
     if ![info exists tmpdir] then {
 	set tmpdir /tmp
@@ -121,31 +128,6 @@ proc gnat_target_compile { source dest t
 	return [gcc_target_compile $source $dest $type $options]
     }
 
-    # If we detect a change of target, we need to recompute both
-    # GNAT_UNDER_TEST and the appropriate RTS.
-    if { $gnat_target_current!="[current_target_name]" } {
-	set gnat_target_current "[current_target_name]"
-	if [info exists TOOL_OPTIONS] {
-	    set rtsdir "[get_multilibs ${TOOL_OPTIONS}]/libada"
-	} else {
-	    set rtsdir "[get_multilibs]/libada"
-	}
-	if [info exists TOOL_EXECUTABLE] {
-	    set GNAT_UNDER_TEST "$TOOL_EXECUTABLE"
-	} else {
-	    set GNAT_UNDER_TEST "[local_find_gnatmake]"
-	}
-        set GNAT_UNDER_TEST "$GNAT_UNDER_TEST --RTS=$rtsdir"
-
-	# gnatlink looks for system.ads itself and has no --RTS option, so
-	# specify via environment
-	setenv ADA_INCLUDE_PATH "$rtsdir/adainclude"
-	setenv ADA_OBJECTS_PATH "$rtsdir/adainclude"
-	# Always log so compilations can be repeated manually.
-	verbose -log "ADA_INCLUDE_PATH=$rtsdir/adainclude"
-	verbose -log "ADA_OBJECTS_PATH=$rtsdir/adainclude"
-    }
-
     lappend options "compiler=$GNAT_UNDER_TEST -q -f"
     lappend options "timeout=[timeout_value]"
 

Reply to: