Skip to content

Commit

Permalink
binutils: gas: add support for the .skip directive
Browse files Browse the repository at this point in the history
Signed-off-by: Filip Kokosiński <filip.kokosinski@gmail.com>
  • Loading branch information
fkokosinski committed Jun 7, 2024
1 parent 8947f85 commit f732099
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion asm-hello-world/main.S
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.section .data
i:
.byte 0
.skip 1, 0
ptr:
.byte str
len:
Expand Down
8 changes: 8 additions & 0 deletions c-print-x/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
/* initialized global var */
int x = 027;

/* unitialized global var - gcc should emit `.skip` */
int y;

void _start(void)
{
asm ("law 04000");
Expand All @@ -9,6 +13,10 @@ void _start(void)
asm ("lio %0" : : "r"(x));
asm ("tyo");

y = 027;
asm ("lio %0" : : "r"(y));
asm ("tyo");

asm ("hlt");

__builtin_unreachable();
Expand Down
2 changes: 1 addition & 1 deletion pdp1-binutils
2 changes: 1 addition & 1 deletion tests/test.exp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ proc run_test { demo_name expected_output } {

run_test "asm-print-x" "x"
run_test "asm-hello-world" "hello, world"
run_test "c-print-x" "x"
run_test "c-print-x" "xx"
run_test "c-print-struct" "xyz"
run_test "c-print-array" "xyz"
run_test "c-print-for-loop" "xxxxyxxx"

0 comments on commit f732099

Please sign in to comment.