Add missing BlobCore::clone() implementation #191
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-blobcore-clone-missing-implementation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The
Blob<BlobType>template class has aclone()method (line 184-185) that callsthis->BlobCore::clone(), but theBlobCore::clone()method is not declared inblob.hnor implemented inblob.cpp. This causes a linker error when the method is actually invoked.Discovery
This issue was discovered when building osxcross with RHEL 9.6 toolchain (GCC 14.2), which performs stricter linking checks than previous versions. The same code compiled successfully with RHEL 9.4 but fails with undefined symbol errors on RHEL 9.6:
Solution
This PR adds:
BlobCore::clone()inblob.h(afterstringAt()methods)blob.cppthat performs a deep copyThe implementation follows the same pattern as other BlobCore methods, using
mallocandmemcpyto create a proper deep copy of the blob:Testing
Files Changed
cctools/ld64/src/ld/code-sign-blobs/blob.h: Added method declarationcctools/ld64/src/ld/code-sign-blobs/blob.cpp: Added implementationThis has been a latent bug that newer compilers/linkers are now catching.