Skip to content

Commit

Permalink
Merge pull request Homebrew#178772 from Homebrew/x86_64-elf-gdb-linkage
Browse files Browse the repository at this point in the history
x86_64-elf-gcc, x86_64-elf-gdb: declare indirect deps with linkage
  • Loading branch information
chenrui333 authored Jul 29, 2024
2 parents 9c81f1f + 5479b19 commit 80c4b8e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 5 additions & 3 deletions Formula/x/x86_64-elf-gcc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class X8664ElfGcc < Formula
depends_on "libmpc"
depends_on "mpfr"
depends_on "x86_64-elf-binutils"
depends_on "zstd"

def install
target = "x86_64-elf"
Expand Down Expand Up @@ -56,8 +57,9 @@ def install
return i;
}
EOS
system "#{bin}/x86_64-elf-gcc", "-c", "-o", "test-c.o", "test-c.c"
assert_match "file format elf64-x86-64",
shell_output("#{Formula["x86_64-elf-binutils"].bin}/x86_64-elf-objdump -a test-c.o")

system bin/"x86_64-elf-gcc", "-c", "-o", "test-c.o", "test-c.c"
output = shell_output("#{Formula["x86_64-elf-binutils"].bin}/x86_64-elf-objdump -a test-c.o")
assert_match "file format elf64-x86-64", output
end
end
8 changes: 6 additions & 2 deletions Formula/x/x86_64-elf-gdb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ class X8664ElfGdb < Formula
end

depends_on "x86_64-elf-gcc" => :test

depends_on "gmp"
depends_on "mpfr"
depends_on "[email protected]"
depends_on "xz" # required for lzma support

uses_from_macos "expat"
uses_from_macos "ncurses"
uses_from_macos "zlib"

on_system :linux, macos: :ventura_or_newer do
Expand Down Expand Up @@ -60,7 +63,8 @@ def install
test do
(testpath/"test.c").write "void _start(void) {}"
system "#{Formula["x86_64-elf-gcc"].bin}/x86_64-elf-gcc", "-g", "-nostdlib", "test.c"
assert_match "Symbol \"_start\" is a function at address 0x",
shell_output("#{bin}/x86_64-elf-gdb -batch -ex 'info address _start' a.out")

output = shell_output("#{bin}/x86_64-elf-gdb -batch -ex 'info address _start' a.out")
assert_match "Symbol \"_start\" is a function at address 0x", output
end
end

0 comments on commit 80c4b8e

Please sign in to comment.