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

Bug#1050641: gcl: FTBFS on riscv64: Unknown reloc type 57



Source: gcl
Version: 2.6.14-4
Severity: important
Tags: ftbfs
User: debian-riscv@lists.debian.org
Usertags: riscv64
X-Debbugs-Cc: debian-riscv@lists.debian.org

Dear maintainer,

gcl fails to build from source on riscv64 while it was building in the
past. This is the relevant part of the build log:

| echo '(load "../tkl.o")(TK::GET-AUTOLOADS (directory "*.lisp"))' | ../../unixport/saved_gcl) 
| GCL (GNU Common Lisp)  2.6.14 Fri Jan 13 10:47:56 AM EST 2023  CLtL1  profiling  git: Version_2_6_15pre3
| Source License: LGPL(gcl,gmp), GPL(unexec,bfd,xgcl)
| Binary License:  GPL due to GPL'ed components: (XGCL UNEXEC)
| Modifications of this banner must retain notice of a compatible license
| Dedicated to the memory of W. Schelter
| 
| Use (help) to get some basic information on how to use GCL.
| Temporary directory for compiler files:
| /tmp/
| 
| >;; Loading "../tkl.o"
| Unknown reloc type 57
| 
| Error: ERROR "The assertion !emsg(\"Unknown reloc type %lu\\n\", tp) on line 186 of sfaslelf.c in function relocate failed: Success"
| Fast links are on: do (si::use-fast-links nil) for debugging
| Signalled by LOAD.
| ERROR "The assertion !emsg(\"Unknown reloc type %lu\\n\", tp) on line 186 of sfaslelf.c in function relocate failed: Success"
| 
| Broken at LOAD.  Type :H for Help.
|     1  Return to top level. 
| >>
| Error: UNDEFINED-FUNCTION :NAME TK::GET-AUTOLOADS
| Fast links are on: do (si::use-fast-links nil) for debugging
| Signalled by LOAD.
| 
| UNDEFINED-FUNCTION :NAME TK::GET-AUTOLOADS
| 
| Broken at LOAD.
|     1 (abort) Return to debug level 1. 
|     2  Return to top level. 
| >>>make[2]: *** [makefile:24: all] Error 255
| make[2]: Leaving directory '/<<PKGBUILDDIR>>/gcl-tk'
| make[1]: *** [makefile:114: do-gcl-tk] Error 2
| rm h/mcompdefs.h
| make[1]: Leaving directory '/<<PKGBUILDDIR>>'
| make: *** [debian/rules:122: build-gprof-stamp] Error 2
| dpkg-buildpackage: error: debian/rules build-arch subprocess returned exit status 2

The full build log is available there:
https://buildd.debian.org/status/fetch.php?pkg=gcl&arch=riscv64&ver=2.6.14-4&stamp=1692963268&raw=0

I have tracked down the issue to the switch to gcc-13, which enabled
-fasynchronous-unwind-tables by default at the upstream level. This
causes a new section .rela.eh_frame to be added, using various type of
relocations that are not handled by GCL.

As a first test I have tried just ignore those relocations with the
following patch, which allowed me to build GCL successfully:

--- gcl-2.6.14.orig/h/elf64_riscv64_reloc.h
+++ gcl-2.6.14/h/elf64_riscv64_reloc.h
@@ -28,3 +28,15 @@
     case R_RISCV_32:
       store_val(where,MASK(32),(s+a));
       break;
+
+    /* Relocations for .rela.eh_frame */
+    case R_RISCV_32_PCREL:
+    case R_RISCV_ADD32:
+    case R_RISCV_SET6:
+    case R_RISCV_SET8:
+    case R_RISCV_SET16:
+    case R_RISCV_SUB6:
+    case R_RISCV_SUB8:
+    case R_RISCV_SUB16:
+    case R_RISCV_SUB32:
+      break;

It's not clear to me if it is safe to do so, or if we should add the
code for these relocations. Or maybe just ignore the .rela.eh_frame
section.

Regards
Aurelien


Reply to: