[M3commit] [modula3/cm3] 322694: Rework llvmbindings to circumvent ABI incompatibil...

Rodney Bates rodney.m.bates at acm.org
Fri Nov 6 03:12:40 CET 2015


  Branch: refs/heads/master
  Home:   https://github.com/modula3/cm3
  Commit: 3226946218e5e14f352e25fe441c863b917bbc30
      https://github.com/modula3/cm3/commit/3226946218e5e14f352e25fe441c863b917bbc30
  Author: Rodney Bates <rodney.m.bates at acm.org>
  Date:   2015-11-05 (Thu, 05 Nov 2015)

  Changed paths:
    M m3-sys/llvm3.6.1/src/M3CG_LLVM.m3
    M m3-sys/llvmbindings/src/LLVMTypes.i3
    M m3-sys/llvmbindings/src/M3DIBuilder.cpp
    M m3-sys/llvmbindings/src/M3DIBuilder.h
    M m3-sys/llvmbindings/src/M3DIBuilder.i3

  Log Message:
  -----------
  Rework llvmbindings to circumvent ABI incompatibilities.

An unpleasant discovery:  Even a struct/record with only one field
that is a pointer, is passed by value and returned in ways that are
incompatible at the machine level between gcc/clang C/C++ code
(these appear to be the same) and cm3 Modula-3 code, using the
gcc-derived back end, at least on AMD64_LINUX.  Other targets
and compiler combinations are possibly also incompatible.

llvm's DIBuilder nodes are just such structs, and were being passed
by value, to avoid having to deal with copying and allocation/freeing
of copies.

In this change, the struct/record surrounding is removed and the
enclosed pointer alone is passed.

Additionally, a couple of structs with two fields are changed
to be passed by reference, similar to other existing cases.




More information about the M3commit mailing list