Anunay wrote:
> Hello all,
>
> I am trying to build my application in 64-bit mode.
>
> My command line for compilation is :-
> # CC -mt [b]-64[/b] -o /export/home1....
CC has no -64 option. Therefore the compiler driver does not know you are
trying to generate a 64-bit output file.
The complier driver passes several files to ld(1), including your test1.o.
Try "CC -dryrun", and you'll see these additional files.
The first file ld(1) processes is probably a 32-bit crt.o. ld(1) therefore
switches into building a 32-bit object. When ld(1) later comes across
the 64-bit test.o it generates the error message.
> ld: fatal: file /export/home1/etpki/obj/sol_i386_5.10/libtme/test1/test1.o:
> [b]wrong ELF class: ELFCLASS64[/b]
Try "CC -xarch=amd64". Then the compiler driver will pass the 64-bit
crt files to ld(1) triggering a 64-bit build.
From ld(1):
No command-line option is required to distinguish 32-bit
objects or 64-bit objects. The link-editor uses the ELF
class of the first relocatable object file that is found on
the command line, to govern the mode in which to operate.
--
Rod.