From: Daniel Xu Date: Sat, 4 Jul 2020 03:59:53 +0000 (-0700) Subject: rust: Fix rust modules test X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0ed35c9ae0434dcda2d5d3e3f0be77fa1f323283;p=binutils-gdb.git rust: Fix rust modules test I noticed that the modules test was failing. Some choice use of `nm` revealed `TWENTY_THREE` was not in the final binary. Fix by taking a pointer to the global, forcing the linker to keep the symbol in. gdb/testsuite/ChangeLog 2020-07-11 Daniel Xu PR rust/26121 * gdb.rust/modules.rs: Prevent linker from discarding test symbol. Signed-off-by: Daniel Xu --- diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c0f1f1cc14c..ec0f8322e32 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-07-11 Daniel Xu + + PR rust/26121 + * gdb.rust/modules.rs: Prevent linker from discarding test + symbol. + 2020-07-10 Pedro Alves PR gdb/26199 diff --git a/gdb/testsuite/gdb.rust/modules.rs b/gdb/testsuite/gdb.rust/modules.rs index 6db082817b5..479e6529cdc 100644 --- a/gdb/testsuite/gdb.rust/modules.rs +++ b/gdb/testsuite/gdb.rust/modules.rs @@ -60,7 +60,8 @@ pub mod mod1 { let f2 = || println!("lambda f2"); - let copy = ::TWENTY_THREE; + // Prevent linker from discarding symbol + let ptr: *const u16 = &::TWENTY_THREE; f2(); // set breakpoint here f3();