flat assembler
Message board for the users of flat assembler.

Index > Main > Agner Fog's OBJCONV

Author
Thread Post new topic Reply to topic
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 16 Jun 2009, 11:43
http://www.agner.org/optimize/#objconv

2.08 released, what's new (not sure in what version exactly, but it is in 2.08 and was not in cca 2.02 some months ago)

- Added support of NASM syntax into the disassembler

YES it works (tested on a 32-bit PE DLL), the output is NASM syntax, has labels instead of absolute addresses, has function names, has data separated from code, works in DOS Smile and ... haven't tried to recompile the output yet Neutral

Code:
Object file converter version 2.08 for x86 and x86-64 platforms.
Copyright (c) 2008 by Agner Fog. Gnu General Public License.

Usage: objconv options inputfile [outputfile]

Options:
-fXXX[SS]  Output file format XXX, word size SS. Supported formats:
           PE, COFF, ELF, OMF, MACHO

-fasm      Disassemble file (-fmasm, -fnasm, -fyasm, -fgasm)

-dXXX      Dump file contents to console.
           Values of XXX (can be combined):
           f: File header, h: section Headers, s: Symbol table,
           r: Relocation table, n: string table.

-xs        Strip exception handling info and other incompatible info.
-xp        Preserve exception handling info and other incompatible info.

-nu        change symbol Name Underscores to the default for the target format.
-nu-       remove Underscores from symbol Names.
-nu+       add Underscores to symbol Names.
-nd        replace Dot/underscore in nonstandard section names.
-nr:N1:N2  Replace symbol Name N1 with N2.
-ar:N1:N2  make Alias N2 for existing public name N1.
-np:N1:N2  Replace symbol Prefix N1 with N2.
-nw:N1     make public symbol Name N1 Weak (ELF and MAC64 only).
-nl:N1     make public symbol Name N1 Local (invisible).

-lx        eXtract all members from Library.
-lx:N1:N2  eXtract member N1 from Library to file N2.
-ld:N1     Delete member N1 from Library.
-la:N1:N2  Add object file N1 to Library as member N2.
           Alternative: -lib LIBRARYNAME OBJECTFILENAMES.

-vN        Verbose options. Values of N:
           0: Silent, 1: Print file names and types, 2: Tell about conversions.

-wdNNN     Disable Warning NNN.
-weNNN     treat Warning NNN as Error. -wex: treat all warnings as errors.
-edNNN     Disable Error number NNN.
-ewNNN     treat Error number NNN as Warning.

-h         Print this help screen.

@RFILE     Read additional options from response file RFILE.


Example:
objconv -felf32 -nu filename.obj filename.o
    


-fasm brews MASM syntax, as well as -fmasm and -ftasm

-fnasm and -fyasm brew NASM syntax

-fgasm reportedly GAS INTEL similar to TASM IDEAL syntax

-ffasm for FASM syntax is not supported

Possibly the most promising disassembler for other-than-DOS-COM stuff. Haven't tried the object conversion, but I doubt it will bypass FASM's lack of OMF output for 16-bit programming (and I don't really need it anyway Wink ).
Post 16 Jun 2009, 11:43
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 16 Jun 2009, 17:01
Why don't people like Fasm or is it just unpopular? It's much better than Nasm, at least how it was back then when I checked it. The syntax is both more clear and much more powerful...

Is the output compatible with Fasm at least? Does it even compile with Fasm?

_________________
Previously known as The_Grey_Beast
Post 16 Jun 2009, 17:01
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 17 Jun 2009, 05:24
IMHO, only assembly language programmers like FASM. The other assemblers are only used by HLL programmers who dabble in asm. So, they want something written in a HLL, and designed specifically for HLL programmers (i.e. mirrors HLL coding constructs).
Post 17 Jun 2009, 05:24
View user's profile Send private message Visit poster's website Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 17 Jun 2009, 08:32
> Why don't people like Fasm or is it just unpopular?
> It's much better than Nasm, at least how it was back then
> when I checked it. The syntax is both more clear and
> much more powerful...

Contact Agner Fog Wink

> Is the output compatible with Fasm at least?

The NASM syntax is much better now. Smile

> Does it even compile with Fasm?

Disassembled code might not compile well even if syntax matches well. Also the comments generated by OBJCONV are usually not as smart as those in original source.
Post 17 Jun 2009, 08:32
View user's profile Send private message Reply with quote
Japheth



Joined: 26 Oct 2004
Posts: 151
Japheth 17 Jun 2009, 11:33
bitRAKE wrote:
IMHO, only assembly language programmers like FASM. The other assemblers are only used by HLL programmers who dabble in asm.


Maybe true! But what are your "results" in assembly so far? Or - since I happen to know that you're used to switch your favorite assembler frequently - you probably think that for true assembly language programmers like you "the way is the goal"?
Post 17 Jun 2009, 11:33
View user's profile Send private message Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 17 Jun 2009, 13:01
Why so offensice Japheth? To the others, just contact Agner, maybe he just forgot...
Post 17 Jun 2009, 13:01
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Raedwulf



Joined: 13 Jul 2005
Posts: 375
Location: United Kingdom
Raedwulf 17 Jun 2009, 17:21
nasm is more portable in the sense its written in C, so its not as architecture dependent.
Post 17 Jun 2009, 17:21
View user's profile Send private message MSN Messenger Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 17 Jun 2009, 22:52
Japheth wrote:
Maybe true! But what are your "results" in assembly so far? Or - since I happen to know that you're used to switch your favorite assembler frequently - you probably think that for true assembly language programmers like you "the way is the goal"?
Changing isn't that big of a deal, most people don't port their older programs when they switch anyway.

Fasm is much more powerful in its macro capabilities and multi-pass assembling, that's all I'm saying.

_________________
Previously known as The_Grey_Beast
Post 17 Jun 2009, 22:52
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 18 Jun 2009, 02:39
Japheth wrote:
bitRAKE wrote:
IMHO, only assembly language programmers like FASM. The other assemblers are only used by HLL programmers who dabble in asm.
Maybe true!
Thanks for the support.
(You are one of the few exceptions to my humble opinion - only a fool attempts to generalize.)

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 18 Jun 2009, 02:39
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 18 Jun 2009, 02:54
Raedwulf wrote:
nasm is more portable in the sense its written in C, so its not as architecture dependent.
Someone needs to program in x86 assembler from another architechture, why?

Who?

Aliens want to program in x86 - how cool! Very Happy

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 18 Jun 2009, 02:54
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 18 Jun 2009, 03:01
bitRAKE wrote:
Someone needs to program in x86 assembler from another architechture, why?
I wonder if Raedwulf meant 'platform' instead of 'architecture'? But it is a curious question as to whether there is anyone that programs x86 from a different architecture. Maybe some Apple users (with Motorola CPUs) do/did some x86 cross programming?
Post 18 Jun 2009, 03:01
View user's profile Send private message Visit poster's website Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 18 Jun 2009, 20:56
Platform? FASM works in Windows, DOS and Linux. If you can't get one of these, use a virtual machine to compile Laughing
Post 18 Jun 2009, 20:56
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Jun 2009, 12:47
Quote:
Why don't people like Fasm or is it just unpopular? It's much better than Nasm, at least how it was back then when I checked it. The syntax is both more clear and much more powerful...

Problems of syntax:
- (major) No simple preprocess-time #ifdef, #elseif, #else, #endif.
- (mild) lack of string handling by preprocessor
- (minor) lack of inline macros
- (minor) unusual (even though very powerful) macro system
- (major/minor, depends on POV) lack of built-in HLL features like MASM
Problems of assembler:
- (cruical) command line params not available by default until very recently
- (mild) written in Asm, eg. not portable over architectures and must be self-compiled
- (major) no official support in linux package systems (has a bit to do with previous point as well)

Reason for many of previous points is that FASM is more a Tomasz's hobby project than a serious "industrial" assembler, and as such, given its limitation, you hardly can expect someone to use it in serious big project.

PS: Of course I acknowledge vast amount of features that FASM has better than all other ASMs, that is another reason why I think it is such a shame there is no FASM clone done "properly" (eg. as usual in industry).
Post 23 Jun 2009, 12:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 21 Sep 2011, 13:07
the opcode traduction part of disassembly cannot be so complicated, as the CPU does it naturally, it can be possible i think to do a simple function

disasm(bin_input,file_output)

and of course, a simple function

asm(file_input,bin_output)

after, if we develop around these functions, it can be possible to do a very smart disassembler.

if the disasm is like fasm, it will be powerfull, and able to generate a flat source code from a binary file, even if not executable or if not with the correct extension, because it will just take the executable or binary as a flat file, and output a source as a flat file.

the hard thing i think is to detect the code and data zones in the binary.
Post 21 Sep 2011, 13:07
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.