-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined symbols for architecture armv7? #23
Comments
Maybe the problem is in iOS 8.0 SDK? |
I have the same issue whilst compiling the kernel on Xcode 6, and I managed to compile it on Xcode 5.1.1 with iOS 6.1 SDK. |
Hello guys My theory behind this problem is that more recent versions of Xcode don't provide a toolchain that gives you an armv7 build of the libclang_rt.cc_kext.a library (I can't say with certainty as I don't have access to a Mac atm). To work around this problem for good, I've integrated a subset of the APIs provided by libclang_rt.cc_kext into the source tree under osfmk/arm/crt. If you have any more linker errors (or any other related questions), feel free to post them here and I'll do my best to resolve those errors/answer questions. |
i just use the latest version of master branch in repo, still has error: make TARGET_CONFIGS="debug arm OMAP3530" CC version.o for example: ___divsi3189 , is not exist, it's just __divsi3. |
Hello nightsuns, Could you post the clang version and development environment you are using? |
b-man, I still have that error. |
The same errors still exist on Xcode 6.1 (6A1052d) when I compiled the xnu on my system. My clang version is 600.0.54. |
Hmm, for some reason Xcode 6.1's clang++ is mangling those functions (I'm running a slightly older version of clang which isn't showing this problem). I'll see what I can do tonight and hopefully I'll have a solution tomorrow. |
@b-man, below is my version: Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn) xcode: host: |
Hmm, I'm using a build of clang-503.0.38 (Xcode 5.1) from Apple's open source release to build xnu without issues. What is strange about this problem is that after looking back at my builds, my version of clang seems to do the same thing to these functions (with slightly different results) yet it is able to successfully link the kernel. Perhaps something has changed with the linker (or clang) and these differences are causing this problem? Nonetheless I'll hopefully have a (hackish) solution to this problem tomorrow. Worst case scenario I'll need to replace these assembly functions with C equivalents which would probably have an impact on performance. :( |
@b-main: thanks for your reply, if you have patch, i could help to do the test. |
nightsuns, Here's a patch containing my (hacky) solution
|
@b-man : CC version.o |
Sorry about taking a while to reply |
zhikharevich, nightsuns I've implemented a fix that should resolve those linker errors. |
@b-man : |
I can confirm that this also compiles on Xcode 6.1.1 which was updated recently. Thanks b-man. |
do we understand why the symbols are mangled in the first place yet? |
minux, It is indeed a workaround. For some yet to be known reason Xcode 6.x's toolchain (allegedly clang++ or the linker) is not recognizing that idivsi3/udivsi3/umodsi3/ect are intrinsic functions (what would normally be found in compiler_rt) and is thus treating these symbols like regular c/assembly function names. If anyone has a better solution for this problem (apart from creating a custom toolchain for OSX) I'm open to suggestions. I've spent the last two days trying to figure out why this is happening with this particular toolchain, and so far aliasing the symbols seems to be the cleanest solution for now. I know it's an ugly hack, but it works for now. ;) |
@b-man : qemu-system-arm -s -S -machine realview-pb-a8 -m 1024 -kernel GenericBooter/SampleBooter.elf.uImage -append rd=md0 debug=0x16e serial=3 -v -s -serial stdio debug_init():: ::preparing system... MAC Framework successfully initialized Debugger called: Mac OS version: Kernel version: System uptime in nanoseconds: 2114343000 Waiting for remote debugger connection. Waiting for remote debugger connection. Please go to http://github.com/winocm/xnu to report this panic. Please go to http://github.com/winocm/xnu to report this panic. |
nightsuns, It looks like you are trying to boot xnu with 1GB of ram. Currently the RealView-PB A8 port is only configured to support 512MB of ram. The version of GenericBooter that you used from here is also outdated (I'm working on fixing this). For now I would recommend using winocm's GenericBooter: https://github.com/winocm/GenericBooter-next.git I also presume you are using the ramdisk that was supplied in the image posted on reddit. To take advantage of the kernel's current capabilities (and to avoid unnecessary issues) I'll supply you with a copy of my ramdisk which has been verified to work: https://www.dropbox.com/s/j5id402t2er59vh/ramdisk_new.dmg?dl=0 For the next day or two I'm going to work on updating the wiki to include a more comprehensive set of steps for getting the kernel up and running on both OSX and Linux build hosts. I'm also going to make a repo for the ramdisk so people won't need to muck around with obtaining one from obscure sources. :) |
Another helpful tip: passing symbolicate_panics=1 to bootargs makes debugging crashes much, much easier ;) |
@b-man: i'am using gdb-arm-apple-darwin to debug, i can set the breakpointer, but i could not to print the variable. or is there another debug ways? |
nightsuns, Unfortunateley I don't have access to my computer atm as I have been traveling this past couple of days (in California atm). I should have it in a couple of days, and by that time I'll be able to investigate debugging. I know that the last time I tried using gdb with xnu's debug script it had trouble loading symbols. Btw, I haven't forgotten about the wiki - I'll get that done when I can. |
hi all, used to with vmware and gdb the X86 version of the mack_kernel was debuggable nicely. seems working but the breakpoint did not work for me. BR, |
hi, with this simple change i was able to boot up in qemu. how to debug: ( nightmare )
so no symbols in GDB just pure assembly ( layout reg,layout asm, focus cmd, focus asm are useful ) I have update my repo with the consistent set of stuff. |
Hello all, For those of you who are building on linux, I've finally put together a proper SDK framework to replace xnu-deps-linux and the chroot environment. This SDK framework has been designed with the intent of being useful for building both the kernel and the yet-to-be-made userspace. You can grab a prebuilt deb package for this new framework from here: https://www.dropbox.com/s/ynxq2zrocb43ehx/darwin-sdk_1.0_amd64.deb?dl=0 I'll also be updating xnu's build system to reflect these changes, which should be done shortly. And I'll also start work on the wiki tonight. :) and DanielKristofKiss, Thank you very much for investigating the debugging problem and for discovering that nasty bug. If you send a pull request I can get that fix merged in the main tree. Edit: haha, helps to read. :P I'll see what I can do to create a properfix for that bug. But again, thanks for finding the problem. |
Migeration to darwin-sdk from xnu-deps-linux is complete. For anyone building on linux, you will need to upgrade to the darwin sdk if you wish to take advantage of any further changes from now on. |
hi all, I think it could be compiled on linux as well out of box. |
rzhikharevich, I've implemented what should hopefully be a proper fix for OSBacktrace and I've verified that it works on my side (via qemu), could you let me know if it is working on your side? Thanks. |
b-man, I got this: make[6]: *** No rule to make target There's really no such header there. |
I removed all my sources and recloned it. Now compiles successfully. It boots on iPhone 4 now. |
It tried it with your ramdisk. It stucks on "Tuning kernel parameters", is it normal? |
rzhikharevich, Hmm, try commenting out these two lines in /etc/rc.boot inside the ramdisk and see what results you get: |
b-man, sorry for the delay, I was on holidays. I have commented it and hostname setting out. Now boots successfully until the "login:" prompt. Is it possible for someone in future to write a Camera Connection Kit driver for the winocm's kernel port for using USB keyboards with it? |
I have added "ls /dev" to the boot script. Seems like it doesn't have disk0. It needs a NAND driver, right? |
rzhikharevich, No problem, hope you had a good break. :) It looks like this boot hang bug is also present on the BeagleBone Black I've recently acquired. I'll try to investigate this problem the next time I have some free time (school is starting for me next week). As for your first question, I'm sure it's definitely possible; it's just a matter of whether or not someone will be willing to put in the time to write such a driver. For your second question, yes; if the ramdisk was booted from a physical device such as NAND flash or an mmc card, it would be presented as a 'disk0' device. However since the entire ramdisk is loaded into ram at startup by the bootloader, it would be presented as a 'md0' (memory device 0) device. This is why rd=md0 is passed in bootargs before the bootloader passes control to the kernel. |
b-man, very close... qemu-system-arm -machine realview-pb-a8 -m 512 -kernel GenericBooter-next/uImage -append "rd=md0 debug=0x16e serial=3 -v symbolicate_panics=1" -serial stdio -nographic Added memory device md0/rmd0 (02000000/0D000000) at 00000000808B3000 for 0000000001800000 Mac OS version: Kernel version: System uptime in nanoseconds: 2209483000 Any thoughts? Tried many different Ramdisks, both GenericBoot and -next. |
By now everyone will have heard about Swift’s release to open source. http://www.apple.com/pr/library/2015/12/03Apple-Releases-Swift-as-Open-Source.html http://www.apple.com/pr/library/2015/12/03Apple-Releases-Swift-as-Open-Source.html https://swift.org https://swift.org/ https://github.com/apple/swift https://github.com/apple/swift However, some may not yet have heard about the Swift Core Libraries project. https://swift.org/core-libraries/#libdispatch https://swift.org/core-libraries/#libdispatch https://github.com/apple/swift-corelibs-foundation https://github.com/apple/swift-corelibs-foundation My question is how close this project comes to replicating the functionality of Darwin. I’m guessing that any attempt to reimplement XNU in Swift is currently experimental, and being undertaken (if at all) primarily for what the effort can contribute to the development of the language, although, for the long term, the writing would appear to be on the wall pointing to that eventually happening. Thoughts? -jp |
I am facing an issue very similar to @nightsuns and @cdickman . Please help me. I want to successfully boot and be able to use this kernel for educational purpose. |
@b-man I am facing an issue very similar to @nightsuns and @cdickman . Please help me. I want to successfully boot and be able to use this kernel for educational purpose. |
Hello @androidisbest There was a bug in OSKext::removeKextBootstrap that I thought I had fixed, but apparently it is still broken. Unfortunately I haven't had time to continue to work on these problems due to school. |
Hey @b-man , Following is the serial stdio output on my terminal: Filling vm_pages with pattern: 0xdeb8f177 |
@b-man ml_static_mfree: Released 0x167 pages at VA 0x8074b000, size:0x166970, last ppn: 0x708b1 Mac OS version: Kernel version: System uptime in nanoseconds: 2192507000 Waiting for remote debugger connection. Waiting for remote debugger connection. Please go to http://github.com/winocm/xnu to report this panic. Please go to http://github.com/winocm/xnu to report this panic. |
Ok after digging deep into the code late in the night after my office with my eyes almost dying to close, I commented out the assert statement in osfmk/vm/vm_map.c at line 5227 to see if that is gonna take me any where further and to my surprise I was successfully able to login with root and shell came up. I am still not sure why that assertion was failing even though when I dug deep and found out that the macro MACHINE_PMAP_IS_EMPTY is set as 1, so it must always do this-> return pmap_is_empty(map->pmap, start, end); which is this boolean_t
} which will essentially return true Anyways let me know if you come up with proper solution I know for know this is not a proper fix, but I am happy I could boot it up somehow. LoL..And a big thanks to @winocm for doing all this for people like me. What a pure genius! Let me know how can I be involved in this project @winocm . |
I didn't encounter these errors on earlier versions:
...
Undefined symbols for architecture armv7:
"___divsi3189", referenced from:
IOService::notifyControllingDriverDone() in IOServicePM.cpo
"__udivsi3190", referenced from:
IOService::tellClientsWithResponse(int) in IOServicePM.cpo
"udivsi3281", referenced from:
IOPMrootDomain::sysPowerDownHandler(void, void, unsigned long, IOService, void, unsigned int) in IOPMrootDomain.cpo
"___udivsi3282", referenced from:
IOPMrootDomain::handleAggressivesRequests() in IOPMrootDomain.cpo
"___udivsi3283", referenced from:
IOPMrootDomain::handleAggressivesRequests() in IOPMrootDomain.cpo
"__udivsi3284", referenced from:
IOPMrootDomain::getAggressiveness(unsigned long, unsigned long) in IOPMrootDomain.cpo
"__udivsi362", referenced from:
IOGeneralMemoryDescriptor::dmaCommandOperation(unsigned long, void, unsigned int) const in IOMemoryDescriptor.cpo
"___udivsi363", referenced from:
IOGeneralMemoryDescriptor::wireVirtual(IODirection) in IOMemoryDescriptor.cpo
"___udivsi364", referenced from:
IOGeneralMemoryDescriptor::complete(IODirection) in IOMemoryDescriptor.cpo
"___udivsi392", referenced from:
_hibernate_write_image in IOHibernateIO.cpo
"_udivsi394", referenced from:
ProgressUpdate(hibernate_graphics_t, unsigned char, int, int) in IOHibernateIO.cpo
"___udivsi395", referenced from:
_hibernate_machine_init in IOHibernateIO.cpo
"_umodsi310", referenced from:
OSSymbolPool::removeSymbol(OSSymbol) in OSSymbol.cpo
"umodsi39", referenced from:
OSSymbolPool::findSymbol(char const) const in OSSymbol.cpo
"memcpy2", referenced from:
IODataQueue::setNotificationPort(ipc_port) in IODataQueue.cpo
"memcpy417", referenced from:
OSKext::getKmodInfo(kmod_info, unsigned int) in OSKext.cpo
"memcpy91", referenced from:
IOHibernateSystemSleep in IOHibernateIO.cpo
"memset13", referenced from:
IOMemoryCursor::genPhysicalSegments(IOMemoryDescriptor, unsigned long, void, unsigned long, unsigned long, unsigned long) in IOMemoryCursor.cpo
"memset188", referenced from:
IOService::addPowerChild(IOService) in IOServicePM.cpo
"memset93", referenced from:
ProgressUpdate(hibernate_graphics_t, unsigned char, int, int) in IOHibernateIO.cpo
ld: symbol(s) not found for architecture armv7
...
I am trying to compile it for S5L8930 (Apple A4). I have Xcode 6.0.1 installed.
The text was updated successfully, but these errors were encountered: