File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
src/doc/unstable-book/src/compiler-flags Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ See the [Clang ControlFlowIntegrity documentation][clang-cfi] for more details.
244244
245245# # Example 1: Redirecting control flow using an indirect branch/call to an invalid destination
246246
247- ` ` ` rust,ignore (making doc tests pass cross-platform is hard)
247+ ` ` ` rust
248248use std::arch::naked_asm;
249249use std::mem;
250250
@@ -253,6 +253,7 @@ fn add_one(x: i32) -> i32 {
253253}
254254
255255# [unsafe(naked)]
256+ # #[cfg(target_arch = "x86_64")]
256257pub extern " C" fn add_two(x: i32) {
257258 // x + 2 preceded by a landing pad/nop block
258259 naked_asm! (
@@ -276,6 +277,7 @@ fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32 {
276277 f(arg) + f(arg)
277278}
278279
280+ # #[cfg(target_arch = "x86_64")]
279281fn main () {
280282 let answer = do_twice(add_one, 5);
281283
@@ -292,6 +294,7 @@ fn main() {
292294
293295 println! (" The next answer is: {}" , next_answer);
294296}
297+ # #[cfg(not(target_arch = "x86_64"))] fn main() {}
295298` ` `
296299Fig. 1. Redirecting control flow using an indirect branch/call to an invalid
297300destination (i.e., within the body of the function).
You can’t perform that action at this time.
0 commit comments