Re: dyld 2 questions
Re: dyld 2 questions
- Subject: Re: dyld 2 questions
- From: Terry Lambert <email@hidden>
- Date: Mon, 10 Mar 2008 20:31:24 -0700
On Mar 8, 2008, at 12:31 PM, mm w wrote:
no it's really not at boottime
imagine in a syslog
loaded mach-o index 0
foo prog array {x86_64,i386}
(mach-o [index 0
x86_64 code
index 1
i386 code])
my question was related to runtime, if I could force to load i386 code
rather than x86_64 code section
Yes. That is precisely what the "arch" command does. If you are
exec'ing the binary yourself, there are also preference order
extensions to posix_spawn() to allow you to cause a particular slice
to be spawned. That's the underlying primitive system call which the
arch command is based on, and it is how the testing checkbox in XCode
is implemented. That method is less portable, since CPU IDs and
families tend to evolve over time, so you are unlikely to be able to
write a program now using that that will continue working correctly in
the future. You would be better served to invoke "arch" from within
your program, if you plan on doing this; the reason the command exists
is that it gets revised when the OS is revised, so it can be used
portably in scripts.
I don't care to get the process, I wanted to know which section has
been loaded
yes and sure I know well everything that you try to express but it's
realy out the box of my question
Either of the two commands:
ps gaxO flags
Will report 64 bit processes. If the flags field contains 0x0004,
then it's a 64 bit process.
open -a "Activity Monitor"
Will run the GUI tool Activity Monitor, which reports whether a
process is 32 or 64 bit.
You can also use libproc to introspect your process (or you can call
the sysctl() directly, but that is not the recommended API, going
forward). Or if you're the one doing the logging to the system log,
you can use #ifdef and log different strings.
Best Regards
On Sat, Mar 8, 2008 at 11:54 AM, David Elliott <email@hidden> wrote:
Per-process:
arch -i386 foobar
System-wide:
On x86-64 you can add -legacy to the boot-args nvram property (using
the nvram command-line tool). That will force the kernel to run in
i386 mode instead of x86-64 mode so you will not be able to run 64-
bit
programs at all and everything including the kernel itself will run
in
true i386 mode.
Be careful with this. I have been led to believe by the author of the
flag that it doesn't work on the newest machines.
-- Terry
In this situation, trying something like arch -x86_64 foobar will
totally fail since the CPU will not ever be in 64-bit mode. If
that's
what you want, you can have it. It's also useful if you are trying
to
run Darwin on certain CPUs like late-model Pentium 4 that pass the
startup checks in tsc.c, or at least did until Leopard's xnu removed
the check for CPU family 0xf (extended), but fail later on in kernel
startup because of a missing bcopy 64 commpage routine (which
requires
Supplemental SSE3 which is not present on Pentium 4).
-Dave
On Mar 8, 2008, at 2:16 PM, mm w wrote:
ha thank you, something that maches 8)
my question was not related to gcc or compilation time
it was related to runtime, so there is no way to force the OS to run
in i386 mode,
but as far I know, the mach-o loader is able to deal with it, i just
wanted to know if it was possible
to force it.
thank you for your answers
On Sat, Mar 8, 2008 at 11:11 AM, Shantonu Sen <email@hidden>
wrote:
System-wide? No. Not without recompiling your kernel.
Shantonu
Sent from my MacBook
On Mar 8, 2008, at 11:08 AM, mm w wrote:
So, to make simple, imagine a wonderful OS running on 32 extend 64
arch, all the sources are fat i386/ x86_64
is it to possible to influence the prefered mode
--
-mmw
--
-mmw
_______________________________________________
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