Forum: Ruby-core [ruby-trunk - Bug #7647][Open] Ruby 1.9.3 doesn't build on m68k due to alignment of structs

Posted by alanh (Alan Hourihane) (Guest)
on 2013-01-02 22:33
(Received via mailing list)
Issue #7647 has been reported by alanh (Alan Hourihane).

----------------------------------------
Bug #7647: Ruby 1.9.3 doesn't build on m68k due to alignment of structs
https://bugs.ruby-lang.org/issues/7647

Author: alanh (Alan Hourihane)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 0


I'd built Ruby 1.8 without any problems, but 1.9.3 shows up an issue 
with Ruby due to alignment checking.

When executing Init_var_tables(), we execute....

CONST_ID(autoload, "__autoload__");

We end up, in rb_intern3() and use the RString struct to pass into 
rb_enc_associate() which checks alignment with SPECIAL_CONST_P(x) via 
IMMEDIATE(x) and uses the RUBY_IMMEDIATE_MASK which is defined as 0x03.

This can fail on m68k as structs can be aligned on 16bit boundaries. I 
had to change....

struct RString fake_str;

to

struct RString fake_str __attribute__ ((aligned (4)));

To get miniruby to build, but I'm not sure of other lurkers and whether 
this strict use of IMMEDIATE(x) is really valid.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.