Skip to content

Commit

Permalink
Clarify the usage example for hexagon-unknown-none-elf
Browse files Browse the repository at this point in the history
The C wrapper program represents a typical use case (linking
C libraries with Rust libraries) but it was not made explicit how
this was supposed to work in the usage example.

Also: correct a table alignment error for hexagon-unknown-none-elf on the
general platform support doc.
  • Loading branch information
androm3da committed Feb 28, 2024
1 parent f8131a4 commit b4a0724
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/doc/rustc/src/platform-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ target | std | host | notes
`bpfel-unknown-none` | * | | BPF (little endian)
`csky-unknown-linux-gnuabiv2` | ✓ | | C-SKY abiv2 Linux (little endian)
`csky-unknown-linux-gnuabiv2hf` | ✓ | | C-SKY abiv2 Linux, hardfloat (little endian)
[`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | Bare Hexagon (v60+, HVX)
[`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | | Bare Hexagon (v60+, HVX)
`hexagon-unknown-linux-musl` | ? | |
`i386-apple-ios` | ✓ | | 32-bit x86 iOS [^x86_32-floats-return-ABI]
[`i586-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS [^x86_32-floats-return-ABI]
Expand Down
19 changes: 16 additions & 3 deletions src/doc/rustc/src/platform-support/hexagon-unknown-none-elf.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ target = ["<target for your host>", "hexagon-unknown-none-elf"]
cc = "hexagon-unknown-none-elf-clang"
cxx = "hexagon-unknown-none-elf-clang++"
linker = "hexagon-unknown-none-elf-clang"
ranlib = "hexagon-unknown-none-elf-ranlib"
ar = "hexagon-unknown-none-elf-ar"
llvm-libunwind = 'in-tree'
```

Expand Down Expand Up @@ -142,7 +144,7 @@ ${cc} --target=hexagon-unknown-none-elf -o testit \
${g0_lib_path}/init.o \
-L${sdk_libs}/${q6_arch}/ \
-L${sdk_libs}/ \
testit.c \
wrap.c \
target/hexagon-unknown-none-elf/${build_cfg}/libdemo1_hexagon.rlib \
target/hexagon-unknown-none-elf/${build_cfg}/deps/libcore-*.rlib \
target/hexagon-unknown-none-elf/${build_cfg}/deps/libcompiler_builtins-*.rlib \
Expand Down Expand Up @@ -217,7 +219,18 @@ fn rust_eh_personality() {}
```

Next, save the script below as `build.sh` and edit it to suit your
Next, create a C program as an entry point, save the content below as
`wrap.c`:

```C
int hello();

int main() {
hello();
}
```

Then, save the script below as `build.sh` and edit it to suit your
environment. The script below will build a shared object against the QuRT
RTOS which is suitable for emulation or on-device testing when loaded via
the fastrpc-shell.
Expand Down Expand Up @@ -248,7 +261,7 @@ ${cc} --target=hexagon-unknown-none-elf -o testit.so \
-Wl,--wrap=realloc \
-Wl,--wrap=memalign \
-m${q6_arch} \
testit.c \
wrap.c \
target/hexagon-unknown-none-elf/${build_cfg}/libdemo2_hexagon.rlib \
target/hexagon-unknown-none-elf/${build_cfg}/deps/libcore-*.rlib \
target/hexagon-unknown-none-elf/${build_cfg}/deps/libcompiler_builtins-*.rlib \
Expand Down

0 comments on commit b4a0724

Please sign in to comment.