This repository was archived by the owner on Jan 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +73
-18
lines changed Expand file tree Collapse file tree 5 files changed +73
-18
lines changed Original file line number Diff line number Diff line change 1
1
PHDRS
2
2
{
3
- text PT_LOAD ;
3
+ text PT_LOAD ;
4
4
rodata PT_LOAD ;
5
- data PT_LOAD ;
6
- dynamic PT_DYNAMIC ;
5
+ stack PT_GNU_STACK ;
6
+ heap PT_LOAD ;
7
+ dynsym PT_LOAD ;
8
+ other PT_NULL ;
7
9
}
8
10
9
11
SECTIONS
10
12
{
11
- . = SIZEOF_HEADERS ;
12
- .text : { *(.text *) } :text
13
- .rodata : { *(.rodata *) } :rodata
14
- .data.rel.ro : { *(.data.rel.ro *) } :rodata
15
- .dynamic : { *(.dynamic ) } :dynamic
16
- .dynsym : { *(.dynsym ) } :data
17
- .dynstr : { *(.dynstr ) } :data
18
- .rel.dyn : { *(.rel.dyn ) } :data
19
- .data : { *(.data* ) } :data
20
- .bss : { *(.bss* ) } :data
13
+ .text 0x000000000 : { *(.text*) } :text
14
+ .rodata 0x100000000 : { *(.rodata *) } :rodata
15
+ .bss.stack 0x200000000 : { *(.bss.stack *) } :stack
16
+ .bss.heap 0x300000000 : { *(.bss.heap *) } :heap
17
+ .dynsym 0xFFFFFFFF00000000 : { *(.dynsym ) } :dynsym
18
+ .dynstr : { *(.dynstr ) } :other
19
+ .dynamic : { *(.dynamic ) } :other
20
+ .symtab : { *(.symtab ) } :other
21
+ .shstrtab : { *(.shstrtab ) } :other
22
+ .strtab : { *(.strtab ) } :other
21
23
/DISCARD/ : {
24
+ *(.comment*)
22
25
*(.eh_frame*)
23
- *(.gnu.hash*)
24
- *(.hash*)
26
+ *(*hash*)
27
+ *(.bss*)
28
+ *(.data*)
29
+ *(.rel.dyn*)
25
30
}
26
31
}
Original file line number Diff line number Diff line change
1
+ PHDRS
2
+ {
3
+ text PT_LOAD ;
4
+ rodata PT_LOAD ;
5
+ data PT_LOAD ;
6
+ dynamic PT_DYNAMIC ;
7
+ }
8
+
9
+ SECTIONS
10
+ {
11
+ . = SIZEOF_HEADERS ;
12
+ .text : { *(.text*) } :text
13
+ .rodata : { *(.rodata*) } :rodata
14
+ .data.rel.ro : { *(.data.rel.ro*) } :rodata
15
+ .dynamic : { *(.dynamic) } :dynamic
16
+ .dynsym : { *(.dynsym) } :data
17
+ .dynstr : { *(.dynstr) } :data
18
+ .rel.dyn : { *(.rel.dyn) } :data
19
+ .data : { *(.data*) } :data
20
+ .bss : { *(.bss*) } :data
21
+ /DISCARD/ : {
22
+ *(.eh_frame*)
23
+ *(.gnu.hash*)
24
+ *(.hash*)
25
+ }
26
+ }
Original file line number Diff line number Diff line change @@ -7,9 +7,12 @@ TOOLCHAIN=../../../agave/sdk/sbf/dependencies/platform-tools
7
7
RC_COMMON=" $TOOLCHAIN /rust/bin/rustc --target sbf-solana-solana --crate-type lib -C panic=abort -C opt-level=2"
8
8
RC=" $RC_COMMON -C target_cpu=sbfv2"
9
9
RC_V1=" $RC_COMMON -C target_cpu=generic"
10
- LD_COMMON=" $TOOLCHAIN /llvm/bin/ld.lld -z notext -shared --Bdynamic -entry entrypoint --script elf.ld"
11
- LD=" $LD_COMMON --section-start=.text=0x100000000"
12
- LD_V1=$LD_COMMON
10
+ LD_COMMON=" $TOOLCHAIN /llvm/bin/ld.lld -z notext -shared --Bdynamic -entry entrypoint"
11
+ LD=" $LD_COMMON --script elf.ld"
12
+ LD_V1=" $LD_COMMON --script elf_sbpfv1.ld"
13
+
14
+ $RC -o strict_header.o strict_header.rs
15
+ $LD -o strict_header.so strict_header.o
13
16
14
17
$RC_V1 -o relative_call.o relative_call.rs
15
18
$LD_V1 -o relative_call_sbpfv1.so relative_call.o
Original file line number Diff line number Diff line change
1
+ #![ feature( linkage) ]
2
+
3
+ #[ link_section = ".bss.stack" ]
4
+ pub static _STACK: [ u8 ; 0x1000 ] = [ 0 ; 0x1000 ] ;
5
+ #[ link_section = ".bss.heap" ]
6
+ pub static _HEAP: [ u8 ; 0x1000 ] = [ 0 ; 0x1000 ] ;
7
+
8
+ static _VAL_A: u64 = 41 ;
9
+ static VAL_B : u64 = 42 ;
10
+ static _VAL_C: u64 = 43 ;
11
+
12
+ #[ inline( never) ]
13
+ #[ linkage="external" ]
14
+ fn foo ( ) -> u64 {
15
+ return unsafe { core:: ptr:: read_volatile ( & VAL_B ) } ;
16
+ }
17
+
18
+ #[ no_mangle]
19
+ pub fn entrypoint ( ) -> u64 {
20
+ return foo ( ) ;
21
+ }
You can’t perform that action at this time.
0 commit comments