Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/launchpad/size/analyzers/apple.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,19 @@ def _extract_segments_info(self, binary: lief.MachO.Binary) -> List[SegmentInfo]

section_infos: List[SectionInfo] = []
for section in command.sections:
if section.segment.file_size == 0:
logger.warning(
"size.apple.skip_segment.zero_file_size",
extra={
"segment_name": segment_name,
"section_name": section.name,
},
)
continue

section_name = self._parse_lief_name(section.name)
section_infos.append(SectionInfo(name=section_name, size=section.size))
is_zerofill = section.type == lief.MachO.Section.TYPE.ZEROFILL
section_infos.append(SectionInfo(name=section_name, size=section.size, is_zerofill=is_zerofill))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just not append to section_infos at all if it's zero fill? That seems easier?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spoke offline, basically want to keep this data unfiltered and have downstream consumers handle filtering stuff out


segments.append(
SegmentInfo(
Expand Down
1 change: 1 addition & 0 deletions src/launchpad/size/models/apple.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class SectionInfo:

name: str
size: int
is_zerofill: bool # True if this section doesn't occupy file space (e.g., __bss)


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion src/launchpad/size/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# so we can update treemap logic and not give users confusing diffs.
# Patch versions are ignored.
ANDROID_ANALYSIS_VERSION = "1.0.0"
APPLE_ANALYSIS_VERSION = "1.1.0"
APPLE_ANALYSIS_VERSION = "1.2.0"


class BaseAppInfo(BaseModel):
Expand Down
8 changes: 2 additions & 6 deletions src/launchpad/size/symbols/swift_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,9 @@ def is_swift_symbol(mangled_name: str) -> bool:
Includes:
- _$s: Modern Swift mangling
- _Tt: Older Swift mangling
- __IVARS__Tt: ObjC runtime metadata for Swift classes
- __DATA__Tt: Data section symbols for Swift types
- __Tt: Swift classes exposed to ObjC with metadata
"""
if mangled_name.startswith("_$s") or mangled_name.startswith("_Tt"):
return True
# Swift classes exposed to ObjC have metadata with Swift mangling
if "__Tt" in mangled_name:
if mangled_name.startswith("_$s") or mangled_name.startswith("_Tt") or mangled_name.startswith("__Tt"):
return True
return False

Expand Down
Loading
Loading