On 5/25/21 6:07 PM, George Koehler wrote:
On Sun, 23 May 2021 07:08:38 -0700
manp...@gmail.com wrote:

cc -O2 -pipe -D__BUILTIN_HACK -Wall -ggdb3 -I/usr/local/include  -MD -MP  
-nostdinc -idirafter /usr/include -c backtrace.c -o backtrace.o
error: return address can be determined only for current frame
error: return address can be determined only for current frame
2 errors generated.

Does this diff help?  It avoids _builtin_frame_address(1), but I don't
know if it would fix your compiler error.

We pass -D__BUILTIN_HACK on mips64* | hppa | sh to disable most of the
backtrace code.  I don't have the hardware to check.

--George

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/libexecinfo/Makefile,v
retrieving revision 1.26
diff -u -p -r1.26 Makefile
--- Makefile    3 Jan 2020 15:16:59 -0000       1.26
+++ Makefile    26 May 2021 00:46:48 -0000
@@ -9,7 +9,7 @@ GH_PROJECT=     backtrace
  DISTNAME =    ${GH_PROJECT}-${V}
  PKGNAME =     libexecinfo-$V
  EPOCH =               0
-REVISION =     2
+REVISION =     3
  CATEGORIES =  devel
SHARED_LIBS = execinfo 2.0
Index: patches/patch-libbacktrace_backtrace_c
===================================================================
RCS file: /cvs/ports/devel/libexecinfo/patches/patch-libbacktrace_backtrace_c,v
retrieving revision 1.4
diff -u -p -r1.4 patch-libbacktrace_backtrace_c
--- patches/patch-libbacktrace_backtrace_c      11 Mar 2016 19:46:13 -0000      
1.4
+++ patches/patch-libbacktrace_backtrace_c      26 May 2021 00:46:48 -0000
@@ -3,17 +3,22 @@ $OpenBSD: patch-libbacktrace_backtrace_c
  - __builtin_return_address() and __builtin_frame_address()
    may not always have a !0 argument.
---- libbacktrace/backtrace.c.orig Thu Mar 3 10:15:09 2016
-+++ libbacktrace/backtrace.c   Thu Mar  3 10:15:38 2016
-@@ -65,6 +65,7 @@ bt_create_backtrace(void **buffer, int depth, int flag
+Index: libbacktrace/backtrace.c
+--- libbacktrace/backtrace.c.orig
++++ libbacktrace/backtrace.c
+@@ -64,7 +64,10 @@ bt_create_backtrace(void **buffer, int depth, int flag
+       do {
                /* number of HANDLE_FRAME must match BT_MAX_DEPTH */
                switch (i) {
-               HANDLE_FRAME(0, i, addr);
+-              HANDLE_FRAME(0, i, addr);
++              case 0:
++                      addr = __builtin_return_address(0);
++                      break;
  +#ifndef __BUILTIN_HACK
                HANDLE_FRAME(1, i, addr);
                HANDLE_FRAME(2, i, addr);
                HANDLE_FRAME(3, i, addr);
-@@ -192,6 +193,7 @@ bt_create_backtrace(void **buffer, int depth, int flag
+@@ -192,6 +195,7 @@ bt_create_backtrace(void **buffer, int depth, int flag
                HANDLE_FRAME(125, i, addr);
                HANDLE_FRAME(126, i, addr);
                HANDLE_FRAME(127, i, addr);


Hi George,

You patch works and I have a successfully built libexecinfo now. Would be great to have the patch committed so that we can all benefit from it (both HEAD and 6.9 branch)! Thanks!

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to