Skip to content

Commit

Permalink
Update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Jan 30, 2025
1 parent bce8eed commit 03c9ce4
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 37 deletions.
38 changes: 28 additions & 10 deletions tests/elfs/elf.ld
Original file line number Diff line number Diff line change
@@ -1,22 +1,40 @@
SECTIONS
{
.text 0x000000000 : { *(.text*) } :text
.rodata 0x100000000 : { *(.rodata*) } :rodata
.bss.stack 0x200000000 : { *(.bss.stack*) } :stack
.bss.heap 0x300000000 : { *(.bss.heap*) } :heap
.dynsym 0xFFFFFFFF00000000 : { *(.dynsym) } :dynsym
.dynstr : { *(.dynstr) } :other
.dynamic : { *(.dynamic) } :other
.symtab : { *(.symtab) } :other
.shstrtab : { *(.shstrtab) } :other
.strtab : { *(.strtab) } :other
.text 0x000000000 : {
*(.text*)
} :text
.rodata 0x100000000 : {
*(.rodata*)
*(.data.rel.ro*)
BYTE(0);
. = ALIGN(8);
} :rodata
.bss.stack 0x200000000 (NOLOAD) : {
_stack_start = .;
. = . + 0x1000;
_stack_end = .;
. = ALIGN(8);
} :stack
.bss.heap 0x300000000 (NOLOAD) : {
_heap_start = .;
. = . + 0x1000;
_heap_end = .;
. = ALIGN(8);
} :heap
.dynsym 0xFFFFFFFF00000000 : {
*(.dynsym)
. = ALIGN(8);
} :dynsym
.strtab : { *(.strtab) } :other
.dynstr : { *(.dynstr) } :other
/DISCARD/ : {
*(.comment*)
*(.eh_frame*)
*(*hash*)
*(.bss*)
*(.data*)
*(.rel.dyn*)
*(.dynamic)
}
}

Expand Down
File renamed without changes.
82 changes: 55 additions & 27 deletions tests/elfs/elfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,74 @@
# Requires Latest release of Solana's custom LLVM
# https://github.com/anza-xyz/platform-tools/releases

TOOLCHAIN=../../../agave/sdk/sbf/dependencies/platform-tools
RC_COMMON="$TOOLCHAIN/rust/bin/rustc --target sbf-solana-solana --crate-type lib -C panic=abort -C opt-level=2"
RC="$RC_COMMON -C target_cpu=sbfv2"
RC_V1="$RC_COMMON -C target_cpu=generic"
TOOLCHAIN="$HOME"/.cache/solana/v1.44/platform-tools/

CC_V0="$TOOLCHAIN/llvm/bin/clang -Werror -target sbf -O2 -fno-builtin -fPIC"
CC_V3="$CC_V0 -mcpu=v3"

RC_V0="$TOOLCHAIN/rust/bin/rustc --target sbf-solana-solana --crate-type lib -C panic=abort -C opt-level=2"
RC_V3="$RC_V0 -C target_cpu=v3 -C target_feature=+static-syscalls"

LD_COMMON="$TOOLCHAIN/llvm/bin/ld.lld -z notext -shared --Bdynamic -entry entrypoint"
LD="$LD_COMMON --script elf.ld"
LD_V1="$LD_COMMON --script elf_sbpfv0.ld"
LD_V3="$LD_COMMON -Bsymbolic --script elf.ld"
LD_V0="$LD_COMMON --script elf_sbpfv0.ld"

$RC -o strict_header.o strict_header.rs
$LD -o strict_header.so strict_header.o
$RC_V3 -o strict_header.o strict_header.rs
$LD_V3 -o strict_header.so strict_header.o

$RC_V1 -o relative_call.o relative_call.rs
$LD_V1 -o relative_call_sbpfv0.so relative_call.o
$RC_V0 -o relative_call.o relative_call.rs
$LD_V0 -o relative_call_sbpfv0.so relative_call.o

$RC_V1 -o syscall_reloc_64_32.o syscall_reloc_64_32.rs
$LD_V1 -o syscall_reloc_64_32_sbpfv0.so syscall_reloc_64_32.o
$RC_V3 -o relative_call.o relative_call.rs
$LD_V3 -o relative_call.so relative_call.o

$RC_V1 -o bss_section.o bss_section.rs
$LD_V1 -o bss_section_sbpfv0.so bss_section.o
$RC_V0 -o syscall_reloc_64_32.o syscall_reloc_64_32.rs
$LD_V0 -o syscall_reloc_64_32_sbpfv0.so syscall_reloc_64_32.o

$RC_V1 -o data_section.o data_section.rs
$LD_V1 -o data_section_sbpfv0.so data_section.o
$RC_V0 -o bss_section.o bss_section.rs
$LD_V0 -o bss_section_sbpfv0.so bss_section.o

$RC_V1 -o rodata_section.o rodata_section.rs
$LD_V1 -o rodata_section_sbpfv0.so rodata_section.o
$RC_V0 -o data_section.o data_section.rs
$LD_V0 -o data_section_sbpfv0.so data_section.o

$RC -o program_headers_overflow.o rodata_section.rs
$RC_V0 -o rodata_section.o rodata_section.rs
$LD_V0 -o rodata_section_sbpfv0.so rodata_section.o

$RC_V3 -o rodata_section.o rodata_section.rs
$LD_V3 -o rodata_section.so rodata_section.o

$RC_V0 -o program_headers_overflow.o rodata_section.rs
"$TOOLCHAIN"/llvm/bin/ld.lld -z notext -shared --Bdynamic -entry entrypoint --script program_headers_overflow.ld --noinhibit-exec -o program_headers_overflow.so program_headers_overflow.o

$RC_V1 -o struct_func_pointer.o struct_func_pointer.rs
$LD_V1 -o struct_func_pointer_sbpfv0.so struct_func_pointer.o
$RC_V0 -o struct_func_pointer.o struct_func_pointer.rs
$LD_V0 -o struct_func_pointer_sbpfv0.so struct_func_pointer.o

$RC_V3 -o struct_func_pointer.o struct_func_pointer.rs
$LD_V3 -o struct_func_pointer.so struct_func_pointer.o

$RC_V0 -o reloc_64_64.o reloc_64_64.rs
$LD_V0 -o reloc_64_64_sbpfv0.so reloc_64_64.o

$RC_V3 -o reloc_64_64.o reloc_64_64.rs
$LD_V3 -o reloc_64_64.so reloc_64_64.o

$RC_V3 -o reloc_64_64.o reloc_64_64.rs
$LD_V3 -o reloc_64_64.so reloc_64_64.o

$RC_V0 -o reloc_64_relative.o reloc_64_relative.rs
$LD_V0 -o reloc_64_relative_sbpfv0.so reloc_64_relative.o

$RC_V3 -o reloc_64_relative.o reloc_64_relative.rs
$LD_V3 -o reloc_64_relative.so reloc_64_relative.o

$RC_V1 -o reloc_64_64.o reloc_64_64.rs
$LD_V1 -o reloc_64_64_sbpfv0.so reloc_64_64.o
$CC_V0 -o reloc_64_relative_data.o -c reloc_64_relative_data.c
$LD_V0 -o reloc_64_relative_data_sbpfv0.so reloc_64_relative_data.o

$RC_V1 -o reloc_64_relative.o reloc_64_relative.rs
$LD_V1 -o reloc_64_relative_sbpfv0.so reloc_64_relative.o
$CC_V3 -o reloc_64_relative_data.o -c reloc_64_relative_data.c
$LD_V3 -o reloc_64_relative_data.so reloc_64_relative_data.o

$RC_V1 -o reloc_64_relative_data.o reloc_64_relative_data.rs
$LD_V1 -o reloc_64_relative_data_sbpfv0.so reloc_64_relative_data.o
$RC_V3 -o syscall_static.o syscall_static.rs
$LD_V3 -o syscall_static.so syscall_static.o

# $RC_V1 -o callx_unaligned.o callx_unaligned.rs
# $LD_V1 -o callx_unaligned.so callx_unaligned.o
Expand Down

0 comments on commit 03c9ce4

Please sign in to comment.