Applying the patch below let me cross-compile and run R15B02 on Tilera64 using TileraMDE-3.0.1.125620. In order to prepare a clean patch, I have to know what do the options -OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off do on the machines that support it? Also, what is the meaning of -MALLOC_USE_HASH(1)?
"'malloc_use_hash' only affects malloc (specifically, it affects the flags it passes to 'mmap' when it allocates more memory from Linux). You can also explicitly malloc memory with various caching attributes using custom mspaces. The 'hash_default' argument in the .hvconfig file affects 'mmap' calls that do not specify homing information. Because malloc *does* specify homing information, at least when you are pthreaded, 'hash_default' is ignored and malloc_use_hash is required to get hash-for-home."
+ifneq ($(filter tile-%,$(TARGET)),) +# Some tile-cc optimizations take pathologically long for beam_emu.c, +# so disable them. +$(OBJDIR)/beam_emu.o: beam/beam_emu.c + $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \ + -OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off \ + $(INCLUDES) -c $< -o $@ +endif Patch was supplied by Tilera Corp.Regards,
Oh, it was a macro. Of course. :-)
> >>I guess it would be safe to remove "-OPT:Olimit=0
> >>-WOPT:lpre=off:spre=off:epre=off ".
> >>It is an optimization for tile-cc when compiling on target machine.
> >>An earlier comment in Makefile.in seems to have been removed, it said:
> >>
> >>+ifneq ($(filter tile-%,$(TARGET)),)
> >>+# Some tile-cc optimizations take pathologically long for beam_emu.c,
> >>+# so disable them.
> >>+$(OBJDIR)/beam_emu.o: beam/beam_emu.c
> >>+ $(CC) $(subst -O2, $(GEN_OPT_FLGS), $(CFLAGS)) \
> >>+ -OPT:Olimit=0 -WOPT:lpre=off:spre=off:epre=off \
> >>+ $(INCLUDES) -c $< -o $@
> >>+endif
> >Can you verify that it compiles in "reasonable time" on your system with
> >these flags turned off?
> Also, tag - you’re it!
Did not understand the above sentence.
> It would be greatly appreciated if you could summarize problems and
> solution you have found for building and using Erlang on the Tilera
> card or if you find something we can change to make anyones
> experience just a bit easier. I don't know exactly where we should
> put this documentation but my suggestion would either be in the
> documentation for cross compiling or as a specific page on the
> GitHub Wiki. If the information arrives, we will surely find a place
> to put it. =)
When one is doing
./otp_build autoconf[*]
./otp_build configure --xcomp-conf=FILE
make
Then everything in documentation makes sense and is really clear.
However, if one wants to cross-compile using ./configure[⚗], then you have
to know the cpu-vendor-os triplet. I got it while invoking GCC on the
target machine:
$ tile-monitor --resume --pci --resume --root -- gcc -v
Using built-in specs.
Target: tile-unknown-linux-gnu
...
Is there a better way? Anyway, this or the better way, I think, could be
documented.
If people run into compilation problems, usually it is not Erlang
specific. It's a missing macro, invalid compiler flag, missing function
during linking.. Standard stuff which is common to any C project. I am
afraid it does not make sense to add help to the Erlang building
documentation. Like "try removing stuff that is complaining and see
what happens" (the way I did) is too easy to be misinterpreted, and
whilst if you provide more aid you just repeat general C knowledge.
Sadly, specific questions are asked, without a reply[1].
Anyway, regarding code. Should I "prepare" a new patch with an updated
commit message, or what you have is good enough to be merged?
Regards,
Motiejus
[*]: I am building from git source.
[⚗]: I used ./otp_build only, and this is speculation. Not sure if would work.
[1]: http://erlang.org/pipermail/erlang-questions/2011-October/061727.html
Or I can make the changes with the additional small changes I proposed.
// Björn-Egil