Backport #8227

addr2line.c compile error on Solaris since r39887

Added by Naohisa Goto almost 2 years ago. Updated almost 2 years ago.

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

Description

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

fcc -O -KV9 -KVIS2 -DRUBY_EXPORT -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
u_quad_t'
"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' to uintmax_t': operator='

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

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

+#if defined(sun)
+/* Solaris has different quad_t and does not have u_quad_t /
+# include "ruby/defines.h"
+# define quad_t LONG_LONG
+# define u_quad_t unsigned LONG_LONG
+/
__inline can only be used with GCC or Sun Studio 12 Update 1 or later */
+# if defined(
GNUC_)
+# elif defined(
SUNPRO_C) && (SUNPRO_C >= 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 40161
Added by Naohisa Goto almost 2 years ago

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

Revision 40253
Added by Tomoyuki Chikanaga almost 2 years 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 almost 2 years 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: quad_t and u_quad_t is not available on Solaris. __inline is not available with old compilers on Solaris. [Bug #8227]

#2 Updated by Tomoyuki Chikanaga almost 2 years 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 almost 2 years ago

add r40170

#4 Updated by Naohisa Goto almost 2 years ago

r40170 is fine on Solaris with Oracle Solaris Studio 12.3.

#5 Updated by Tomoyuki Chikanaga almost 2 years 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