[erlang-questions] OTP / HiPE broken with GCC 6.2

Mikael Pettersson mikpelinux@REDACTED
Thu Nov 3 20:12:38 CET 2016


Sverker Eriksson writes:
 > If this is x86_64 (amd64) then it looks like
 > the beam was built without gcc's default small code model
 > where "the program and its symbols must be linked
 > in the lower 2 GB of the address space."
 > 
 > The second argument to hipe_bifs:patch_call/2
 > should in this case be the address of a BIF,
 > but 94502719669968 is way past 2GB.
 > 
 > /Sverker, Erlang/OTP
 > 
 > 
 > On 11/02/2016 11:30 PM, Johannes Weißl wrote:
 > > Hi,
 > >
 > > Last week GCC got updated from 6.1.1 to 6.2.0 on my Debian laptop. Since then
 > > OTP releases built with this compiler have broken HiPE [1]. The error is
 > > reproducible on different machines, even the official OTP 19.1.5 Debian binary
 > > package is broken because it was built with the new compiler.
 > >
 > > Has anybody else experienced the same with GCC 6.2? I have not done much
 > > debugging, the error could be in GCC or OTP (maybe usage of undefined behavior).
 > >
 > > Regards,
 > > Johannes
 > >
 > > [1] Stacktrace after `c(my_module, [native]).` for any module:
 > >
 > > {'EXIT',{badarg,[{hipe_bifs,patch_call,
 > >                              [1103888528,94502719669968,[]],
 > >                              []},
 > >                   {hipe_unified_loader,patch_call_insn,3,
 > >                                        [{file,"hipe_unified_loader.erl"},{line,508}]},
 > >                   {hipe_unified_loader,patch_bif_call_list,4,
 > >                                        [{file,"hipe_unified_loader.erl"},{line,494}]},
 > >                   {hipe_unified_loader,patch_call,5,
 > >                                        [{file,"hipe_unified_loader.erl"},{line,485}]},
 > >                   {hipe_unified_loader,patch,5,
 > >                                        [{file,"hipe_unified_loader.erl"},{line,462}]},
 > >                   {hipe_unified_loader,load_common,4,
 > >                                        [{file,"hipe_unified_loader.erl"},{line,215}]},
 > >                   {hipe_unified_loader,load_native_code,3,
 > >                                        [{file,"hipe_unified_loader.erl"},{line,111}]},
 > >                   {code_server,try_load_module_2,6,
 > >                                [{file,"code_server.erl"},{line,1131}]}]}}

I cannot reproduce this with the tip of the otp master branch, and gcc's built
from either the gcc-6.2.0 release tar ball or from a recent head of the gcc-6 branch.

Most likely the Erlang VM was compiled with non-standard options, for instance
as a PIE (position-independent executable) which would break all address space
layout assumptions.  This could be the result of otp build options or non-standard
behaviour in that Debian gcc.

If you want further help debugging this, show us
(1) the output of gcc -v
(2) any special options (whether via ./configure or environment variables) used when
    compiling otp



More information about the erlang-questions mailing list