2
0
mirror of https://sourceware.org/git/binutils-gdb.git synced 2025-02-23 13:21:43 +08:00

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  <dxu@dxuuu.xyz>

	PR rust/26121
	* gdb.rust/modules.rs: Prevent linker from discarding test
	symbol.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
This commit is contained in:
Daniel Xu 2020-07-03 20:59:53 -07:00 committed by Tom Tromey
parent 0a278aa755
commit 0ed35c9ae0
2 changed files with 8 additions and 1 deletions
gdb/testsuite

View File

@ -1,3 +1,9 @@
2020-07-11 Daniel Xu <dxu@dxuuu.xyz>
PR rust/26121
* gdb.rust/modules.rs: Prevent linker from discarding test
symbol.
2020-07-10 Pedro Alves <pedro@palves.net>
PR gdb/26199

View File

@ -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();