that's now how you use -Xarch_XXX. Please read the man page again.
Shantonu Sen
Sent from my Mac Pro
On Apr 27, 2010, at 4:21 PM, mogambo wrote: Hi Nik,
I see that _lck_mtx_unlock_darwin10 is in Libkern.kext executable on 10.6 only - kextfind reports that it is defined for ppc, i386 and x86_64. Checking with kextfind and nm/grep does not find _lck_mtx_unlock_darwin10 on 10.5 and 10.4 (it finds _lck_mtx_unlock though).
I tried what Shantonu had suggested, but did not quite work. I am not sure if you saw my reply, but I tried adding arch specific -isysroot, but got an error:
gcc -arch ppc -Xarch_ppc -isysroot $(SDKROOT) -arch i386 -Xarch_i386 -isysroot $(SDKROOT) -arch x86_64 -Xarch_x86_64 -isysroot $(SDKROOT10_6)
gcc-4.2: file /Developer/SDKs/MacOSX10.5.sdk specified more than once on the command line
Note that SDKROOT was 10.5.sdk and SDKROOT10_6 was 10.6.sdk.
-m.
On Mon, Apr 26, 2010 at 5:41 PM, Nik Gervae <email@hidden> wrote:
kextfind was introduced with 10.5, so you won't see it on 10.4. Even without that, you can use stock development and unix tools....
Try nm on the Libkern.kext executable to see if _lck_mtx_unlock_darwin10 is there. If it isn't, double-check by opening the executable in emacs or another raw-text editor and searching for the string (you can even grep for it). I did note on my machine that grep found the symbol but nm didn't report it. I haven't had a chance to dig into why that might be, but it does seem odd!
The internals of your kext would be the Info.plist and the executable, if you can send that (do so off-list, of course).
Nik
On 26 Apr, 2010, at 15:45 , mogambo wrote: Hi Nik,
Here are my findings:
On the 10.6/64-bit where I build the supposed UB:
# nm fsd.kext/Contents/MacOS/fsd | grep darwin10 U _lck_mtx_unlock_darwin10
$ sw_vers ProductName: Mac OS X ProductVersion: 10.5.7 BuildVersion: 9J61
$ nm fsd.kext/Contents/MacOS/fsd -bash: nm: command not found $ kextfind -dsym _lck_mtx_unlock_darwin10 $ <no results>
Yes, com.apple.kernel.libkern is in my OSBundleLibraries. kextfind does not find the symbols on 10.5, which is what I'd expect since it's already failing with Undefined Symbol error on 10.5. Somehow on 10.4 it is able to resolve the symbols. I could not find kextfind on 10.4, so could not check what defines the symbols there.
I'd be happy to provide all I can to get to the bottom of this issue. What internals do you need for my kext?
Thanks, -m.
On Mon, Apr 26, 2010 at 1:47 PM, Nik Gervae <email@hidden> wrote:
I'm not set up at the moment to diagnose problems *on* 10.5, but I could check your kext's internals if you want to send it.
Some things you could try are:
nm fsd.kext
kextfind -dsym _lck_mtx_unlock_darwin10
The first dumps all the symbols, so you can double check the nature of _lck_mtx_unlock_darwin10 (it's probably undefined but maybe there's a weird problem internally). The kextfind command should find which kext (if any) defines the symbol that's failing to link: on my Snow Leopard system it says Libkern.kext (com.apple.kpi.libkern, not com.apple.kernel.libkern) is the one that defines it for i386. Is that in your OSBundleLibraries?
I'll have to dig out a 10.5. disk to run kextfind myself, but you can probably do that directly.
Nik Gervae
Kext Management Engineer
Apple, Inc.
On 23 Apr, 2010, at 15:42 , mogambo wrote:
> Hi,
>
> We have a file system driver kext that we build with make. We build two separate versions for 32- and 64-bit OS X since last year when 10.6 was released. I did some tweaks to the Makefile and was able to build a UB on 10.6.2 x86_64 machine containing code for all 3 architectures we support - ppc, i386 and x86_64. I was able to load the same kext on 10.4/ppc, 10.6/i386 and 10.6/x86_64.
>
> When I tried to load the same kext on a 10.5.7/i386, it failed with the following errors:
> $ sudo kextload fsd.kext
> kld(): Undefined symbols:
> ___stack_chk_fail
> ___stack_chk_guard
> _lck_mtx_unlock_darwin10
> kextload: kld_load_from_memory() failed for module /Users/apple/fsd-47.107/fsd.kext/Contents/MacOS/fsd
> kextload: a link/load error occured for kernel extension fsd.kext
> link/load failed for extension fsd.kext
> (run kextload with -t for diagnostic output)
>
> I added -fno-stack-protector to gcc, which got rid of stack_chk{fail,guard} errors. However, _lck_mtx_unlock_darwin10 persists.
>
> Here's the gcc command line:
> gcc -arch ppc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.4 -g -static -nostdinc -Wall -Wno-switch -fno-stack-protector -msoft-float -mlong-branch -force_cpusubtype_ALL -fno-builtin -DKERNEL -DAPPLE -D__KERNEL__ -DKERNEL_PRIVATE -DOPENSSL_NO_STDIO -DOPENSSL_NO_ENGINE -DOPENSSL_NO_FP_API -DOPENSSL_NO_SHA256 -DOPENSSL_NO_SHA512 -DOPENSSL_NO_ASM -DNO_OLD_ASN1 -DOPENSSL_NO_DEPRECATED -DOPENSSL_NO_BIO -DPROFILE -DOPENSSL_NO_ERR -I. -I.. -I/System/Library/Frameworks/Kernel.framework/Headers -I/System/Library/Frameworks/Kernel.framework/Headers/bsd -I/Users/apple/workspace/include -I/Developer/SDKs/MacOSX10.6.sdk -I/usr/include/sys -c probe.c -o probe.o
>
> The linker command line:
> gcc -arch ppc -arch i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.4 -static -Wall -nostdlib -r -lkmod -lkmodc++ -lcc_kext -Xlinker -kext -o fsd <list of .o files>
>
> Any ideas?
>
> Thanks!
> -m.
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Darwin-kernel mailing list ( email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|