[all-commits] [llvm/llvm-project] 27588f: [MC] Move MCFragment::Atom to MCSectionMachO::Atoms
Fangrui Song via All-commits
all-commits at lists.llvm.org
Thu Jun 13 14:37:37 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 27588fe2057a3e6b69c1d6e4885a7a539b3123ff
https://github.com/llvm/llvm-project/commit/27588fe2057a3e6b69c1d6e4885a7a539b3123ff
Author: Fangrui Song <i at maskray.me>
Date: 2024-06-13 (Thu, 13 Jun 2024)
Changed paths:
M llvm/include/llvm/MC/MCFragment.h
M llvm/include/llvm/MC/MCSectionMachO.h
M llvm/lib/MC/MCFragment.cpp
M llvm/lib/MC/MCMachOStreamer.cpp
M llvm/lib/MC/MCSectionMachO.cpp
Log Message:
-----------
[MC] Move MCFragment::Atom to MCSectionMachO::Atoms
Mach-O's `.subsections_via_symbols` mechanism associates a fragment with
an atom (a non-temporary defined symbol). The current approach
(`MCFragment::Atom`) wastes space for other object file formats.
After #95077, `MCFragment::LayoutOrder` is only used by
`AttemptToFoldSymbolOffsetDifference`. While it could be removed, we
might explore future uses for `LayoutOrder`.
@aengelke suggests one use case: move `Atom` into MCSection. This works
because Mach-O doesn't support `.subsection`, and `LayoutOrder`, as the
index into the fragment list, is unchanged.
This patch moves MCFragment::Atom to MCSectionMachO::Atoms. `getAtom`
may be called at parse time before `Atoms` is initialized, so a bound
checking is needed to keep the hack working.
Pull Request: https://github.com/llvm/llvm-project/pull/95341
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list