Skip to content

example from website seems broken #156

Open
@castilma

Description

@castilma

I'm on linux x86_64, trying to follow this example:

$ echo '        .code16
        .globl  _start
_start: dec     %ax
        jmp     _start
' | as -o prog.o
$ ld -static --oformat=binary prog.o -o prog.bin
$  xxd -a prog.bin 
00000000: 0400 0000 2000 0000 0500 0000 474e 5500  .... .......GNU.
00000010: 0200 01c0 0400 0000 0000 0000 0000 0000  ................
00000020: 0100 01c0 0400 0000 0100 0000 0000 0000  ................
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00001000: 48eb fd                                  H..
$ blinkenlights-2022-05-12.com -r prog.bin
^C  (nothing is printed, but one core is busy)
$ blinkenlights-2022-05-12.com -t -r prog.bin 

blinken-init
after taking one step, it seems the whole file is being executed as code, including the data in the beginning:
blinken-step

Is this wanted? I expected the assembler to create a file with just two instructions. I don't see any jmp instruction.

$ objdump -d prog.o

prog.o:     file format elf64-x86-64


Disassembly of section .text:

0000000000000000 <_start>:
   0:	48 eb fd             	rex.W jmp 0 <_start>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions