Skip to content

Commit

Permalink
Merge pull request #201237 from Homebrew/asm-heredoc
Browse files Browse the repository at this point in the history
formulae: use ASM heredoc delimiter for .s
  • Loading branch information
BrewTestBot authored Dec 15, 2024
2 parents dc94281 + 3453222 commit 81edb8e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Formula/a/aarch64-elf-binutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def install
end

test do
(testpath/"test-s.s").write <<~EOS
(testpath/"test-s.s").write <<~ASM
.section .text
.globl _start
_start:
mov x0, #0
mov x16, #1
svc #0x80
EOS
ASM
system bin/"aarch64-elf-as", "-o", "test-s.o", "test-s.s"
assert_match "file format elf64-littleaarch64",
shell_output("#{bin}/aarch64-elf-objdump -a test-s.o")
Expand Down
4 changes: 2 additions & 2 deletions Formula/a/arm-none-eabi-binutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def install
end

test do
(testpath/"test-s.s").write <<~EOS
(testpath/"test-s.s").write <<~ASM
.section .text
.globl _start
_start:
mov r1, #0
mov r2, #1
svc #0x80
EOS
ASM

system bin/"arm-none-eabi-as", "-o", "test-s.o", "test-s.s"
assert_match "file format elf32-littlearm",
Expand Down
4 changes: 2 additions & 2 deletions Formula/i/i686-elf-binutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ def install
end

test do
(testpath/"test-s.s").write <<~EOS
(testpath/"test-s.s").write <<~ASM
.section .data
.section .text
.globl _start
_start:
movl $1, %eax
movl $4, %ebx
int $0x80
EOS
ASM

system bin/"i686-elf-as", "--32", "-o", "test-s.o", "test-s.s"
assert_match "file format elf32-i386",
Expand Down
4 changes: 2 additions & 2 deletions Formula/n/nasm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ def install
end

test do
(testpath/"foo.s").write <<~EOS
(testpath/"foo.s").write <<~ASM
mov eax, 0
mov ebx, 0
int 0x80
EOS
ASM

system bin/"nasm", "foo.s"
code = File.open("foo", "rb") { |f| f.read.unpack("C*") }
Expand Down
4 changes: 2 additions & 2 deletions Formula/r/riscv64-elf-binutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def install
end

test do
(testpath/"test-s.s").write <<~EOS
(testpath/"test-s.s").write <<~ASM
.section .text
.globl _start
_start:
li a7, 93
li a0, 0
ecall
EOS
ASM

system bin/"riscv64-elf-as", "-o", "test-s.o", "test-s.s"
assert_match "file format elf64-littleriscv",
Expand Down
4 changes: 2 additions & 2 deletions Formula/w/wla-dx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def install
end

test do
(testpath/"test-gb-asm.s").write <<~EOS
(testpath/"test-gb-asm.s").write <<~ASM
.MEMORYMAP
DEFAULTSLOT 1.01
SLOT 0.001 $0000 $2000
Expand Down Expand Up @@ -58,7 +58,7 @@ def install
jr -128
jr 127
jr nc, 127
EOS
ASM
system bin/"wla-gb", "-o", testpath/"test-gb-asm.s"
end
end
4 changes: 2 additions & 2 deletions Formula/x/x86_64-elf-binutils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ def install
end

test do
(testpath/"test-s.s").write <<~EOS
(testpath/"test-s.s").write <<~ASM
.section .data
.section .text
.globl _start
_start:
movl $1, %eax
movl $4, %ebx
int $0x80
EOS
ASM

system bin/"x86_64-elf-as", "--64", "-o", "test-s.o", "test-s.s"
assert_match "file format elf64-x86-64",
Expand Down
4 changes: 2 additions & 2 deletions Formula/y/yasm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def install
end

test do
(testpath/"foo.s").write <<~EOS
(testpath/"foo.s").write <<~ASM
mov eax, 0
mov ebx, 0
int 0x80
EOS
ASM
system bin/"yasm", "foo.s"
code = File.open("foo", "rb") { |f| f.read.unpack("C*") }
expected = [0x66, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x66, 0xbb,
Expand Down

0 comments on commit 81edb8e

Please sign in to comment.