darwin-on-arm / xnu

Porting the Darwin kernel to the AArch64/ARMv7/ARMv6-A architectures.
Other
582 stars 146 forks source link

Missing ARMv7 architecture in file libclang_rt.cc_kext.a #41

Open johnothwolo opened 6 years ago

johnothwolo commented 6 years ago

I'm having this compiling error:

LD mach_kernel.sys
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.cc_kext.a, missing required architecture armv7 in file /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib/darwin/libclang_rt.cc_kext.a (3 slices)
ld: no supported runtime hi16 relocation in ___cxx_global_var_init from /Users/mac/xnu/xnu-arm/BUILD/obj//DEBUG_ARM_OMAP3530/libkern/DEBUG/OSDebug.cpo to ___stack_chk_guard for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [/Users/mac/xnu/xnu-arm/BUILD/obj/DEBUG_ARM_OMAP3530/./mach_kernel] Error 1
make[1]: *** [build_all] Error 2
make: *** [all] Error 2
mithrandir2008-zz commented 6 years ago

Any updates on this?

johnothwolo commented 6 years ago

Nope, there was no response from anyone!

mithrandir2008-zz commented 6 years ago

TBH, I hit this error in a completely different context. I have a feeling it's LLVM specific, just stirring the pot in hope for some clues...

johnothwolo commented 6 years ago

What exactly did you do?

mithrandir2008-zz commented 6 years ago

Ok, so the context is probably completely unrelated.

I have a piece of ARM code I'm compiling for a Cortex-M4 which calls into a specific function. This function references the pointer to a specific section(call it __test sitting in the RAM) by pointing to the label directly. Note that the labels exist in a .s assembler file(but I don't think this is relevant).

During link-time, it throws the hi16 relocation error, pointing to the __test line. Ultimately, I got around the issue by #defining the address instead of a direct pointer to the section. I got past the error but I'm not sure it actually 'works' yet. Still in the middle of functional testing.

Not sure if that made any sense to you, so apologies in advance...

adalric commented 6 years ago

You guys are trying to use macOS libclang_rt.cc_kext.a, in my .travis.yml, line 38 and 39 shows you a quick workaround. Please tell me if it works.

johnothwolo commented 6 years ago

It doesn't work, I still get:

ld: no supported runtime hi16 relocation in ___cxx_global_var_init from /Users/Mac/xnu/xnu-arm/BUILD/obj//DEBUG_ARM_ARMPBA8/libkern/DEBUG/./OSDebug.cpo to ___stack_chk_guard for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
mithrandir2008-zz commented 6 years ago

Hi John,

Can you try appending a "-mlong-calls" to your linker call? I found that it does fix some issues(although I haven't tested it for this one).

johnothwolo commented 6 years ago

I tried commenting out -fstack-protector-all but got:

ld: no supported runtime hi16 relocation in _trace_backtrace from /Users/mac/xnu/xnu-arm/BUILD/obj//DEBUG_ARM_OMAP3530/libkern/DEBUG/./OSDebug.cpo to ___stack_chk_guard for architecture armv7
joanne6601 commented 1 year ago

llvm is compromising my computer