[Xperia Z5 General] threader:
I had to make a few modifications just to get anywhere, it's certainly no drop in replacement, I think I got stuck before reverting, but right now when compiling the kernel I'm missing asm/types.h , this file simply points to asm-generic/types.h on arm64 in the compiler includes though I cannot for the life of me figure out what i might have changed to make this error come about.

Edit: think I found it, a not totally unclean kernel directory

Edit2: So I'm still trying to compile with snapdragon llvm3.8, I've made notes of my changes so far but i can't seem to find the reason for this message:

hardware/qcom/media-caf/msm8994/mm-video-v4l2/vidc/vdec/src/omx_vdec_msm8974.cpp:10901:14: error: comparison of two values with different enumeration types in switch statement ('OMX_COLOR_FORMATTYPE' and 'OMX_QCOM_COLOR_FORMATTYPE') [-Werror,-Wenum-compare-switch]
case QOMX_COLOR_FORMATYUV420PackedSemiPlanar32m:
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Maybe adding -Wno-enum-compare to build/soong/cc/config/global.go will work.

Edit3:

Right, i got it compiled, but of course it throws a cash.

01-05 11:18:32.991 1394 1394 F DEBUG : LineageOS Version: '15.1-20191007-UNOFFICIAL-sumire'
01-05 11:18:32.991 1394 1394 F DEBUG : Build fingerprint: 'Sony/sumire/sumire:7.1.1/N-MR1-KITAKAMI-170609-1025/1:user/dev-keys'
01-05 11:18:32.991 1394 1394 F DEBUG : Revision: '0'
01-05 11:18:32.991 1394 1394 F DEBUG : ABI: 'arm64'
01-05 11:18:32.991 1394 1394 F DEBUG : pid: 1371, tid: 1389, name: hwcVsyncThread >>> /system/bin/surfaceflinger <<<
01-05 11:18:32.991 1394 1394 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-05 11:18:32.996 1394 1394 F DEBUG : Abort message: 'FORTIFY: poll: 3-element pollfd array too small for 6 fds'
01-05 11:18:32.996 1394 1394 F DEBUG : x0 0000000000000000 x1 000000000000056d x2 0000000000000006 x3 0000000000000008
01-05 11:18:32.996 1394 1394 F DEBUG : x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 0000000000000010
01-05 11:18:32.996 1394 1394 F DEBUG : x8 0000000000000083 x9 0000000010000000 x10 0000007241c050b0 x11 0000000000000001
01-05 11:18:32.996 1394 1394 F DEBUG : x12 0000000000000008 x13 0000000000000000 x14 0000000000000000 x15 003873cc611b18d7
01-05 11:18:32.996 1394 1394 F DEBUG : x16 0000005583babf90 x17 00000072c666b630 x18 0000000000000014 x19 000000000000055b
01-05 11:18:32.996 1394 1394 F DEBUG : x20 000000000000056d x21 0000000000000083 x22 00000072c35f3c36 x23 00000072c35f3bf5
01-05 11:18:32.996 1394 1394 F DEBUG : x24 00000072c35f3c8b x25 00000072c35fd118 x26 0000007241c053c0 x27 0000000000000002
01-05 11:18:32.996 1394 1394 F DEBUG : x28 0000000000000000 x29 0000007241c050f0 x30 00000072c661f778
01-05 11:18:32.996 1394 1394 F DEBUG : sp 0000007241c050b0 pc 00000072c661f7a0 pstate 0000000060000000
01-05 11:18:33.000 1394 1394 F DEBUG :
01-05 11:18:33.000 1394 1394 F DEBUG : backtrace:
01-05 11:18:33.000 1394 1394 F DEBUG : #00 pc 000000000001d7a0 /system/lib64/libc.so (abort+120)
01-05 11:18:33.000 1394 1394 F DEBUG : #01 pc 00000000000206d8 /system/lib64/libc.so (__fortify_fatal(char const*, ...)+120)
01-05 11:18:33.000 1394 1394 F DEBUG : #02 pc 00000000000209ac /system/lib64/libc.so (__poll_chk+60)
01-05 11:18:33.000 1394 1394 F DEBUG : #03 pc 000000000001c608 /system/vendor/lib64/hw/hwcomposer.msm8994.so (qhwc::vsync_loop(void*)+1272)
01-05 11:18:33.000 1394 1394 F DEBUG : #04 pc 0000000000068e84 /system/lib64/libc.so (__pthread_start(void*)+36)
01-05 11:18:33.000 1394 1394 F DEBUG : #05 pc 000000000001ec30 /system/lib64/libc.so (__start_thread+68)

addr2line points to a fault at qhwc::init_vsync_thread(hwc_context_t*) in hardware/qcom/display-caf/msm8994/libhwcomposer/hwc_vsync.cpp, though i am completely clueless as to the cause.

Adding LOCAL_SDCLANG := false to hardware/qcom/display-caf/msm8994/libhwcomposer/Android.mk works.

My notes, there are some places where 'register' needs to be removed, missing from my notes :

-#pragma (1)
+#pragma (push,1)
external/gptfdisk/bsd.h
external/gptfdisk/gpt.h
external/gptfdisk/basicmbr.h
+#pragma (pop)

- ALOGE("%s: error %zd - %s", __func__, ret, pcm_get_error(out->pcm));
+ ALOGE("%s: error %d, %s", __func__, (int)ret, pcm_get_error(out->pcm));

hardware/qcom/display-caf/msm8994/libhdmi/hdmi.cpp:197:42: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'int' [-Werror,-Wformat]
__FUNCTION__, scanInfo, (int)len);
^~~~~~~~
system/core/liblog/include/log/log_main.h:201:52: note: expanded from macro 'ALOGD'
#define ALOGD(...) ((void)ALOG(LOG_DEBUG, LOG_TAG, __VA_ARGS__))
^~~~~~~~~~~
system/core/liblog/include/log/log_main.h:306:67: note: expanded from macro 'ALOG'
#define ALOG(priority, tag, ...) LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
^~~~~~~~~~~
system/core/liblog/include/log/log_main.h:70:69: note: expanded from macro 'LOG_PRI'
#define LOG_PRI(priority, tag, ...) android_printLog(priority, tag, __VA_ARGS__)
^~~~~~~~~~~
system/core/liblog/include/log/log_main.h:61:34: note: expanded from macro 'android_printLog'
__android_log_print(prio, tag, __VA_ARGS__)
^~~~~~~~~~~
hardware/qcom/display-caf/msm8994/libhdmi/hdmi.cpp:321:41: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'int' [-Werror,-Wformat]
__FUNCTION__, edidStr, (int)len);

frameworks/av/media/libaaudio/src/utility/AAudioUtilities.cpp:326:76: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'int32_t' (aka 'int') [-Werror,-Wformat]
ALOGE("size overflow, numFrames = %d, frameSize = %zd", numFrames, bytesPerFrame);

frameworks/native/services/surfaceflinger/Effects/Daltonizer.cpp:136:16: error: unused variable 'identity' [-Werror,-Wunused-variable]
const mat4 identity;

frameworks/av/services/camera/libcameraservice/api2/CameraDeviceClient.cpp:671:63: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'int32_t' (aka 'int') [-Werror,-Wformat]
"configured (ID %zd)", mCameraIdStr.string(), mInputStream.id);
~~~ ^~~~~~~~~~~~~~~
%d
hardware/interfaces/gnss/1.0/default/Gnss.cpp:124:57: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
ALOGW("Too many satellites %zd. Clamps to %d.", svStatus.numSvs, GnssMax::SVS_COUNT);
~~~ ^~~~~~~~~~~~~~~
%u

hardware/interfaces/gnss/1.0/default/Gnss.cpp:194:57: error: format specifies type 'ssize_t' (aka 'long') but the argument has type 'uint32_t' (aka 'unsigned int') [-Werror,-Wformat]
ALOGW("Too many satellites %zd. Clamps to %d.", svStatus.numSvs, GnssMax::SVS_COUNT);
~~~ ^~~~~~~~~~~~~~~
%u
hardware/qcom/camera/mm-image-codec/qomx_core/Android.mk
- LOCAL_SHARED_LIBRARIES := libcutils libdl
+ LOCAL_SHARED_LIBRARIES := libcutils libdl liblog

hardware/qcom/camera/mm-image-codec/qomx_core/qomx_core.c:80: error: undefined reference to '__android_log_print'
hardware/qcom/camera/mm-image-codec/qomx_core/qomx_core.c:101: error: undefined reference to '__android_log_print'
hardware/qcom/camera/mm-image-codec/qomx_core/qomx_core.c:125: error: undefined reference to '__android_log_print'
hardware/qcom/camera/mm-image-codec/qomx_core/qomx_core.c:194: error: undefined reference to '__android_log_print'

Edit4:

I was using llvm-6.0.2, there is now 8.0.2, and already i have a new and exciting error.

Needs this at least, https://github.com/msm8916-pie/hardware_qcom_media/commit/d035825e115afc572807381e2a7c8c4d123e45dc https://android.googlesource.com/pl...8fd6cf4c0ff8ea1c08e84fad6f1c02cdd22b51e^!/#F0

Do as the compiler says here:

system/security/keystore/keystore_cli_v2.cpp:136:12: note: call 'std::move' explicitly to avoid copying
return parameters;
^~~~~~~~~~
std::move(parameters)

I'm now stuck with this error:

01-07 00:29:08.584 1708 1708 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-07 00:29:08.584 1708 1708 F DEBUG : LineageOS Version: '15.1-20191008-UNOFFICIAL-sumire'
01-07 00:29:08.584 1708 1708 F DEBUG : Build fingerprint: 'Sony/sumire/sumire:7.1.1/N-MR1-KITAKAMI-170609-1025/1:user/dev-keys'
01-07 00:29:08.585 1708 1708 F DEBUG : Revision: '0'
01-07 00:29:08.585 1708 1708 F DEBUG : ABI: 'arm64'
01-07 00:29:08.585 1708 1708 F DEBUG : pid: 1580, tid: 1580, name: keystore >>> /system/bin/keystore <<<
01-07 00:29:08.585 1708 1708 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
01-07 00:29:08.585 1708 1708 F DEBUG : x0 0000000000000000 x1 000000000000062c x2 0000000000000006 x3 0000000000000008
01-07 00:29:08.585 1708 1708 F DEBUG : x4 0050005200530055 x5 0050005200530055 x6 0050005200530055 x7 005f00590045004b
01-07 00:29:08.585 1708 1708 F DEBUG : x8 0000000000000083 x9 0000000010000000 x10 0000007fd100a550 x11 0000000000000001
01-07 00:29:08.585 1708 1708 F DEBUG : x12 0063006e0065005f x13 0074007000790072 x14 0000000000000000 x15 00000075e3a00000
01-07 00:29:08.585 1708 1708 F DEBUG : x16 00000075e4a512e8 x17 00000075e49ad190 x18 0000000000000001 x19 000000000000062c
01-07 00:29:08.585 1708 1708 F DEBUG : x20 000000000000062c x21 0000000000000083 x22 0000007fd100a698 x23 00000075e3a54400
01-07 00:29:08.585 1708 1708 F DEBUG : x24 00000075e4dcba40 x25 00000075e4dcba40 x26 0000000000000000 x27 000000555f493ff0
01-07 00:29:08.585 1708 1708 F DEBUG : x28 065a458357eac1d6 x29 0000007fd100a590 x30 00000075e49a2778
01-07 00:29:08.585 1708 1708 F DEBUG : sp 0000007fd100a550 pc 00000075e49a27a0 pstate 0000000060000000
01-07 00:29:08.569 1708 1708 I crash_dump64: type=1400 audit(0.0:355): avc: denied { ptrace } for scontext=u:r:crash_dump:s0 tcontext=u:r:keystore:s0 tclass=process permissive=1
01-07 00:29:08.598 1708 1708 F DEBUG :
01-07 00:29:08.598 1708 1708 F DEBUG : backtrace:
01-07 00:29:08.598 1708 1708 F DEBUG : #00 pc 000000000001d7a0 /system/lib64/libc.so (abort+120)
01-07 00:29:08.598 1708 1708 F DEBUG : #01 pc 0000000000029694 /system/bin/keystore (has_permission(unsigned int, perm_t, int)+196)
01-07 00:29:08.598 1708 1708 F DEBUG : #02 pc 000000000000e0c0 /system/bin/keystore (keystore::KeyStoreService::checkBinderPermission(perm_t, int)+56)
01-07 00:29:08.598 1708 1708 F DEBUG : #03 pc 000000000000e7a4 /system/bin/keystore (keystore::KeyStoreService::exist(android::String16 const&, int)+100)
01-07 00:29:08.599 1708 1708 F DEBUG : #04 pc 00000000000113b4 /system/lib64/libkeystore_binder.so (android::BnKeystoreService::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+1092)
01-07 00:29:08.599 1708 1708 F DEBUG : #05 pc 000000000004aed0 /system/lib64/libbinder.so (android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+136)
01-07 00:29:08.599 1708 1708 F DEBUG : #06 pc 0000000000054e84 /system/lib64/libbinder.so (android::IPCThreadState::executeCommand(int)+528)
01-07 00:29:08.599 1708 1708 F DEBUG : #07 pc 0000000000054bc4 /system/lib64/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+156)
01-07 00:29:08.599 1708 1708 F DEBUG : #08 pc 0000000000055204 /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+60)
01-07 00:29:08.599 1708 1708 F DEBUG : #09 pc 0000000000023a30 /system/bin/keystore (main+1560)
01-07 00:29:08.599 1708 1708 F DEBUG : #10 pc 00000000000a2df0 /system/lib64/libc.so (__libc_init+88)
01-07 00:29:08.599 1708 1708 F DEBUG : #11 pc 000000000000c6a4 /system/bin/keystore (_start_main+80)
01-07 00:29:08.639 1708 1708 I crash_dump64: type=1400 audit(0.0:356): avc: denied { signal } for

Update Edit4:

Seems like the enclosed patch needs to happen, it fixes the crash but I've had no luck in finding a fix while working on system/keymaster system/security .

01-02 00:57:51.566 869 869 E Zygote : System zygote died with exception
01-02 00:57:51.566 869 869 E Zygote : java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.USER_STARTED flg=0x50000010 (has extras) } in com.android.server.ConnectivityService$3@c816c6a
01-02 00:57:51.566 869 869 E Zygote :	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52511(LoadedApk.java:1323)
01-02 00:57:51.566 869 869 E Zygote :	at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
01-02 00:57:51.566 869 869 E Zygote :	at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
01-02 00:57:51.566 869 869 E Zygote :	at android.os.Handler.handleCallback(Handler.java:790)
01-02 00:57:51.566 869 869 E Zygote :	at android.os.Handler.dispatchMessage(Handler.java:99)
01-02 00:57:51.566 869 869 E Zygote :	at android.os.Looper.loop(Looper.java:164)
01-02 00:57:51.566 869 869 E Zygote :	at com.android.server.SystemServer.run(SystemServer.java:436)
01-02 00:57:51.566 869 869 E Zygote :	at com.android.server.SystemServer.main(SystemServer.java:274)
01-02 00:57:51.566 869 869 E Zygote :	at java.lang.reflect.Method.invoke(Native Method)
01-02 00:57:51.566 869 869 E Zygote :	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
01-02 00:57:51.566 869 869 E Zygote :	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:787)
01-02 00:57:51.566 869 869 E Zygote : Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int android.security.IKeystoreService.exist(java.lang.String, int)' on a null object reference
01-02 00:57:51.566 869 869 E Zygote :	at android.security.KeyStore.contains(KeyStore.java:210)
01-02 00:57:51.566 869 869 E Zygote :	at android.security.KeyStore.contains(KeyStore.java:218)
01-02 00:57:51.566 869 869 E Zygote :	at com.android.server.net.LockdownVpnTracker.isEnabled(LockdownVpnTracker.java:92)
01-02 00:57:51.566 869 869 E Zygote :	at com.android.server.ConnectivityService.onUserStart(ConnectivityService.java:3893)
01-02 00:57:51.566 869 869 E Zygote :	at com.android.server.ConnectivityService.-wrap29(Unknown Source:0)
01-02 00:57:51.566 869 869 E Zygote :	at com.android.server.ConnectivityService$3.onReceive(ConnectivityService.java:3963)
01-02 00:57:51.566 869 869 E Zygote :	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52511(LoadedApk.java:1313)
01-02 00:57:51.566 869 869 E Zygote :	... 10 more
01-02 00:57:51.566 869 869 D AndroidRuntime: Shutting down VM
01-02 00:57:51.567 869 869 E AndroidRuntime: *** FATAL EXCEPTION IN SYSTEM PROCESS: main
01-02 00:57:51.567 869 869 E AndroidRuntime: java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.USER_STARTED flg=0x50000010 (has extras) } in com.android.server.ConnectivityService$3@c816c6a
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52511(LoadedApk.java:1323)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.$m$7(Unknown Source:4)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.app.-$Lambda$aS31cHIhRx41653CMnd4gZqshIQ.run(Unknown Source:39)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.os.Handler.handleCallback(Handler.java:790)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.os.Handler.dispatchMessage(Handler.java:99)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.os.Looper.loop(Looper.java:164)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at com.android.server.SystemServer.run(SystemServer.java:436)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at com.android.server.SystemServer.main(SystemServer.java:274)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at java.lang.reflect.Method.invoke(Native Method)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:787)
01-02 00:57:51.567 869 869 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'int android.security.IKeystoreService.exist(java.lang.String, int)' on a null object reference
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.security.KeyStore.contains(KeyStore.java:210)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.security.KeyStore.contains(KeyStore.java:218)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at com.android.server.net.LockdownVpnTracker.isEnabled(LockdownVpnTracker.java:92)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at com.android.server.ConnectivityService.onUserStart(ConnectivityService.java:3893)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at com.android.server.ConnectivityService.-wrap29(Unknown Source:0)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at com.android.server.ConnectivityService$3.onReceive(ConnectivityService.java:3963)
01-02 00:57:51.567 869 869 E AndroidRuntime:	at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$-android_app_LoadedApk$ReceiverDispatcher$Args_52511(LoadedApk.java:1313)
01-02 00:57:51.567 869 869 E AndroidRuntime:	... 10 more