[Info-vax] VAX Macro to C conversion

John Reagan xyzzy1959 at gmail.com
Sat Jul 13 00:30:10 EDT 2019


On Tuesday, June 25, 2019 at 7:33:48 PM UTC-4, Stephen Hoffman wrote:

> 
> Is there an ANALYZE/IMAGE/DISASSEMBLE planned, too?  objdump can 
> provide that with ELF executable files on some platforms.  Otherwise 
> we're porting libbfd or efitools or bintools.
> 

Already done.

PASCAL$ type hw.pas
program hw(output);
begin
   writeln('hello world');
end.
PASCAL$ pascal hw.pas
PASCAL$ anal/obj/disa hw.obj
Analyze/Disassemble Object File                 25-JUN-2019 20:47:59.63                                                 Page
 1
WORK20:[JREAGAN]HW.OBJ;4
ANALYZ I01-73

HW                                              Machine Code Listing            25-Jun-2019 20:47     VSI Pascal x86-64 X6.3
-001
01                                                                                                    HW

                                                .section           $CODE$, "ax", "progbits"   # EXE,SHR
                                                .align             16
Section size 87 bytes

                                                ELF$TFRADR::
                                                HW:
                                 55  00000000:  pushq   %rbp
# 000001
                           E5 89 48  00000001:  movq    %rsp,%rbp
                        10 EC 83 48  00000004:  subq    $10,%rsp
      00 00 00 00 00 00 00 01 B8 48  00000008:  movq    $0000000000000001,%rax
               00 00 00 00 0D 8B 48  00000012:  movq    PAS$FV_OUTPUT at GOTPCREL(%rip),%rcx
      00 00 00 00 00 00 00 0B BE 48  00000019:  movq    $000000000000000B,%rsi
               00 00 00 00 15 8B 48  00000023:  movq    .L.sym1 at GOTPCREL(%rip),%rdx
                           CF 89 48  0000002A:  movq    %rcx,%rdi
# 000003
                        F8 45 89 48  0000002D:  movq    %rax,-08(%rbp)
                     00 00 00 00 B8  00000031:  movl    $00000000,%eax
                        F0 4D 89 48  00000036:  movq    %rcx,-10(%rbp)
                     00 00 00 00 E8  0000003A:  callq   PAS$WRITE_STRING at PLT
                        F0 7D 8B 48  0000003F:  movq    -10(%rbp),%rdi
                     00 00 00 00 B8  00000043:  movl    $00000000,%eax
                     00 00 00 00 E8  00000048:  callq   PAS$WRITELN2 at PLT
                        F8 45 8B 48  0000004D:  movq    -08(%rbp),%rax
# 000004
                        10 C4 83 48  00000051:  addq    $10,%rsp
                                 5D  00000055:  popq    %rbp
                                 C3  00000056:  retq

and

PASCAL$ objdump --version
LLVM (http://llvm.org/):
  LLVM version 3.4.2
  DEBUG build with assertions.
  Built May  9 2018 (14:34:01).
  Default target: x86_64-pc-linux-gnu
  Host CPU: (unknown)

  Registered Targets:
    x86    - 32-bit X86: Pentium-Pro and above
    x86-64 - 64-bit X86: EM64T and AMD64

PASCAL$ objdump -d hw.obj

hw.obj: file format ELF64-x86-64

Disassembly of section .text:
.text:
Disassembly of section $CODE$:
HW:
       0:       55                                              pushq   %rbp
       1:       48 89 e5                                        movq    %rsp, %rbp
       4:       48 83 ec 10                                     subq    $16, %rsp
       8:       48 b8 01 00 00 00 00 00 00 00                   movabsq $1, %rax
      12:       48 8b 0d 00 00 00 00                            movq    (%rip), %rcx
      19:       48 be 0b 00 00 00 00 00 00 00                   movabsq $11, %rsi
      23:       48 8b 15 00 00 00 00                            movq    (%rip), %rdx
      2a:       48 89 cf                                        movq    %rcx, %rdi
      2d:       48 89 45 f8                                     movq    %rax, -8(%rbp)
      31:       b8 00 00 00 00                                  movl    $0, %eax
      36:       48 89 4d f0                                     movq    %rcx, -16(%rbp)
      3a:       e8 00 00 00 00                                  callq   0
      3f:       48 8b 7d f0                                     movq    -16(%rbp), %rdi
      43:       b8 00 00 00 00                                  movl    $0, %eax
      48:       e8 00 00 00 00                                  callq   0
      4d:       48 8b 45 f8                                     movq    -8(%rbp), %rax
      51:       48 83 c4 10                                     addq    $16, %rsp
      55:       5d                                              popq    %rbp
      56:       c3                                              ret




More information about the Info-vax mailing list