Skip to content

Commit 62e144c

Browse files
committed
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.
1 parent f8131a4 commit 62e144c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/doc/rustc/src/platform-support.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ target | std | host | notes
286286
`bpfel-unknown-none` | * | | BPF (little endian)
287287
`csky-unknown-linux-gnuabiv2` | ✓ | | C-SKY abiv2 Linux (little endian)
288288
`csky-unknown-linux-gnuabiv2hf` | ✓ | | C-SKY abiv2 Linux, hardfloat (little endian)
289-
[`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | Bare Hexagon (v60+, HVX)
289+
[`hexagon-unknown-none-elf`](platform-support/hexagon-unknown-none-elf.md)| * | | Bare Hexagon (v60+, HVX)
290290
`hexagon-unknown-linux-musl` | ? | |
291291
`i386-apple-ios` | ✓ | | 32-bit x86 iOS [^x86_32-floats-return-ABI]
292292
[`i586-pc-nto-qnx700`](platform-support/nto-qnx.md) | * | | 32-bit x86 QNX Neutrino 7.0 RTOS [^x86_32-floats-return-ABI]

src/doc/rustc/src/platform-support/hexagon-unknown-none-elf.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ target = ["<target for your host>", "hexagon-unknown-none-elf"]
4141
cc = "hexagon-unknown-none-elf-clang"
4242
cxx = "hexagon-unknown-none-elf-clang++"
4343
linker = "hexagon-unknown-none-elf-clang"
44+
ranlib = "hexagon-unknown-linux-musl-ranlib"
45+
ar = "hexagon-unknown-linux-musl-ar"
4446
llvm-libunwind = 'in-tree'
4547
```
4648

@@ -142,7 +144,7 @@ ${cc} --target=hexagon-unknown-none-elf -o testit \
142144
${g0_lib_path}/init.o \
143145
-L${sdk_libs}/${q6_arch}/ \
144146
-L${sdk_libs}/ \
145-
testit.c \
147+
wrap.c \
146148
target/hexagon-unknown-none-elf/${build_cfg}/libdemo1_hexagon.rlib \
147149
target/hexagon-unknown-none-elf/${build_cfg}/deps/libcore-*.rlib \
148150
target/hexagon-unknown-none-elf/${build_cfg}/deps/libcompiler_builtins-*.rlib \
@@ -217,7 +219,18 @@ fn rust_eh_personality() {}
217219
218220
```
219221

220-
Next, save the script below as `build.sh` and edit it to suit your
222+
Next, create a C program as an entry point, save the content below as
223+
`wrap.c`:
224+
225+
```C
226+
int hello();
227+
228+
int main() {
229+
hello();
230+
}
231+
```
232+
233+
Then, save the script below as `build.sh` and edit it to suit your
221234
environment. The script below will build a shared object against the QuRT
222235
RTOS which is suitable for emulation or on-device testing when loaded via
223236
the fastrpc-shell.
@@ -248,7 +261,7 @@ ${cc} --target=hexagon-unknown-none-elf -o testit.so \
248261
-Wl,--wrap=realloc \
249262
-Wl,--wrap=memalign \
250263
-m${q6_arch} \
251-
testit.c \
264+
wrap.c \
252265
target/hexagon-unknown-none-elf/${build_cfg}/libdemo2_hexagon.rlib \
253266
target/hexagon-unknown-none-elf/${build_cfg}/deps/libcore-*.rlib \
254267
target/hexagon-unknown-none-elf/${build_cfg}/deps/libcompiler_builtins-*.rlib \

0 commit comments

Comments
 (0)