Skip to content

Commit 44000d5

Browse files
committed
Addressed comments:
- fix comments - add a LIT test case - will put driver-by fix to remove dlclose() in a separate PR
1 parent b85f82b commit 44000d5

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

libunwind/src/UnwindCursor.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,12 +2129,12 @@ bool UnwindCursor<A, R>::getInfoFromTBTable(pint_t pc, R &registers) {
21292129
// libunwind on libc++abi in cases such as non-C++ applications.
21302130

21312131
// Resolve the function pointer to the state table personality if it has
2132-
// not already done.
2132+
// not already been done.
21332133
if (xlcPersonalityV0 == NULL) {
21342134
xlcPersonalityV0InitLock.lock();
21352135
if (xlcPersonalityV0 == NULL) {
21362136
// Resolve __xlcxx_personality_v0 using dlopen().
2137-
const char libcxxabi[] = "libc++abi.a(libc++abi.so.1)";
2137+
const char *libcxxabi = "libc++abi.a(libc++abi.so.1)";
21382138
void *libHandle;
21392139
// The AIX dlopen() sets errno to 0 when it is successful, which
21402140
// clobbers the value of errno from the user code. This is an AIX
@@ -2152,6 +2152,7 @@ bool UnwindCursor<A, R>::getInfoFromTBTable(pint_t pc, R &registers) {
21522152
_LIBUNWIND_TRACE_UNWINDING("dlsym() failed with errno=%d\n", errno);
21532153
assert(0 && "dlsym() failed");
21542154
}
2155+
dlclose(libHandle);
21552156
errno = saveErrno;
21562157
}
21572158
xlcPersonalityV0InitLock.unlock();
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//===----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
// Test that libunwind loads successfully independently of libc++abi with
10+
// runtime linking on AIX.
11+
12+
// REQUIRES: target={{.+}}-aix{{.*}}
13+
// ADDITIONAL_COMPILE_FLAGS: -Wl,-brtl
14+
15+
#include <unwind.h>
16+
extern "C" int printf(const char *, ...);
17+
int main(void) {
18+
void *fp = (void *)&_Unwind_Backtrace;
19+
printf("%p\n", fp);
20+
}

0 commit comments

Comments
 (0)