[PATCH] rust: Fix rust modules test
Daniel Xu
dxu@dxuuu.xyz
Sat Jul 4 03:27:41 GMT 2020
I noticed that the modules test was failing. Some choice use of `nm`
revealed `TWENTY_THREE` was not in the final binary. Rather than trying
to trick the compiler/linker by using magic flags, simply `println!()`
the global.
gdb/testsuite/
* gdb.rust/modules.rs: Prevent linker from discarding test
symbol
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
gdb/testsuite/gdb.rust/modules.rs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gdb/testsuite/gdb.rust/modules.rs b/gdb/testsuite/gdb.rust/modules.rs
index 6db082817b..dc2a469b2f 100644
--- a/gdb/testsuite/gdb.rust/modules.rs
+++ b/gdb/testsuite/gdb.rust/modules.rs
@@ -93,4 +93,7 @@ pub mod mod1 {
fn main () {
mod1::inner::innest::f1();
+
+ // Prevent linker from discarding `TWENTY_THREE`
+ println!("{}", TWENTY_THREE);
}
--
2.27.0
More information about the Gdb-patches
mailing list