llvm-project/lld/MachO
Kaining Zhong aab0f2264a [lld-macho] Fix dangling string reference when adding frameworks
In Driver.cpp, addFramework used std::string instance to represent the path of a framework, which will be freed after the function returns. However, this string is stored in loadedArchive, which will be used later to compare with path of newly added frameworks. This caused https://bugs.llvm.org/show_bug.cgi?id=52133. A test is included in this commit to reproduce this bug.

Now resolveDylibPath returns a StringRef instance, and it uses StringSaver to save its data, then returns it to functions on the top. This ensures the resolved framework path is still valid after LC_LINKER_OPTION is parsed.

Reviewed By: int3, #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D111706
2021-10-20 11:21:40 -04:00
..
Arch [lld/mac] Set branchRange a bit more carefully 2021-08-30 12:36:06 -04:00
CMakeLists.txt [CMake][gn] lldMachO=>lldMachOOld, lldMachO2=>lldMachO 2021-08-04 18:52:41 -07:00
ConcatOutputSection.cpp [lld/mac] Fix comment typo to cycle bots 2021-09-18 11:15:21 -04:00
ConcatOutputSection.h [lld-macho] Have ICF operate on all sections at once 2021-07-17 13:42:51 -04:00
Config.h [lld/mac] Handle symbols from -U in treatUndefinedSymbol() 2021-07-22 19:43:57 -04:00
Driver.cpp [lld-macho] Fix dangling string reference when adding frameworks 2021-10-20 11:21:40 -04:00
Driver.h [lld-macho] Fix dangling string reference when adding frameworks 2021-10-20 11:21:40 -04:00
DriverUtils.cpp [lld-macho] Fix dangling string reference when adding frameworks 2021-10-20 11:21:40 -04:00
Dwarf.cpp [lld-macho] Factor out common InputSection members 2021-07-01 21:22:39 -04:00
Dwarf.h [lld-macho] Emit STABS symbols for debugging, and drop debug sections 2020-12-01 15:05:20 -08:00
ExportTrie.cpp [lld-macho][NFC] add const to pointer/reference induction variables of range-based for loops 2021-03-10 12:07:31 -08:00
ExportTrie.h [lld-macho] Export trie addresses should be relative to the image base 2020-09-20 20:43:15 -07:00
ICF.cpp [lld-macho] ICF: Do more work in equalsConstant, less in equalsVariable 2021-07-23 11:49:00 -04:00
ICF.h [lld-macho] Move ICF earlier to avoid emitting redundant binds 2021-07-01 21:22:38 -04:00
InputFiles.cpp [lld-macho] Fix dangling string reference when adding frameworks 2021-10-20 11:21:40 -04:00
InputFiles.h [lld-macho] Refactor archive loading 2021-08-26 18:52:07 -04:00
InputSection.cpp [lld/mac] Remove "else" after return 2021-07-22 21:31:52 -04:00
InputSection.h [lld-macho][nfc] Clean up InputSection constructors 2021-08-26 19:07:48 -04:00
LTO.cpp [Support][ThinLTO] Move ThinLTO caching to LLVM Support library 2021-10-18 18:57:25 -07:00
LTO.h [lld-macho] Add LTO cache support 2021-07-15 12:56:13 -04:00
MachOStructs.h [lld-macho] Add support for arm64_32 2021-04-15 21:16:33 -04:00
MapFile.cpp [lld][MachO] Sort symbols in parallel in -map 2021-06-17 10:19:59 +08:00
MapFile.h [lld-macho] implement options -map 2021-03-18 10:39:19 -04:00
MarkLive.cpp [lld/mac] Partially implement -export_dynamic 2021-07-06 11:22:18 -04:00
MarkLive.h [lld/mac] Implement -dead_strip 2021-06-02 11:09:26 -04:00
ObjC.cpp [lld-macho] Refactor archive loading 2021-08-26 18:52:07 -04:00
ObjC.h [lld-macho] Implement -ObjC 2020-08-26 19:20:55 -07:00
Options.td [lld/mac] Don't warn on both --icf=all and -no_deduplicate 2021-09-29 08:25:21 -04:00
OutputSection.cpp [lld/mac] Implement support for section$start and section$ end symbols 2021-07-23 16:01:09 -04:00
OutputSection.h [lld/mac] Implement support for section$start and section$ end symbols 2021-07-23 16:01:09 -04:00
OutputSegment.cpp [lld/mac] Add support for segment$start$ and segment$end$ symbols 2021-07-25 18:25:13 -04:00
OutputSegment.h [lld/mac] Add support for segment$start$ and segment$end$ symbols 2021-07-25 18:25:13 -04:00
Relocations.cpp [lld-macho][nfc] Remove DYSYM8 reloc attribute 2021-04-09 19:48:08 -04:00
Relocations.h [lld-macho] Add 32-bit compact unwind support 2021-04-15 21:16:33 -04:00
SymbolTable.cpp [lld/mac] Add support for segment$start$ and segment$end$ symbols 2021-07-25 18:25:13 -04:00
SymbolTable.h [lld/mac] Implement -dead_strip 2021-06-02 11:09:26 -04:00
Symbols.cpp [lld-macho] Implement ICF 2021-06-17 10:07:44 -07:00
Symbols.h [lld/mac] Fix bug in interaction of -dead_strip and -undefined dynamic_lookup 2021-07-22 19:30:46 -04:00
SyntheticSections.cpp [lld/mac] Mark private externs with GOT relocs as LOCAL in indirect symbtab 2021-10-15 13:24:47 -04:00
SyntheticSections.h Revert "Extract LC_CODE_SIGNATURE related implementation out of LLD" 2021-10-01 17:19:50 -07:00
Target.cpp [lld-macho][nfc] Create Relocations.{h,cpp} for relocation-specific code 2021-03-11 13:28:09 -05:00
Target.h [lld/mac] Set branchRange a bit more carefully 2021-08-30 12:36:06 -04:00
UnwindInfoSection.cpp [lld-macho] Ignore local personality symbols if non-local with the same name exisst, to avoid "too many personalities" error. 2021-09-17 12:59:42 -04:00
UnwindInfoSection.h [lld/mac] Don't crash when dead-stripping removes all unwind info 2021-07-07 13:05:40 -04:00
Writer.cpp [lld/mac] Don't assert during thunk insertion if there are undefined symbols 2021-09-03 12:22:41 -04:00
Writer.h [lld-macho] Have ICF operate on all sections at once 2021-07-17 13:42:51 -04:00