niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » *nix » AIX
Executable on AIX..
Post new topic   Reply to topic Page 1 of 1 [14 Posts] View previous topic :: View next topic
Author Message
Colin Renouf
*nix forums beginner


Joined: 24 Feb 2005
Posts: 25

PostPosted: Tue Feb 15, 2005 9:10 pm    Post subject: Re: Executable on AIX.. Reply with quote

On Tue, 15 Feb 2005, Gary R. Hook wrote:

Quote:


Colin Renouf wrote:

I should also add that the format of the symbol table for the XCOFF file is
found in the syms.h file in /usr/include. I have a feeling that the field
is invalid for 64-bit executables though......

Um, no. The field is used in both modes. Here's the first
line of the symbol table dump from a .o file:

[0] m 0x00000000 debug 3 FILE C:PPC64 .file

--
Gary R. Hook
________________________________________________________________________
Vocatus atque non vocatus deus aderit


I didn't think to try it. As I only have a couple of 43Ps 64-bit is wild
dream.....The header file is a bit misleading as it implies that the value
can't be relied upon, i.e. in /usr/include/syms.h we have
32-bit 64-bit
| n_type (Note 2) | same | same
|

And Note 2 reads


Note 2: For an XCOFF64 file, the n_type field may only have the values
0 (if the symbol is not a function) or 0x0020 (if the symbol
is a function).

Suitably vague....


Colin Renouf
Back to top
Gary R. Hook
*nix forums Guru Wannabe


Joined: 22 Feb 2005
Posts: 172

PostPosted: Tue Feb 15, 2005 5:56 pm    Post subject: Re: Executable on AIX.. Reply with quote

Colin Renouf wrote:
Quote:

I should also add that the format of the symbol table for the XCOFF file
is found in the syms.h file in /usr/include. I have a feeling that the
field is invalid for 64-bit executables though......

Um, no. The field is used in both modes. Here's the first
line of the symbol table dump from a .o file:

[0] m 0x00000000 debug 3 FILE C:PPC64 .file

--
Gary R. Hook
________________________________________________________________________
Vocatus atque non vocatus deus aderit
Back to top
Colin Renouf
*nix forums beginner


Joined: 24 Feb 2005
Posts: 25

PostPosted: Sun Feb 13, 2005 8:39 pm    Post subject: Re: Executable on AIX.. Reply with quote

On Sun, 13 Feb 2005, Colin Renouf wrote:

Quote:


On Fri, 11 Feb 2005, Nunya Bizness wrote:



Colin Renouf wrote:

On Mon, 7 Feb 2005, Gancy wrote:



Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari


Have you thought of using "strings executable_name"? At the top of the
executable there are usually some C library calls if C was used. I don't
know what happens for a COBOL executable....

Colin Renouf

file * | grep "executable blah-blah-blah" | cut -d: -f1 |
while read filename
do
if [ -x ${file} ]
then
printf "Executable\n"
else
printf "Object/other\n"
fi
done


Doesn't that just tell you if it is executable - not what language it was
coded in?

It can be done. Check the AIX Assembly Language Reference and the XCOFF file
format includes a language identifier. If this is preserved in the executable
then the details can be extracted. It is in the original object so I doubt
the linker would remove it...

Source Language Type
For cascade compilers, the assembler records the source-language type. In the
XCOFF file, the high-order byte of the n_type field of a symbol table entry
with the C_FILE storage class holds the source language type information. The
following language types are defined:

High-Order Byte Language
0x00 C
0x01 FORTRAN
0x02 Pascal
0x03 Ada
0x04 PL/I
0x05 Basic
0x06 Lisp
0x07 Cobol
0x08 Modula2
0x09 C++
0x0A RPG
0x0B PL8, PLIX
0x0C Assembler
0x0D-BxFF Reserved

The source language type is indicated by the .source pseudo-op. By default,
the source-language type is "Assembler." For more information, see the
.source pseudo-op.



Colin Renouf



I should also add that the format of the symbol table for the XCOFF file
is found in the syms.h file in /usr/include. I have a feeling that the
field is invalid for 64-bit executables though......

Cheers

Colin

Colin Renouf
Back to top
Colin Renouf
*nix forums beginner


Joined: 24 Feb 2005
Posts: 25

PostPosted: Sun Feb 13, 2005 4:51 pm    Post subject: Re: Executable on AIX.. Reply with quote

On Fri, 11 Feb 2005, Nunya Bizness wrote:

Quote:


Colin Renouf wrote:

On Mon, 7 Feb 2005, Gancy wrote:



Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari


Have you thought of using "strings executable_name"? At the top of the
executable there are usually some C library calls if C was used. I don't
know what happens for a COBOL executable....

Colin Renouf

file * | grep "executable blah-blah-blah" | cut -d: -f1 |
while read filename
do
if [ -x ${file} ]
then
printf "Executable\n"
else
printf "Object/other\n"
fi
done


Doesn't that just tell you if it is executable - not what language it was
coded in?

It can be done. Check the AIX Assembly Language Reference and the XCOFF
file format includes a language identifier. If this is preserved in the
executable then the details can be extracted. It is in the original object
so I doubt the linker would remove it...

Source Language Type
For cascade compilers, the assembler records the source-language type. In
the XCOFF file, the high-order byte of the n_type field of a symbol table
entry with the C_FILE storage class holds the source language type
information. The following language types are defined:

High-Order Byte Language
0x00 C
0x01 FORTRAN
0x02 Pascal
0x03 Ada
0x04 PL/I
0x05 Basic
0x06 Lisp
0x07 Cobol
0x08 Modula2
0x09 C++
0x0A RPG
0x0B PL8, PLIX
0x0C Assembler
0x0D-BxFF Reserved

The source language type is indicated by the .source pseudo-op. By
default, the source-language type is "Assembler." For more information,
see the .source pseudo-op.



Colin Renouf
Back to top
Nunya Bizness
*nix forums beginner


Joined: 22 Feb 2005
Posts: 14

PostPosted: Fri Feb 11, 2005 6:12 am    Post subject: Re: Executable on AIX.. Reply with quote

Colin Renouf wrote:

Quote:
On Mon, 7 Feb 2005, Gancy wrote:



Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari


Have you thought of using "strings executable_name"? At the top of the
executable there are usually some C library calls if C was used. I don't
know what happens for a COBOL executable....

Colin Renouf

file * | grep "executable blah-blah-blah" | cut -d: -f1 |

while read filename
do
if [ -x ${file} ]
then
printf "Executable\n"
else
printf "Object/other\n"
fi
done
Back to top
John R. Campbell
*nix forums beginner


Joined: 26 Feb 2005
Posts: 5

PostPosted: Fri Feb 11, 2005 2:07 am    Post subject: Re: Executable on AIX.. Reply with quote

Gary R. Hook wrote:
Quote:
sol gongola wrote:
Correct, an .exe suffix can be used in the file
name but unix/linux does not use the suffix to
determine if a file is an executable. It uses
the executable attribute in the directory entry
and the magic number in the file.

The way God intended it to be, and which is much
more secure.

Actually, the bits are in the permissions (mode)
field of the i-node; the directory entry only tags
a name to an inode number.

The loader will look at the file and figure out how
to execute it based upon some "magic numbers"-- one
of which is the #! in the first two chars of the
file.

--
John R. Campbell Speaker to Machines soup at tampabay dot rr dot com
"Grace is sufficient so Joy was let go." - Heather L. Campbell
"Faith manages ... even though she didn't get promoted" - me
Why OS X? Because making Unix user-friendly was easier than debugging Windows
Back to top
John R. Campbell
*nix forums beginner


Joined: 26 Feb 2005
Posts: 5

PostPosted: Fri Feb 11, 2005 2:04 am    Post subject: Re: Executable on AIX.. Reply with quote

The .exe extension on the web site only exists so that
the browser (from a PC, for instance) will recognize it
as an executable and will pull it down w/o stripping
bits or doinking with 0x0a in the stream. So it's only
a way to get the f**king browser to not f**k with the
binary file.

--
John R. Campbell Speaker to Machines soup at tampabay dot rr dot com
"Grace is sufficient so Joy was let go." - Heather L. Campbell
"Faith manages ... even though she didn't get promoted" - me
Why OS X? Because making Unix user-friendly was easier than debugging Windows
Back to top
Gary R. Hook
*nix forums Guru Wannabe


Joined: 22 Feb 2005
Posts: 172

PostPosted: Tue Feb 08, 2005 6:28 pm    Post subject: Re: Executable on AIX.. Reply with quote

sol gongola wrote:
Quote:
Correct, an .exe suffix can be used in the file name but unix/linux does not
use the suffix to determine if a file is an executable. It uses the executable
attribute in the directory entry and the magic number in the file.

The way God intended it to be, and which is much more secure.

--
Gary R. Hook
________________________________________________________________________
Vocatus atque non vocatus deus aderit
Back to top
Bill Edison
*nix forums beginner


Joined: 21 Mar 2005
Posts: 18

PostPosted: Tue Feb 08, 2005 5:43 pm    Post subject: Re: Executable on AIX.. Reply with quote

sol gongola wrote:
Quote:
Bill Edison wrote:

Correct, an .exe suffix can be used in the file name but unix/linux does not
use the suffix to determine if a file is an executable. It uses the executable
attribute in the directory entry and the magic number in the file.

This is different from microsoft, which will try to execute (and hang) a text
file if it happens to have a .com suffix.

I agree 100%!!!



Quote:
sol

Bill Edison wrote:> I've seen "exe" file extensions here and there used as a self-extracting

module similar to pkunzip. Quite a few of these can be found at
http://www/bullfreeware.com

cheers,
bill

Simon Marchese wrote:

Gancy wrote:


Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari


Do you want to tell the difference between a C/C++ executeable and a
COBOL exe or a Pascal exe? No, because they are all just exes.

Do you want to tell the difference between an executeable and any other
object? An exe has a "main". Use "nm" or "dump" to determine whether it
has or not.

BTW "x.exe" is an unusual name. *X executeables do not require a suffix
of "exe".
Back to top
sol gongola
*nix forums addict


Joined: 16 Mar 2005
Posts: 72

PostPosted: Tue Feb 08, 2005 5:27 pm    Post subject: Re: Executable on AIX.. Reply with quote

Bill Edison wrote:
Quote:

Correct, an .exe suffix can be used in the file name but unix/linux does not

use the suffix to determine if a file is an executable. It uses the executable
attribute in the directory entry and the magic number in the file.

This is different from microsoft, which will try to execute (and hang) a text
file if it happens to have a .com suffix.

sol

Bill Edison wrote:> I've seen "exe" file extensions here and there used as a self-extracting
Quote:
module similar to pkunzip. Quite a few of these can be found at
http://www/bullfreeware.com

cheers,
bill

Simon Marchese wrote:
Gancy wrote:

Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari


Do you want to tell the difference between a C/C++ executeable and a
COBOL exe or a Pascal exe? No, because they are all just exes.

Do you want to tell the difference between an executeable and any other
object? An exe has a "main". Use "nm" or "dump" to determine whether it
has or not.

BTW "x.exe" is an unusual name. *X executeables do not require a suffix
of "exe".
Back to top
Bill Edison
*nix forums beginner


Joined: 21 Mar 2005
Posts: 18

PostPosted: Tue Feb 08, 2005 4:48 pm    Post subject: Re: Executable on AIX.. Reply with quote

I've seen "exe" file extensions here and there used as a self-extracting
module similar to pkunzip. Quite a few of these can be found at
http://www/bullfreeware.com

cheers,
bill

Simon Marchese wrote:
Quote:
Gancy wrote:

Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari


Do you want to tell the difference between a C/C++ executeable and a
COBOL exe or a Pascal exe? No, because they are all just exes.

Do you want to tell the difference between an executeable and any other
object? An exe has a "main". Use "nm" or "dump" to determine whether it
has or not.

BTW "x.exe" is an unusual name. *X executeables do not require a suffix
of "exe".
Back to top
Colin Renouf
*nix forums beginner


Joined: 24 Feb 2005
Posts: 25

PostPosted: Mon Feb 07, 2005 9:01 pm    Post subject: Re: Executable on AIX.. Reply with quote

On Mon, 7 Feb 2005, Gancy wrote:

Quote:


Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari


Have you thought of using "strings executable_name"? At the top of the
executable there are usually some C library calls if C was used. I don't
know what happens for a COBOL executable....

Colin Renouf
Back to top
Simon Marchese
*nix forums addict


Joined: 25 Feb 2005
Posts: 94

PostPosted: Mon Feb 07, 2005 11:06 am    Post subject: Re: Executable on AIX.. Reply with quote

Gancy wrote:
Quote:
Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari

Do you want to tell the difference between a C/C++ executeable and a
COBOL exe or a Pascal exe? No, because they are all just exes.

Do you want to tell the difference between an executeable and any other
object? An exe has a "main". Use "nm" or "dump" to determine whether it
has or not.

BTW "x.exe" is an unusual name. *X executeables do not require a suffix
of "exe".
Back to top
ganesh_tiwari@hotmail.com
*nix forums beginner


Joined: 17 Feb 2005
Posts: 8

PostPosted: Mon Feb 07, 2005 7:06 am    Post subject: Executable on AIX.. Reply with quote

Hi All,
I need to figure out only C/C++ executable compiled on on AIX machine
using xlc. I used the 'file' command, but it reutrns following:

x.exe: executable (RISC System/6000) or object module not
stripped

'file' command returns same message even if i use it on object
modules. But i want to be able to specifically determine only a C/C++
executable.
Is there any command or option available to do this

Thanks & Regards
Ganesh Tiwari
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [14 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 11:42 pm | All times are GMT
navigation Forum index » *nix » AIX
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Possible to do the equivalent of dlopen with an executabl... Kenny McCormack Solaris 14 Wed Jul 19, 2006 5:09 pm
No new posts embedding executable code in a regular expression in Python Avi Kak python 5 Sun Jul 16, 2006 9:05 pm
No new posts executable to fix data doesn't appear to be doing anythin... buccellik Server 5 Fri Jul 07, 2006 1:05 pm
No new posts non-executable stack question rbtqwt@gmail.com system 2 Sun Jun 25, 2006 2:03 pm
No new posts cxFreeze executable linked to /usr/lib/libpython2.3.so Raven python 0 Tue Jun 06, 2006 12:47 pm

NFL Talk Football Forums | Mortgage | Free Animated Greetings | Loans | Loans
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2431s ][ Queries: 20 (0.1134s) ][ GZIP on - Debug on ]