diff options
author | JF Bastien <jfb@chromium.org> | 2013-10-21 11:05:14 -0700 |
---|---|---|
committer | JF Bastien <jfb@chromium.org> | 2013-10-21 11:05:14 -0700 |
commit | 7c801d10ad719a7e0b875943b18504d7575524d9 (patch) | |
tree | a78aa74630f8d28bba65f678bc597b783404341a /test | |
parent | f058041de6c69aadafcd030c62678d4244ba2cf7 (diff) |
Remove unused globals.
libc++'s iostream values are extern, and never actually used in the headers (unlike libstdc++'s) which means that including iostream and doing something like (void)std::clog used to leave a global external ostream object declaration without a definition, which cause PNaCl's module ABI verifier to fail ('has no initializer' and 'is not a valid external symbol').
R=dschuff@chromium.org
BUG= http://code.google.com/p/nativeclient/issues/detail?id=3623
TEST= globalcleanup.ll
Review URL: https://codereview.chromium.org/33233002
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/NaCl/globalcleanup.ll | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/Transforms/NaCl/globalcleanup.ll b/test/Transforms/NaCl/globalcleanup.ll index 44e5b45e16..7e1fa3d8a5 100644 --- a/test/Transforms/NaCl/globalcleanup.ll +++ b/test/Transforms/NaCl/globalcleanup.ll @@ -16,6 +16,14 @@ ; CHECK: @weak_gv = internal global @weak_gv = weak global i32 0 +; Libc++'s declarations of iostream values are purely ``extern`` and +; unused otherwise which led to a bug when used as ``(void)std::clog``: +; the global would survive as ``external global`` post-link but without +; a proper definition. Global cleanup should take care of it. +; GV-NOT: ostream +%"class.fake_ostream" = type { i32 } +@ostream = external global %"class.fake_ostream" + ; CHECK: define void @_start define void @_start() { ret void @@ -35,6 +43,12 @@ define i32* @ewc() { ret i32* @extern_weak_gv } +; Make sure @weak_gv is actually used. +define i32* @wgv() { +; CHECK: ret i32* @weak_gv + ret i32* @weak_gv +} + ; GV-NOT: @extern_weak_func declare extern_weak i32 @extern_weak_func() ; CHECK: @ewf |