Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

.o files?

0 views
Skip to first unread message

hadi motamedi

unread,
Feb 8, 2010, 4:16:49 AM2/8/10
to
Dear All
Can you please let me know if the .o file extension comes from Unix/
GCC object files and how to open them ?
Thank you

hume.sp...@bofh.ca

unread,
Feb 8, 2010, 8:38:55 AM2/8/10
to
hadi motamedi <motam...@gmail.com> wrote:
> Can you please let me know if the .o file extension comes from Unix/
> GCC object files and how to open them ?

Yes, .o is a compiled but not linked program. There are a number of
compilers for various languages that will spit out a .o file.

You can't open them; they're not functional programs, merely the pieces
of one. You can find out what functions it contains using 'nm'. ie:

nm object.o

--
Brandon Hume - hume -> BOFH.Ca, http://WWW.BOFH.Ca/

hadi motamedi

unread,
Feb 9, 2010, 12:12:04 AM2/9/10
to
On Feb 8, 1:38 pm, hume.spamfil...@bofh.ca wrote:

Thanks for your reply . Can you please let me know how can I get help
on one of the functions it contain ?
Regards

Message has been deleted

hadi motamedi

unread,
Feb 9, 2010, 2:23:27 AM2/9/10
to
On Feb 9, 5:32 am, Michael Vilain <vil...@NOspamcop.net> wrote:
> In article
> <22c2b8d0-aeb0-48ff-8aac-985e3a6b0...@d37g2000yqa.googlegroups.com>,
> Contact the person that wrote the function.  If you don't have that
> info, then you should write your own version of the function rather than
> try to reengineer what this other person wrote.
>
> --
> DeeDee, don't press that button!  DeeDee!  NO!  Dee...
> [I filter all Goggle Groups posts, so any reply may be automatically by ignored]- Hide quoted text -
>
> - Show quoted text -

Thanks for your reply . I want to try for my own . My server is
Solaris 8 and the target is running VxWorks 5.4.2 . Can you please let
me know what application packages do I need to install on my Solaris 8
to do the job ? I want to write my own function and put it inside
the .o compiled file and upload to the target to run.


Ian Collins

unread,
Feb 9, 2010, 2:28:02 AM2/9/10
to
hadi motamedi wrote:
>
> Thanks for your reply . I want to try for my own . My server is
> Solaris 8 and the target is running VxWorks 5.4.2 . Can you please let
> me know what application packages do I need to install on my Solaris 8
> to do the job ? I want to write my own function and put it inside
> the .o compiled file and upload to the target to run.

You can't do that unless you have the original source file.

--
Ian Collins

hadi motamedi

unread,
Feb 9, 2010, 2:35:29 AM2/9/10
to

Thank you for your help. I do not want to replace one of the functions
inside the original *.o file but rather want to try to write my own
sample code with a few functions inside. Actually , I want to replace
the original *.o file with my own compiled code . I need to know which
application packages I need to have on my Solaris 8 server to produce
the same *.o file format ,since my VxWorks target just reads *.o
executable files in his /compile/ppc folder . Please give me a hint on
this .

Ian Collins

unread,
Feb 9, 2010, 3:07:27 AM2/9/10
to
hadi motamedi wrote:
> On Feb 9, 7:28 am, Ian Collins <ian-n...@hotmail.com> wrote:
>> hadi motamedi wrote:
>>
>>> Thanks for your reply . I want to try for my own . My server is
>>> Solaris 8 and the target is running VxWorks 5.4.2 . Can you please let
>>> me know what application packages do I need to install on my Solaris 8
>>> to do the job ? I want to write my own function and put it inside
>>> the .o compiled file and upload to the target to run.
>> You can't do that unless you have the original source file.
>
> Thank you for your help. I do not want to replace one of the functions
> inside the original *.o file but rather want to try to write my own
> sample code with a few functions inside. Actually , I want to replace
> the original *.o file with my own compiled code . I need to know which
> application packages I need to have on my Solaris 8 server to produce
> the same *.o file format ,since my VxWorks target just reads *.o
> executable files in his /compile/ppc folder . Please give me a hint on
> this .

If you are cross-compiling for a VxWorks target, you need the
appropriate vendor tools. You should check with them.

--
Ian Collins

hadi motamedi

unread,
Feb 9, 2010, 3:15:16 AM2/9/10
to
> Ian Collins- Hide quoted text -

>
> - Show quoted text -

Thank you for your comment . But generally speaking , can you please
let me know which Solaris 8 compilers do produce *.o compiled file
output ?

Message has been deleted

hadi motamedi

unread,
Feb 9, 2010, 5:57:44 AM2/9/10
to
On Feb 9, 9:42 am, Michael Vilain <vil...@NOspamcop.net> wrote:
> In article
> <a120ba99-422b-4063-abf9-0b6c85720...@n33g2000yqb.googlegroups.com>,
> All the language compilers produce .o files (object files--goggle it).  
> That's what compilers do, regardless of if they're written by Sun or
> they're GNU/open source.  With Solaris 8, you're limited to the GNU
> compilers unless you bought the Sun compilers.  I think VxWorks requires
> their own compilers which you will have to buy.
>
> http://www.cross-comp.com/instr/pages/embedded/VxWorksTutorial.aspx

>
> --
> DeeDee, don't press that button!  DeeDee!  NO!  Dee...
> [I filter all Goggle Groups posts, so any reply may be automatically by ignored]- Hide quoted text -

>
> - Show quoted text -

Thank you for your reply . I checked on my Solaris 8 server for the
compiler packages :
bash-2.03# pkginfo |grep Compiler
system SUNWlibC Sun Workshop Compilers
Bundled libC
system SUNWmfdev Motif UIL Compiler
system SUNWscbcp SPARCompilers Binary
Compatibility Libraries
So it seems that I have SUN compilers installed . Can you please let
me know how can I make use of them to compile my C++ code into *.o
file ?

Chris Ridd

unread,
Feb 9, 2010, 6:00:43 AM2/9/10
to
On 2010-02-09 09:42:24 +0000, Michael Vilain said:

> they're GNU/open source. With Solaris 8, you're limited to the GNU
> compilers unless you bought the Sun compilers.

Sun Studio 11 runs on Solaris 8, and is free. You can still download it
from Sun^WOracle.
--
Chris

Chris Ridd

unread,
Feb 9, 2010, 6:14:29 AM2/9/10
to
On 2010-02-09 10:57:44 +0000, hadi motamedi said:

> So it seems that I have SUN compilers installed . Can you please let
> me know how can I make use of them to compile my C++ code into *.o
> file ?

Try reading the C++ compiler manual. Search docs.sun.com for "sun studio".
--
Chris

Casper H.S. Dik

unread,
Feb 9, 2010, 6:49:56 AM2/9/10
to
hadi motamedi <motam...@gmail.com> writes:

>Thank you for your reply . I checked on my Solaris 8 server for the
>compiler packages :
>bash-2.03# pkginfo |grep Compiler
>system SUNWlibC Sun Workshop Compilers Bundled libC
>system SUNWmfdev Motif UIL Compiler
>system SUNWscbcp SPARCompilers Binary Compatibility Libraries
>So it seems that I have SUN compilers installed . Can you please let
>me know how can I make use of them to compile my C++ code into *.o
>file ?

No, you're not; the three packages listed are the runtime packages
(plus the *motif* compiler).

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.

Richard B. Gilbert

unread,
Feb 9, 2010, 10:44:49 AM2/9/10
to

All of them! That's what compilers do!

A C compiler is readily available. I've never tried to find Fortran for
Solaris but it's possible, even probable, that a Fortran compiler
exists. A BASIC interpreter may be available somewhere but I couldn't
say where.

hadi motamedi

unread,
Feb 10, 2010, 1:20:37 AM2/10/10
to
On Feb 8, 1:38 pm, hume.spamfil...@bofh.ca wrote:

Can you please let me know which other commands (like nm) can be used
to bring out useful information from the *.o compiled object file ?

Message has been deleted

Doug McIntyre

unread,
Feb 10, 2010, 1:49:01 AM2/10/10
to
hadi motamedi <motam...@gmail.com> writes:

>On Feb 8, 1:38=A0pm, hume.spamfil...@bofh.ca wrote:
>> hadi motamedi <motamed...@gmail.com> wrote:
>> > Can you please let me know if the .o file extension comes from Unix/
>> > GCC object files and how to open them ?
>>
>> Yes, .o is a compiled but not linked program. =A0There are a number of

>> compilers for various languages that will spit out a .o file.
>>
>> You can't open them; they're not functional programs, merely the pieces
>> of one. =A0You can find out what functions it contains using 'nm'. =A0ie:
>>
>> =A0 =A0 =A0 =A0 nm object.o
>>
>> --
>> Brandon Hume =A0 =A0- hume -> BOFH.Ca,http://WWW.BOFH.Ca/

>Can you please let me know which other commands (like nm) can be used
>to bring out useful information from the *.o compiled object file ?


nm will give you the best info you are going to get out of it.

dis may be helpful if you understand assembly language that the source
is actually assembled into before the assembler takes over and creates
the .o file, but then you'll have to reverse engineer what the code is doing.

Unless you have alot of time to reverse engineer, its usually quicker
and easier to rewrite everything from scratch. It takes quite a
special person to be able to do reverse engineering and get something usable.

The .o file has the minimal information left needed to get everything
into a program, this is not a file format that is close to the
original source, this is a file that is bare-bones machine level in
order to get a program to run on the machine.

Chris Ridd

unread,
Feb 10, 2010, 2:04:56 AM2/10/10
to
On 2010-02-10 06:46:26 +0000, Michael Vilain said:

> In article
> <4db6d75a-6a24-43e1...@d27g2000yqn.googlegroups.com>,


> hadi motamedi <motam...@gmail.com> wrote:
>
>> Can you please let me know which other commands (like nm) can be used
>> to bring out useful information from the *.o compiled object file ?
>

> .o files aren't intended for human use. They're for a link-editor (ld)
> to create a running program. AFAIK, nm is it.

/usr/ccs/bin/elfdump will also extract information from .o files.
--
Chris

hadi motamedi

unread,
Feb 10, 2010, 2:11:18 AM2/10/10
to
On Feb 10, 6:49 am, Doug McIntyre <mer...@geeks.org> wrote:
> order to get a program to run on the machine.- Hide quoted text -

>
> - Show quoted text -

Thanks for your reply . I found the 'dis' is very helpful . But how
can I extract the assembly language code by using it ?

hadi motamedi

unread,
Feb 10, 2010, 3:13:50 AM2/10/10
to
On Feb 10, 7:04 am, Chris Ridd <chrisr...@mac.com> wrote:
> On 2010-02-10 06:46:26 +0000, Michael Vilain said:
>
> > In article
> > <4db6d75a-6a24-43e1-9aec-43a1f6c10...@d27g2000yqn.googlegroups.com>,

> >  hadi motamedi <motamed...@gmail.com> wrote:
>
> >> Can you please let me know which other commands (like nm) can be used
> >> to bring out useful information from the *.o compiled object file ?
>
> > .o files aren't intended for human use.  They're for a link-editor (ld)
> > to create a running program.  AFAIK, nm is it.
>
> /usr/ccs/bin/elfdump will also extract information from .o files.
> --
> Chris

I tried to install the gcc on my Solaris 8 , as the followings :
%gunzip gcc-3.2.2-sol8-sparc-local.gz |tar xvf –
%pkgadd –d gcc-3.2.2-sol8-sparc-local.pkg
But at the end , my Solaris 8 server returned as 'gcc command not
found' . Can you please let me know how can I make use of it ?
Thank you

hadi motamedi

unread,
Feb 10, 2010, 3:22:01 AM2/10/10
to
On Feb 10, 7:04 am, Chris Ridd <chrisr...@mac.com> wrote:
> On 2010-02-10 06:46:26 +0000, Michael Vilain said:
>
> > In article
> > <4db6d75a-6a24-43e1-9aec-43a1f6c10...@d27g2000yqn.googlegroups.com>,

> >  hadi motamedi <motamed...@gmail.com> wrote:
>
> >> Can you please let me know which other commands (like nm) can be used
> >> to bring out useful information from the *.o compiled object file ?
>
> > .o files aren't intended for human use.  They're for a link-editor (ld)
> > to create a running program.  AFAIK, nm is it.
>
> /usr/ccs/bin/elfdump will also extract information from .o files.
> --
> Chris

Sorry to forgot to mention this :
During the package installation , it returned as 'The following files
are already installed on the system - conflict with a file - Do you
want to install these conflicting files?'
I answered as 'n' . Can you please let me know if it has caused this
problem to occur?
Thank you

Chris Ridd

unread,
Feb 10, 2010, 4:49:06 AM2/10/10
to

Set your PATH to include the directory that package put gcc in. If that
package is from sunfreeware.com, I think it'll need /usr/local/bin.

--
Chris

hadi motamedi

unread,
Feb 10, 2010, 4:55:48 AM2/10/10
to
> Chris- Hide quoted text -

>
> - Show quoted text -

Thank you very much . It got through . OR using full path name for the
gcc command.

Richard B. Gilbert

unread,
Feb 10, 2010, 11:02:57 AM2/10/10
to

What "useful information" are you looking for. A binary object file is
not well stocked with "information". It is usually input to the linker
where it is linked with other modules and library routines to form an
executable binary; e.g. a program that you can execute.

hume.sp...@bofh.ca

unread,
Feb 10, 2010, 11:07:13 AM2/10/10
to
hadi motamedi <motam...@gmail.com> wrote:
> Thanks for your reply . I found the 'dis' is very helpful . But how
> can I extract the assembly language code by using it ?

What exactly are you trying to accomplish? Is this all just a learning
exercise?

Richard B. Gilbert

unread,
Feb 10, 2010, 11:09:39 AM2/10/10
to
hume.sp...@bofh.ca wrote:
> hadi motamedi <motam...@gmail.com> wrote:
>> Thanks for your reply . I found the 'dis' is very helpful . But how
>> can I extract the assembly language code by using it ?
>
> What exactly are you trying to accomplish? Is this all just a learning
> exercise?
>

It DOES have a little of the flavor of a student trying to fish someone
into doing his homework for him. . . .

Doug McIntyre

unread,
Feb 10, 2010, 12:55:45 PM2/10/10
to
hadi motamedi <motam...@gmail.com> writes:
>Thanks for your reply . I found the 'dis' is very helpful . But how
>can I extract the assembly language code by using it ?

The output of dis *is* the assembly language code. Thats as human
readable as you are going to get.


Colin B.

unread,
Feb 12, 2010, 2:46:24 PM2/12/10
to
hadi motamedi <motam...@gmail.com> wrote:

> I tried to install the gcc on my Solaris 8 , as the followings :

> %gunzip gcc-3.2.2-sol8-sparc-local.gz |tar xvf ?
> %pkgadd ?d gcc-3.2.2-sol8-sparc-local.pkg


> But at the end , my Solaris 8 server returned as 'gcc command not
> found' . Can you please let me know how can I make use of it ?
> Thank you

It sounds like you need to pick up a good 'intro to Unix' book.
Also, start reading here:
http://docs.sun.com/app/docs/prod/solaris.8?l=en&a=view

hadi motamedi

unread,
Feb 14, 2010, 11:35:47 AM2/14/10
to
On Feb 10, 9:55 am, Doug McIntyre <mer...@geeks.org> wrote:

Thanks for your reply . But the output of my 'dis mss.o' is like the
followings :
"38a8: 41 86 00 24 ???
38ac: 3d 20 00 00 ???
38b0: 39 69 00 00 ???
38b4: 80 6b 00 00 ???
38b8: 48 00 00 01 ???
38bc: 3d 20 00 00 ???
38c0: 39 69 00 00 ???
38c4: 38 00 ff ff ???
38c8: 90 0b 00 00 ???
38cc: 3d 20 00 00 ???
38d0: 39 69 00 00 ???
38d4: 80 0b 00 00 ???
38d8: 39 20 ff ff ???
38dc: 7c 80 48 00 ???
38e0: 41 86 00 24 ???
38e4: 3d 20 00 00 ???
38e8: 39 69 00 00 ???
38ec: 80 6b 00 00 ???
38f0: 48 00 00 01 ???
38f4: 3d 20 00 00 ???
38f8: 39 69 00 00 ???
38fc: 38 00 ff ff ???"
Can you please let me know why this is not readable in my case ?

Doug McIntyre

unread,
Feb 14, 2010, 3:22:26 PM2/14/10
to
hadi motamedi <motam...@gmail.com> writes:

This part of the file looks like it is just raw data. Could be
constants needed for operation, could be static pointers. Could static
ints, could be anything. .o files have both code and data in them.

Without reverse engineering the whole code, you'll never know. All the
structured information about it is gone by the time its an .o file. By
that level, the assembly language earlier on in the listing will be
referencing the data by raw data location.

It also could be that the .o file you have is for a different
architecture than what you are running on now. Ie. i386 code is
slightly different than x64, which is alot different than SPARC code,
is alot different than PPC code, is alot different than HP/PA code.

If you do have a PPC based .o file on an i386 box, there are other
tools to disassemble it, it could just be raw data as well that makes
no sense in any context.

hume.sp...@bofh.ca

unread,
Feb 14, 2010, 9:10:33 PM2/14/10
to
hadi motamedi <motam...@gmail.com> wrote:
> Thanks for your reply . But the output of my 'dis mss.o' is like the
> followings :
> "38a8: 41 86 00 24 ???

Again, what are you trying to do? Where did you get this file? People
would be able to help you better if they could be sure this wasn't some
random file you accidentally downloaded.

hadi motamedi

unread,
Feb 16, 2010, 12:11:03 AM2/16/10
to
On Feb 15, 2:10 am, hume.spamfil...@bofh.ca wrote:

Thank you for your reply . I have an SPARC Sun Solaris 8 platform that
will load the mss.o object file on an VxWork 5.2 target . According to
the 'nm mss.o' output , it contains the SS7 function that I want to
slightly modify it to accomodate with the new third party network
element received . To this end , I tried for 'dis mss.o' but as you
see the output is not readable . Can you please correct me ?

Doug McIntyre

unread,
Feb 16, 2010, 12:39:55 AM2/16/10
to
hadi motamedi <motam...@gmail.com> writes:

>On Feb 15, 2:10=A0am, hume.spamfil...@bofh.ca wrote:
>> hadi motamedi <motamed...@gmail.com> wrote:
>> > Thanks for your reply . But the output of my 'dis mss.o' is like the
>> > followings :
>> > "38a8: =A041 86 00 24 =A0 =A0 =A0 =A0 ???
>>
>> Again, what are you trying to do? =A0Where did you get this file? =A0Peop=

>le
>> would be able to help you better if they could be sure this wasn't some
>> random file you accidentally downloaded.
>>
>> --
>> Brandon Hume =A0 =A0- hume -> BOFH.Ca,http://WWW.BOFH.Ca/

>Thank you for your reply . I have an SPARC Sun Solaris 8 platform that
>will load the mss.o object file on an VxWork 5.2 target . According to
>the 'nm mss.o' output , it contains the SS7 function that I want to
>slightly modify it to accomodate with the new third party network
>element received . To this end , I tried for 'dis mss.o' but as you
>see the output is not readable . Can you please correct me ?


Reverse engineering code from compiled object files takes a special
person that has a knack for it. Even so, it'll take longer by far to
reverse engineer from raw data back into usable code than it would
take to just write a new version from scratch.

What you are trying to acomplish isn't the right way to go about it,
there is nothing easy about what you are trying to do, learning how
the original module works and rewriting it from scratch would be easier.

0 new messages