diff options
author | Ben Gamari <ben@well-typed.com> | 2022-03-17 00:05:26 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2022-04-06 16:25:25 -0400 |
commit | eb60565b30225b2a215c0ae168b899a257706877 (patch) | |
tree | 5c6316c656eed88cfab013e9d0b93b8873cc3cb0 /rts | |
parent | 140f338f83f3dda5f3198c791918214012842f21 (diff) | |
download | haskell-eb60565b30225b2a215c0ae168b899a257706877.tar.gz |
rts/linker: Report archive member index
Diffstat (limited to 'rts')
-rw-r--r-- | rts/linker/LoadArchive.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index 86fa5cb94b..265afd319c 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -246,6 +246,7 @@ HsInt loadArchive_ (pathchar *path) char *image = NULL; HsInt retcode = 0; int memberSize; + int memberIdx = 0; FILE *f = NULL; int n; size_t thisFileNameSize = (size_t)-1; /* shut up bogus GCC warning */ @@ -517,11 +518,11 @@ HsInt loadArchive_ (pathchar *path) } } - int size = pathlen(path) + thisFileNameSize + 3; - archiveMemberName = stgMallocBytes(size * pathsize, - "loadArchive(file)"); - pathprintf(archiveMemberName, size, WSTR("%" PATH_FMT "(%.*s)"), - path, (int)thisFileNameSize, fileName); + int size = pathprintf(NULL, 0, WSTR("%" PATH_FMT "(#%d:%.*s)"), + path, memberIdx, (int)thisFileNameSize, fileName); + archiveMemberName = stgMallocBytes((size+1) * sizeof(pathchar), "loadArchive(file)"); + pathprintf(archiveMemberName, size, WSTR("%" PATH_FMT "(#%d:%.*s)"), + path, memberIdx, (int)thisFileNameSize, fileName); ObjectCode *oc = mkOc(STATIC_OBJECT, path, image, memberSize, false, archiveMemberName, misalignment); @@ -604,6 +605,7 @@ while reading filename from `%" PATH_FMT "'", path); } DEBUG_LOG("successfully read one pad byte\n"); } + memberIdx ++; DEBUG_LOG("reached end of archive loading while loop\n"); } retcode = 1; |