Skip to content
This repository was archived by the owner on Feb 12, 2026. It is now read-only.

Commit 1867ea3

Browse files
committed
fix: failed to find libc++ symbols in dex2oat bug
This commit fixes the issue where the system linker couldn't find some symbols by resetting the priority of the paths the linker should find, to force it to find the latest/correct libraries.
1 parent 71a9dc3 commit 1867ea3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

dex2oat/src/main/cpp/dex2oat.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,9 @@ int main(int argc, char **argv) {
194194
char *new_argv[argc + 2];
195195
memset(new_argv, 0, sizeof(new_argv));
196196

197-
new_argv[0] = stock_fd_path;
198-
memcpy(&new_argv[1], &argv[1], sizeof(char *) * argc);
197+
new_argv[0] = (char *)linker_path;
198+
new_argv[1] = stock_fd_path;
199+
memcpy(&new_argv[2], &argv[1], sizeof(char *) * argc);
199200

200201
execve(linker_path, new_argv, environ);
201202
LOGE("execve failed");
@@ -239,11 +240,12 @@ int main(int argc, char **argv) {
239240

240241
setenv("LD_PRELOAD", liboat_fd_path, 1);
241242

242-
char *new_argv[argc + 3];
243+
char *new_argv[argc + 2];
243244
memset(new_argv, 0, sizeof(new_argv));
244245

245-
new_argv[0] = stock_fd_path;
246-
memcpy(&new_argv[1], &argv[1], sizeof(char *) * argc);
246+
new_argv[0] = (char *)linker_path;
247+
new_argv[1] = stock_fd_path;
248+
memcpy(&new_argv[2], &argv[1], sizeof(char *) * argc);
247249

248250
execve(linker_path, new_argv, environ);
249251

0 commit comments

Comments
 (0)