llvm-6 change from inlining to relocations causing ImageMagick+mesa crash

ImageMagick + mesa provided OpenCL has been failing for many people
for some time now. See
https://github.com/ImageMagick/ImageMagick/issues/1366

It was tracked down that ImageMagick commit 41a3cc9 and Mesa commit
9baacf were involved.

There's been discussion about this on the Mesa list. See
https://lists.freedesktop.org/archives/mesa-dev/2019-June/219736.html

Mesa dev Jan Vesely says behavior changed in llvm-6 that started
causing GPU hangs/crashes in some situations, and their commit was
just to prevent those.

Specifically: "AMDGPU llvm backend used to inline all function calls
until llvm-6. llvm-6+ uses functions calls and issues relocations for
each function invocation. unhandled relocations lead to GPU
hangs/crashes. either clover/mesa needs to handle relocations, or LLVM
needs to stop using relocations for internal symbols (they are not
needed)."

I don't know all the specifics, of course, but it sounds like even if
ImageMagick or mesa could be changed as a workaround, that the
ultimate cause was a change in llvm-6 that is causing crashes and
should be addressed.

I'm trying to bring the 3 involved projects together. At this time,
we unfortunately don't have a specific llvm commit where the failure
started. If it's needed, please ask. It's not something I'd be able
to bisect, but I'd be able to see if I could find someone involved who
would.

The simplest bandaid fix for the time being is to make sure the LLVM
driver forcibly inlines everything. This is what graphics APIs are
still doing.

The next step is to implement proper linking in Mesa and make sure
it's used for those OpenCL applications. I have patches pending for
the graphics side of this (look for: "amd,radeonsi: add a real runtime
linker").

Cheers,
Nicolai