[lld-macho] Fix bugs around EH_Frame symbols
authorJez Ng <jezng@fb.com>
Tue, 8 Nov 2022 21:33:32 +0000 (16:33 -0500)
committerJez Ng <jezng@fb.com>
Tue, 8 Nov 2022 21:33:32 +0000 (16:33 -0500)
commit1a2bc103bba04e8fba574c70c6201ba18ccc08ba
tree0943f2e1c927c6080b8cf288295fb66582b1c983
parent7f0779967f0690482c2cef70fc49e1381d32af1e
[lld-macho] Fix bugs around EH_Frame symbols

While extending the map file to cover unwind info, I realized we had two
issues with our EH_Frame symbols:

1. Their size was not set
2. We would create two EH_Frame symbols per frame when we only needed
   one. This was because the Defined constructor would add the symbol
   itself to InputSection::symbols, but we were also manually appending
   the symbol to that same vector.

Note that ld64 prints "CIE" and "FDE for: <function>" instead of just
"EH_Frame", but I'm punting on that for now unless we discover that
users really depend upon it.

Reviewed By: #lld-macho, Roger

Differential Revision: https://reviews.llvm.org/D137370
lld/MachO/InputFiles.cpp
lld/test/MachO/map-file.s