Issue |
141494
|
Summary |
llvm-objcopy calculates section locations incorrectly for MachO files
|
Labels |
new issue
|
Assignees |
|
Reporter |
peledins-zimperium
|
https://github.com/llvm/llvm-project/pull/130517/files introduced a change
```
if (RequiresFirstSectionOutsideFirstPage) {
SectOffset = alignToPowerOf2(SectOffset, PageSize);
RequiresFirstSectionOutsideFirstPage = false;
}
```
This is an issue for several reasons:
1) If the first section is outside of first page (0x4000), but starts at (0x4004), then this gets aligned to (0x8000), which is not necessary. Here a fix could be
```
if (RequiresFirstSectionOutsideFirstPage && SectOffset < PageSize) {
```
2) However, if the block is actually entered, then trouble happens with next sections: they do not get moved together with this section. Then we can get to a state of `truncated or malformed object (section contents at offset 20160 with a size of 111316, overlaps section contents at offset 32768 with a size of 228)`
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs