about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Cain <bcain@quicinc.com>2024-02-21 12:46:23 -0800
committerBrian Cain <bcain@quicinc.com>2024-02-28 12:06:38 -0800
commitb4a07244a1dcc11fe48f233c12097960fcfebed7 (patch)
treed1c5017c50a6139f2d7dd24249f594ed6b87b4c5
parentf8131a48a46ac3bc8a3d0fe0477055b132cffdc3 (diff)
downloadrust-b4a07244a1dcc11fe48f233c12097960fcfebed7.tar.gz
rust-b4a07244a1dcc11fe48f233c12097960fcfebed7.zip
Clarify the usage example for hexagon-unknown-none-elf
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.
-rw-r--r--src/doc/rustc/src/platform-support.md2
-rw-r--r--src/doc/rustc/src/platform-support/hexagon-unknown-none-elf.md19
2 files changed, 17 insertions, 4 deletions
diff --git a/src/doc/rustc/src/platform-support.md b/src/doc/rustc/src/platform-support.md
index 80d9dc85f16..25c28711330 100644
--- a/src/doc/rustc/src/platform-support.md
+++ b/src/doc/rustc/src/platform-support.md
@@ -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]
diff --git a/src/doc/rustc/src/platform-support/hexagon-unknown-none-elf.md b/src/doc/rustc/src/platform-support/hexagon-unknown-none-elf.md
index 3ac1d2c2460..a0e26b798ac 100644
--- a/src/doc/rustc/src/platform-support/hexagon-unknown-none-elf.md
+++ b/src/doc/rustc/src/platform-support/hexagon-unknown-none-elf.md
@@ -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'
 ```
 
@@ -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 \
@@ -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.
@@ -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 \