PSARC/2008/179 cross link-editor
Ali Bahrami
Ali.Bahrami at sun.com
Thu Mar 6 11:36:49 PST 2008
John Plocher wrote:
> Ali Bahrami wrote:
>> My feeling is that this wouldn't be the right thing. In principle,
>> a cross compiled object should be identical to the same object built
>> natively, and isn't a primary attribute in same way that the information
>> displayed by 'file' is.
>
> If I'm crosscompiling a distro for a set of architectures,
> I'm likely to have object files for each:
>
> ./foo.c
> ./obj-x86/foo.o
> ./obj-x86/foo
> ./obj-sparc/foo.o
> ./obj-sparc/foo
>
> In this case, the file command tells me some info; the question
> is if it is sufficient for simple makefile sanity checking (did
> I manage to build the right mix of stuff?)
>
> I'm happy with whatever path you take - I just wanted to check
> to see if there was value there...
>
> -John
>
If you are cross compiling a distro, and you want to verify that
the right type of object got built, I think the information from 'file'
tells you what you want. The point is to ensure that a certain type
of object got built, not to verify where it was built, right?
However, if you did want to verify where an object was built, elfedit
makes that easy. For example, consider the sparc binary 'foo'
that I built recently using my X86 cross linker:
% file foo
foo: ELF 32-bit MSB executable SPARC32PLUS Version 1, V8+ Required, dynamically linked, not stripped
% LDMACH=`elfedit -r -osimple -e 'dyn:sunw_ldmach' foo`
% echo $LDMACH
EM_386
In fact, elfedit makes parsing that 'file' output easier too:
% MACH=`elfedit -r -osimple -e 'ehdr:e_machine' foo`
% echo $MACH
EM_SPARC32PLUS
which easier to script against than the output from 'file'.
Let me know if this doesn't address your question. Thanks...
- Ali
More information about the opensolaris-arc
mailing list