diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 9fd45e0..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Rust - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose diff --git a/.gitignore b/.gitignore index ad67955..0267011 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,16 @@ -# Generated by Cargo -# will have compiled files and executables -debug -target +*.o +*.out +*.bin +*.elf +*.exe +a.out -# These are backup files generated by rustfmt -**/*.rs.bk +*~ +*.swp -# MSVC Windows builds of rustc generate these, which store debugging information -*.pdb +.vscode/ +.idea/ +.env/ +.DS_Store -# Generated by cargo mutants -# Contains mutation testing data -**/mutants.out*/ - -# RustRover -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ +*.log \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index f71a9b9..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,7 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "minishell" -version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml deleted file mode 100644 index 19eb27d..0000000 --- a/Cargo.toml +++ /dev/null @@ -1,6 +0,0 @@ -[package] -name = "minishell" -version = "0.1.0" -edition = "2024" - -[dependencies] diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..17691a2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# x86_64 build +FROM --platform=linux/amd64 debian:bookworm-slim + +RUN apt-get update -y \ + && apt-get install -y \ + binutils \ + make \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +CMD ["make"] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b07ac53 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +TARGET ?= main + +SRC := $(wildcard src/*.s src/*.asm) +OBJ := $(SRC:.s=.o) +OBJ := $(OBJ:.asm=.o) + +AS = as +LD = ld +NASM = nasm + +ASFLAGS = +NASMFLAGS = -f elf64 +LDFLAGS = + +all: $(TARGET) run + +%.o: %.s + $(AS) $(ASFLAGS) -o $@ $< + +%.o: %.asm + $(NASM) $(NASMFLAGS) -o $@ $< + +$(TARGET): $(OBJ) + $(LD) $(LDFLAGS) -o $@ $^ + +clean: + rm -f $(OBJ) $(TARGET) + +re: clean all + +run: $(TARGET) + ./$(TARGET) diff --git a/main b/main new file mode 100755 index 0000000..e2b17c0 Binary files /dev/null and b/main differ diff --git a/src/main.rs b/src/main.rs deleted file mode 100644 index 2fe40a1..0000000 --- a/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("hello world!"); -} diff --git a/src/main.s b/src/main.s new file mode 100644 index 0000000..3361513 --- /dev/null +++ b/src/main.s @@ -0,0 +1,18 @@ +.global _start + +.section .data +msg: + .ascii "Hello World!\n" +len = . - msg + +.section .text +_start: + mov $1, %rax + mov $1, %rdi + lea msg(%rip), %rsi + mov $len, %rdx + syscall + + mov $60, %rax + xor %rdi, %rdi + syscall