Backport #8227

addr2line.c compile error on Solaris since r39887

Added by Naohisa Goto about 1 year ago. Updated about 1 year ago.

[ruby-dev:47229]
Status:Closed
Priority:Normal
Assignee:Tomoyuki Chikanaga

Description

r39887以降、Solarisで以下のようなコンパイルエラーが発生します。
Solaris では、quadt は別の意味の構造体が割り当てられており、uquadt は定義されおらず、
また、
_inline は、GCC か Sun Studio 12 Update 1 以降でないと使えないためです。
(GCCは未確認)

fcc -O -KV9 -KVIS2 -DRUBYEXPORT -I/usr/local/64/lib/libffi-3.0.10/include -I/u
sr/local/64/include -I. -I.ext/include/sparc64-solaris2.10 -I./include -I. -o
addr2line.o -c addr2line.c
"addr2line.c", line 691: error: syntax error near int'
"addr2line.c", line 691: error: function type is required for
inline'
"addr2line.c", line 915: error: assignment from int' toquad
t': operator ='
"addr2line.c", line 988: error: undeclared identifier
uquadt'
"addr2line.c", line 988: error: syntax error near )'
"addr2line.c", line 988: error: syntax error near
)'
"addr2line.c", line 1006: error: assignment from quad_t' touintmax_t': operator `='

以下のようなパッチでコンパイルは通るようになります。

--- addr2line.c (revision 40156)
+++ addr2line.c (working copy)
@@ -646,6 +646,19 @@
free(lines);
}

+#if defined(sun)
+/* Solaris has different quadt and does not have uquadt */
+# include "ruby/defines.h"
+# define quad
t LONGLONG
+# define u
quadt unsigned LONGLONG
+/* __inline can only be used with GCC or Sun Studio 12 Update 1 or later */
+# if defined(
GNUC)
+# elif defined(
SUNPROC) && (SUNPROC >= 0x590)
+# else
+# define inline inline
+# endif
+#endif /* defined(
sun) /
+
/
From FreeBSD's lib/libstand/printf.c /
/
-

* Copyright (c) 1986, 1988, 1991, 1993


Related issues

Precedes Backport200 - Backport #8144: test_segv_test(TestRubyOptions) test failure Open 04/07/2013 04/07/2013

Associated revisions

Revision 40253
Added by Tomoyuki Chikanaga about 1 year ago

merge revision(s) 39866,39887,39921,40161,40170: [Backport #8144] [Backport #8227]

* addr2line.c (rb_dump_backtrace_with_lines): output line at once.

* addr2line.c (kprintf): added from FreeBSD libstand's printf.
  this is consided as async signal safe function.

* addr2line.c (rb_dump_backtrace_with_lines): use kfprintf.
  [Bug #8144] 

* addr2line.c (putce): suppress unused return value warning.

* addr2line.c: quad_t and u_quad_t is not available on Solaris.
  __inline is not available with old compilers on Solaris.
   [Bug #8227]

* addr2line.c: use more generic type:
  * u_char -> unsigned char
  * u_short -> unsigned short
  * u_int -> unsigned int
  * u_long -> unsigned long
  * quad_t -> int64_t
  * u_quad_t -> uint64_t

* addr2line.c (imax): inline is defined by configure.

History

#1 Updated by Naohisa Goto about 1 year ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r40161.
Naohisa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • addr2line.c: quadt and uquadt is not available on Solaris. _inline is not available with old compilers on Solaris. [Bug #8227]

#2 Updated by Tomoyuki Chikanaga about 1 year ago

  • Tracker changed from Bug to Backport
  • Project changed from ruby-trunk to Backport200
  • Status changed from Closed to Assigned
  • Assignee changed from Naohisa Goto to Tomoyuki Chikanaga

I'll backport r39887 and r39921 for #8144. r40161 should be backported at the same time.

#3 Updated by Yui NARUSE about 1 year ago

add r40170

#4 Updated by Naohisa Goto about 1 year ago

r40170 is fine on Solaris with Oracle Solaris Studio 12.3.

#5 Updated by Tomoyuki Chikanaga about 1 year ago

  • Status changed from Assigned to Closed

This issue was solved with changeset r40253.
Naohisa, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


merge revision(s) 39866,39887,39921,40161,40170: [Backport #8144] [Backport #8227]

* addr2line.c (rb_dump_backtrace_with_lines): output line at once.

* addr2line.c (kprintf): added from FreeBSD libstand's printf.
  this is consided as async signal safe function.

* addr2line.c (rb_dump_backtrace_with_lines): use kfprintf.
  [Bug #8144] 

* addr2line.c (putce): suppress unused return value warning.

* addr2line.c: quad_t and u_quad_t is not available on Solaris.
  __inline is not available with old compilers on Solaris.
   [Bug #8227]

* addr2line.c: use more generic type:
  * u_char -> unsigned char
  * u_short -> unsigned short
  * u_int -> unsigned int
  * u_long -> unsigned long
  * quad_t -> int64_t
  * u_quad_t -> uint64_t

* addr2line.c (imax): inline is defined by configure.

Also available in: Atom PDF