| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[lld][COFF] Fix TypeServerSource lookup on GUID collisions Microsoft shipped a bunch of PDB files with broken/invalid GUIDs which lead lld to use 0xFF as the key for these files in an internal cache. When multiple files have this key it will lead to collisions and confused symbol lookup. Several approaches to fix this was considered. Including making the key the path to the PDB file, but this requires some filesystem operations in order to normalize the file path. Since this only happens with malformatted PDB files and we haven't seen this before they malformatted files where shipped with visual studio we probably shouldn't optimize for this use-case. Instead we now just don't insert files with Guid == 0xFF into the cache map and warn if we get collisions so similar problems can be found in the future instead of being silent. Discussion about the root issue and the approach to this fix can be found on Github: https://github.com/llvm/llvm-project/issues/54487 Reviewed By: aganea Differential Revision: https://reviews.llvm.org/D122372 | 4 年前 | |
[COFF] Avoid loading objects for mingw autoimport, when a defined alias exists This avoids a spurious and confusing log message in cases where both e.g. "alias" and "__imp_alias" exist. Differential Revision: https://reviews.llvm.org/D65598 llvm-svn: 367673 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[COFF] Fix crashes when writing a PDB after adding thunks. When writing a PDB, the OutputSection of all chunks need to be set. The thunks are added directly to OutputSection after the normal machinery that sets it for all other chunks. This fixes part of PR40467. Differential Revision: https://reviews.llvm.org/D57574 llvm-svn: 352928 | 7 年前 | |
[LLD][COFF] Fix writing a map file when range extension thunks are inserted Bug: An assertion fails: Assertion failed: isa<To>(Val) && "cast<Ty>() argument of incompatible type!", file C:\Users\<user>\prog\llvm\llvm-git-lld-bug\llvm\include\llvm/Support/Casting.h, line 578 Bug is triggered, if - a map file is requested with /MAP, and - Architecture is ARMv7, Thumb, and - a relative jump (branch instruction) is greater than 16 MiB (2^24) The reason for the Bug is: - a Thunk is created for the jump - a Symbol for the Thunk is created - of type DefinedSynthetic - in file Writer.cpp - in function getThunk - the Symbol has no name - when creating the map file, the name of the Symbol is queried - the function Symbol::computeName of the base class Symbol casts the this pointer to type DefinedCOFF (a derived type), but the acutal type is DefinedSynthetic - The in the llvm::cast an assertion fails Changes: - Modify regression test to trigger this bug - Give the symbol pointing to the thunk a name, to fix the bug - Add assertion, that only DefinedCOFF symbols are allowed to have an empty name, when the constructor of the base class Symbol is executed Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D133201 (cherry picked from commit 4e5a59a3839f54d928d37d49d4c4ddbb3f339b76) | 3 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[COFF] Disallow -dynamicbase:no for arm and arm64 This matches what MSVC link.exe does. Differential Revision: https://reviews.llvm.org/D41051 llvm-svn: 320517 | 8 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[COFF] Set proper pointer size alignment for LocalImportChunk When these are accessed with load/store instructions on ARM64, it becomes strictly necessary to have them properly aligned. This fixes PR39228. Differential Revision: https://reviews.llvm.org/D53128 llvm-svn: 344264 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[LLD][COFF] Fix writing a map file when range extension thunks are inserted Bug: An assertion fails: Assertion failed: isa<To>(Val) && "cast<Ty>() argument of incompatible type!", file C:\Users\<user>\prog\llvm\llvm-git-lld-bug\llvm\include\llvm/Support/Casting.h, line 578 Bug is triggered, if - a map file is requested with /MAP, and - Architecture is ARMv7, Thumb, and - a relative jump (branch instruction) is greater than 16 MiB (2^24) The reason for the Bug is: - a Thunk is created for the jump - a Symbol for the Thunk is created - of type DefinedSynthetic - in file Writer.cpp - in function getThunk - the Symbol has no name - when creating the map file, the name of the Symbol is queried - the function Symbol::computeName of the base class Symbol casts the this pointer to type DefinedCOFF (a derived type), but the acutal type is DefinedSynthetic - The in the llvm::cast an assertion fails Changes: - Modify regression test to trigger this bug - Give the symbol pointing to the thunk a name, to fix the bug - Add assertion, that only DefinedCOFF symbols are allowed to have an empty name, when the constructor of the base class Symbol is executed Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D133201 (cherry picked from commit 4e5a59a3839f54d928d37d49d4c4ddbb3f339b76) | 3 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD] [COFF] Fix mingw comdat associativity for leader symbols with a different name For a weak symbol func in a comdat, the actual leader symbol ends up named like .weak.func.default*. Likewise, for stdcall on i386, the symbol may be named _func@4, while the section suffix only is "func", which the previous implementation didn't handle. This fixes unwinding through weak functions when using -ffunction-sections in mingw environments. Differential Revision: https://reviews.llvm.org/D84607 | 5 年前 | |
[LLD] [COFF] Fix mingw comdat associativity for leader symbols with a different name For a weak symbol func in a comdat, the actual leader symbol ends up named like .weak.func.default*. Likewise, for stdcall on i386, the symbol may be named _func@4, while the section suffix only is "func", which the previous implementation didn't handle. This fixes unwinding through weak functions when using -ffunction-sections in mingw environments. Differential Revision: https://reviews.llvm.org/D84607 | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
lld-link: Allow backward references between associated comdats References between associated comdats are invalid per COFF spec, but the newest Windows SDK contains obj files that have these references (https://bugs.chromium.org/p/chromium/issues/detail?id=925943#c13). So add back support for them and add tests for them. The old code handled them fine. This makes lld-link match the behavior of newer link.exe versions as far as I can tell. (The behavior before this change matched the behavior of older link.exe versions.) This mostly reverts r352254. Differential Revision: https://reviews.llvm.org/D57387 llvm-svn: 352508 | 7 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[COFF] Support MinGW automatic dllimport of data Normally, in order to reference exported data symbols from a different DLL, the declarations need to have the dllimport attribute, in order to use the __imp_<var> symbol (which contains an address to the actual variable) instead of the variable itself directly. This isn't an issue in the same way for functions, since any reference to the function without the dllimport attribute will end up as a reference to a thunk which loads the actual target function from the import address table (IAT). GNU ld, in MinGW environments, supports automatically importing data symbols from DLLs, even if the references didn't have the appropriate dllimport attribute. Since the PE/COFF format doesn't support the kind of relocations that this would require, the MinGW's CRT startup code has an custom framework of their own for manually fixing the missing relocations once module is loaded and the target addresses in the IAT are known. For this to work, the linker (originall in GNU ld) creates a list of remaining references needing fixup, which the runtime processes on startup before handing over control to user code. While this feature is rather controversial, it's one of the main features allowing unix style libraries to be used on windows without any extra porting effort. Some sort of automatic fixing of data imports is also necessary for the itanium C++ ABI on windows (as clang implements it right now) for importing vtable pointers in certain cases, see D43184 for some discussion on that. The runtime pseudo relocation handler supports 8/16/32/64 bit addresses, either PC relative references (like IMAGE_REL_*_REL32*) or absolute references (IMAGE_REL_AMD64_ADDR32, IMAGE_REL_AMD64_ADDR32, IMAGE_REL_I386_DIR32). On linking, the relocation is handled as a relocation against the corresponding IAT slot. For the absolute references, a normal base relocation is created, to update the embedded address in case the image is loaded at a different address. The list of runtime pseudo relocations contains the RVA of the imported symbol (the IAT slot), the RVA of the location the relocation should be applied to, and a size of the memory location. When the relocations are fixed at runtime, the difference between the actual IAT slot value and the IAT slot address is added to the reference, doing the right thing for both absolute and relative references. With this patch alone, things work fine for i386 binaries, and mostly for x86_64 binaries, with feature parity with GNU ld. Despite this, there are a few gotchas: - References to data from within code works fine on both x86 architectures, since their relocations consist of plain 32 or 64 bit absolute/relative references. On ARM and AArch64, references to data doesn't consist of a plain 32 or 64 bit embedded address or offset in the code. On ARMNT, it's usually a MOVW+MOVT instruction pair represented by a IMAGE_REL_ARM_MOV32T relocation, each instruction containing 16 bit of the target address), on AArch64, it's usually an ADRP+ADD/LDR/STR instruction pair with an even more complex encoding, storing a PC relative address (with a range of +/- 4 GB). This could theoretically be remedied by extending the runtime pseudo relocation handler with new relocation types, to support these instruction encodings. This isn't an issue for GCC/GNU ld since they don't support windows on ARMNT/AArch64. - For x86_64, if references in code are encoded as 32 bit PC relative offsets, the runtime relocation will fail if the target turns out to be out of range for a 32 bit offset. - Fixing up the relocations at runtime requires making sections writable if necessary, with the VirtualProtect function. In Windows Store/UWP apps, this function is forbidden. These limitations are addressed by a few later patches in lld and llvm. Differential Revision: https://reviews.llvm.org/D50917 llvm-svn: 340726 | 7 年前 | |
[test] lld/test/: change llvm-objdump single-dash long options to double-dash options | 6 年前 | |
[COFF] Support MinGW automatic dllimport of data Normally, in order to reference exported data symbols from a different DLL, the declarations need to have the dllimport attribute, in order to use the __imp_<var> symbol (which contains an address to the actual variable) instead of the variable itself directly. This isn't an issue in the same way for functions, since any reference to the function without the dllimport attribute will end up as a reference to a thunk which loads the actual target function from the import address table (IAT). GNU ld, in MinGW environments, supports automatically importing data symbols from DLLs, even if the references didn't have the appropriate dllimport attribute. Since the PE/COFF format doesn't support the kind of relocations that this would require, the MinGW's CRT startup code has an custom framework of their own for manually fixing the missing relocations once module is loaded and the target addresses in the IAT are known. For this to work, the linker (originall in GNU ld) creates a list of remaining references needing fixup, which the runtime processes on startup before handing over control to user code. While this feature is rather controversial, it's one of the main features allowing unix style libraries to be used on windows without any extra porting effort. Some sort of automatic fixing of data imports is also necessary for the itanium C++ ABI on windows (as clang implements it right now) for importing vtable pointers in certain cases, see D43184 for some discussion on that. The runtime pseudo relocation handler supports 8/16/32/64 bit addresses, either PC relative references (like IMAGE_REL_*_REL32*) or absolute references (IMAGE_REL_AMD64_ADDR32, IMAGE_REL_AMD64_ADDR32, IMAGE_REL_I386_DIR32). On linking, the relocation is handled as a relocation against the corresponding IAT slot. For the absolute references, a normal base relocation is created, to update the embedded address in case the image is loaded at a different address. The list of runtime pseudo relocations contains the RVA of the imported symbol (the IAT slot), the RVA of the location the relocation should be applied to, and a size of the memory location. When the relocations are fixed at runtime, the difference between the actual IAT slot value and the IAT slot address is added to the reference, doing the right thing for both absolute and relative references. With this patch alone, things work fine for i386 binaries, and mostly for x86_64 binaries, with feature parity with GNU ld. Despite this, there are a few gotchas: - References to data from within code works fine on both x86 architectures, since their relocations consist of plain 32 or 64 bit absolute/relative references. On ARM and AArch64, references to data doesn't consist of a plain 32 or 64 bit embedded address or offset in the code. On ARMNT, it's usually a MOVW+MOVT instruction pair represented by a IMAGE_REL_ARM_MOV32T relocation, each instruction containing 16 bit of the target address), on AArch64, it's usually an ADRP+ADD/LDR/STR instruction pair with an even more complex encoding, storing a PC relative address (with a range of +/- 4 GB). This could theoretically be remedied by extending the runtime pseudo relocation handler with new relocation types, to support these instruction encodings. This isn't an issue for GCC/GNU ld since they don't support windows on ARMNT/AArch64. - For x86_64, if references in code are encoded as 32 bit PC relative offsets, the runtime relocation will fail if the target turns out to be out of range for a 32 bit offset. - Fixing up the relocations at runtime requires making sections writable if necessary, with the VirtualProtect function. In Windows Store/UWP apps, this function is forbidden. These limitations are addressed by a few later patches in lld and llvm. Differential Revision: https://reviews.llvm.org/D50917 llvm-svn: 340726 | 7 年前 | |
[test] lld/test/: change llvm-objdump single-dash long options to double-dash options | 6 年前 | |
[COFF] Omit automatically imported symbols from the symbol table These symbols actually point to the symbol's IAT entry, which obviously is different from the symbol itself (which is imported from a different module and doesn't exist in the current one). Omitting this symbol helps gdb inspect automatically imported symbols, see https://sourceware.org/bugzilla/show_bug.cgi?id=24574 for discussion on the matter. Surprisingly, those extra symbols don't seem to be an issue for gdb when the sources have been built with clang, only with gcc. The actual logic in gdb that this depends on still is unknown, but omitting these symbols from the symbol table is the right thing to do in any case. Differential Revision: https://reviews.llvm.org/D65727 llvm-svn: 367836 | 6 年前 | |
[test] lld/test/: change llvm-objdump single-dash long options to double-dash options | 6 年前 | |
[LLD] [COFF] Fix automatically importing data symbols from DLLs with LTO This broke in 51dcb292cc002, "[lld-link] diagnose undefined symbols before LTO when possible" (very soon after the 9.0 branch, so luckily the 9.0 release is unaffected). The code for loading objects we believe might be needed for autoimport (loadMinGWAutomaticImports()) does run before the new reportUnresolvable() function, but it had a condition to only operate on symbols from regular object files. This condition came from resolveRemainingUndefines(), but as loadMinGWAutomaticImports() now has to operate before the LTO, it has to operate on undefineds from LTO objects as well. Differential Revision: https://reviews.llvm.org/D70166 | 6 年前 | |
[LLD] [COFF] Add options for disabling auto import and runtime pseudo relocs Allow disabling either the full auto import feature, or just forbidding the cases that require runtime fixups. As long as all auto imported variables are referenced from separate .refptr$<name> sections, we can alias them on top of the IAT entries and don't actually need any runtime fixups via pseudo relocations. LLVM generates references to variables in .refptr stubs, if it isn't known that the variable for sure is defined in the same object module. Runtime pseudo relocs are needed if the addresses of auto imported variables are used in constant initializers though. Fixing up runtime pseudo relocations requires the use of VirtualProtect (which is disallowed in WinStore/UWP apps) or VirtualProtectFromApp. To allow any risk of ambiguity, allow rejecting cases that would require this at the linker stage. This adds support for the --disable-runtime-pseudo-reloc and --disable-auto-import options in the MinGW driver (matching GNU ld.bfd) with corresponding lld private options in the COFF driver. Differential Revision: https://reviews.llvm.org/D78923 | 6 年前 | |
[LLD] [COFF] Try to fix test errors from 7f0e6c31c255303 on windows Just skip trying to match for the path separator explicitly (instead of making it match either a forward or backwards slash), simplifying the test a little. | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Port CallGraphSort to COFF from ELF | 5 年前 | |
[COFF] Port CallGraphSort to COFF from ELF | 5 年前 | |
[COFF] Port CallGraphSort to COFF from ELF | 5 年前 | |
[COFF] Port CallGraphSort to COFF from ELF | 5 年前 | |
[COFF] Port CallGraphSort to COFF from ELF | 5 年前 | |
[COFF] Port CallGraphSort to COFF from ELF | 5 年前 | |
Identify object files compiled with cl.exe /GL. Object files compiled with cl.exe /GL contain intermediate code for LTO. We can't (and don't want to) interpret such code, but we should print out a user-friendly error message. Differential Revision: https://reviews.llvm.org/D26647 llvm-svn: 286921 | 9 年前 | |
Re-submit r367649: Improve raw_ostream so that you can "write" colors using operator<< The original patch broke buildbots, perhaps because it changed the default setting whether colors are enabled or not. llvm-svn: 368131 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD] [COFF] Check the aux section definition size for IMAGE_COMDAT_SELECT_SAME_SIZE Binutils generated sections seem to be padded to a multiple of 16 bytes, but the aux section definition contains the original, unpadded section length. The size check used for IMAGE_COMDAT_SELECT_SAME_SIZE previously only checked the size of the section itself. When checking the currently processed object file against the previously chosen comdat section, we easily have access to the aux section definition of the currently processed section, but we have to iterate over the symbols of the previously selected object file to find the section definition of the previously picked section. (We don't want to inflate SectionChunk to carry more data, for something that is only needed in corner cases.) Only do this when the mingw flag is set. This fixes statically linking clang-built C++ object files against libstdc++ built with GCC, if the object files contain e.g. typeinfo. Differential Revision: https://reviews.llvm.org/D86659 | 5 年前 | |
[LLD][COFF] Enable linking of __declspec(selectany) symbols from Clang and GCC When annotating a symbol with __declspec(selectany), Clang assigns it comdat 2 while GCC assigns it comdat 3. This patch enables two object files that contain a __declspec(selectany) symbol, one created by gcc and the other by clang, to be linked together instead of issuing a duplicate symbol error. Differential Revision: https://reviews.llvm.org/D73139 | 6 年前 | |
[COFF] In MinGW mode, ignore relocations against a discarded section When GCC produces a jump table as part of a comdat function, the jump table itself is produced as plain non-comdat rdata section. When linked with ld.bfd, all of those rdata sections are kept, with relocations unchanged in the sections that refer to discarded comdat sections. This has been observed with at least GCC 5.x and 7.x. Differential Revision: https://reviews.llvm.org/D52600 llvm-svn: 343422 | 7 年前 | |
lld/coff: Implement some support for the comdat selection field LLD used to handle comdats as if the selection field was always set to IMAGE_COMDAT_SELECT_ANY. This means for obj files produced by cl /Gy, LLD would never report a duplicate symbol error. This change: - adds validation for the Selection field (should make no difference in practice for compiler-generated obj inputs) - rejects comdats that have different Selection fields in different obj files (likewise). This is a bit more strict but also more self-consistent thank link.exe (see comment in code) - implements handling for all the selection kinds In practice, compilers only generate comdats with IMAGE_COMDAT_SELECT_NODUPLICATES (LLD now produces duplicate symbol errors for these), IMAGE_COMDAT_SELECT_ANY (no behavior change), and IMAGE_COMDAT_SELECT_LARGEST (for RTTI data; here LLD should no longer create broken executables when linking some TUs with RTTI enabled and some with it disabled – but see below). The implementation of IMAGE_COMDAT_SELECT_LARGEST is incomplete: If one SELECT_LARGEST comdat replaces an earlier one, the comdat symbol is replaced correctly, but the old section stays loaded and if /opt:ref is disabled (via /opt:noref or /debug) it's still written to the output. That's not ideal, but better than the current treatment of just picking any one of those comdats. I hope to fix this better later. Fixes most of PR40094. Differential Revision: https://reviews.llvm.org/D57324 llvm-svn: 352590 | 7 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[COFF] Cope with GCC produced weak aliases referring to comdat functions For certain cases of inline functions written to comdat sections, GCC 5.x produces a weak symbol in addition, which would end up undefined in some cases. This no longer seems to happen with GCC 6.x or newer though. Differential Revision: https://reviews.llvm.org/D52602 llvm-svn: 343877 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
lld-link, clang: Treat non-existent input files as possible spellos for option flags OptTable treats arguments starting with / that aren't a known option as filenames. This means lld-link's and clang-cl's typo correction for unknown flags didn't do spell checking for misspelled options that start with /. I first tried changing OptTable, but that got pretty messy, see PR41787 comments 2 and 3. Instead, let lld-link's and clang's (including clang-cl's) "file not found" diagnostic check if a non-existent file looks like it could be a mis-spelled option, and if so add a "did you mean" suggestion to the "file not found" diagnostic. While here, make formatting of a few diagnostics a bit more self-consistent. Fixes PR41787. Differential Revision: https://reviews.llvm.org/D62276 llvm-svn: 361518 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Provide __CTOR_LIST__ and __DTOR_LIST__ symbols for MinGW MinGW uses these kind of list terminator symbols for traversing the constructor/destructor lists. These list terminators are actual pointers entries in the lists, with the values 0 and (uintptr_t)-1 (instead of just symbols pointing to the start/end of the list). (This mechanism exists in both the mingw-w64 crt startup code and in libgcc; normally the mingw-w64 one is used, but a DLL build of libgcc uses the libgcc one. Therefore it's not trivial to change the mechanism without lots of cross-project synchronization and potentially invalidating some combinations of old/new versions of them.) When mingw-w64 has been used with lld so far, the CRT startup object files have so far provided these symbols, ending up with different, incompatible builds of the CRT startup object files depending on whether binutils or lld are going to be used. In order to avoid the need of different configuration of the CRT startup object files depending on what linker to be used, provide these symbols in lld instead. (Mingw-w64 checks at build time whether the linker provides these symbols or not.) This unifies this particular detail between the two linkers. This does disallow the use of the very latest lld with older versions of mingw-w64 (the configure check for the list was added recently; earlier it simply checked whether the CRT was built with gcc or clang), and requires rebuilding the mingw-w64 CRT. But the number of users of lld+mingw still is low enough that such a change should be tolerable, and unifies this aspect of the toolchains, easing interoperability between the toolchains for the future. The actual test for this feature is added in ctors_dtors_priority.s, but a number of other tests that checked absolute output addresses are updated. Differential Revision: https://reviews.llvm.org/D52053 llvm-svn: 342294 | 7 年前 | |
[COFF] Clean up debug option handling /debug and /debug:dwarf are orthogonal. An object file can contain both CodeView and DWARF debug info, so the combination of /debug:dwarf and /debug should generate both DWARF and a PDB, rather than /debug:dwarf always suppressing PDB creation. /nopdb is now redundant and can be removed. /debug /nopdb was previously used to support DWARF, but specifying /debug:dwarf is entirely equivalent to that combination now. Differential Revision: https://reviews.llvm.org/D41310 llvm-svn: 320896 | 8 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Add regression test for maybeMangle issue This was crbug.com/1222724, which caused D104529 to be reverted. The new test fails when D104529 is reapplied locally. | 4 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[llvm-objdump,ARM] Add PrettyPrinters for Arm and AArch64. Most Arm disassemblers, including GNU objdump and Arm's own fromelf, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a .inst directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or SVC immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358 | 3 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[COFF] Share the tail in delayimport symbol thunks E.g. for x86_64, previously each symbol's thunk was 87 bytes. Now there's a 12 byte thunk per symbol, plus a shared 83 byte tail function. This is similar to what both MS link.exe and GNU tools do for delay imports. Differential Revision: https://reviews.llvm.org/D64288 llvm-svn: 365823 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Allow embedded directives to be separated by null bytes The PE spec says that they will be separated by spaces, but link.exe handles it just fine if they are separated by null bytes as well. This adds tests to the lld repo, with the actual functional change in LLVM in SVN r342204. Differential Revision: https://reviews.llvm.org/D52014 llvm-svn: 342206 | 7 年前 | |
[LLD][COFF] Avoid overwriting inputs in tests Before this patch, these two tests were emitting both a .DLL and .LIB. The output .LIB file name also happens to be an input .LIB file name. This prevented the test from executing a second time when LLD is re-entrant (LLD_IN_TEST=2). This is a support patch for https://reviews.llvm.org/D70378. | 5 年前 | |
[lld] Add REQUIRES: x86 where needed to tests If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 llvm-svn: 334095 | 7 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[LLD] [COFF] Allow invoking lib.exe mode via -lib in addition to /lib Remove a stray -lib argument in guardcf-lto.ll; llvm-lib doesn't support generating import libs from a def file unlike lib.exe. Previously this worked because the -lib argument was ignored (printing only a warning). Differential Revision: https://reviews.llvm.org/D96699 | 5 年前 | |
[LLD] [COFF] Fix post-commit suggestions for absolute symbol equality Differential Revision: https://reviews.llvm.org/D72252 | 6 年前 | |
[LLD] [COFF] Don't error out on duplicate absolute symbols with the same value Both MS link.exe and GNU ld.bfd handle it this way; one can have multiple object files defining the same absolute symbols, as long as it defines it to the same value. But if there are multiple absolute symbols with differing values, it is treated as an error. Differential Revision: https://reviews.llvm.org/D71981 | 6 年前 | |
[LLD] [COFF] Try to report source locations for duplicate symbols This fixes the second part of PR42407. For files with dwarf debug info, it manually loads and iterates .debug_info to find the declared location of variables, to allow reporting them. (This matches the corresponding code in the ELF linker.) For functions, it uses the existing getFileLineDwarf which uses LLVMSymbolizer for translating addresses to file lines. In object files with codeview debug info, only the source location of duplicate functions is printed. (And even there, only for the first input file. The getFileLineCodeView function requires the object file to be fully loaded and initialized to properly resolve source locations, but duplicate symbols are reported at a stage when the second object file isn't fully loaded yet.) Differential Revision: https://reviews.llvm.org/D68975 llvm-svn: 375218 | 6 年前 | |
Revert "[DebugInfo] Remove dots from getFilenameByIndex return value" This is failing on Windows bots due to path separator normalization. This reverts commit 042c23506869b4ae9a49d2c4bc5ea6e6baeabe78. | 5 年前 | |
[COFF] Fix error handling on duplicates for import library symbols Normally one wouldn't run into that case, but it is possible with a little creative ordering of special libraries. Differential Revision: https://reviews.llvm.org/D53388 llvm-svn: 344776 | 7 年前 | |
[LLD] [COFF] Try to report source locations for duplicate symbols This fixes the second part of PR42407. For files with dwarf debug info, it manually loads and iterates .debug_info to find the declared location of variables, to allow reporting them. (This matches the corresponding code in the ELF linker.) For functions, it uses the existing getFileLineDwarf which uses LLVMSymbolizer for translating addresses to file lines. In object files with codeview debug info, only the source location of duplicate functions is printed. (And even there, only for the first input file. The getFileLineCodeView function requires the object file to be fully loaded and initialized to properly resolve source locations, but duplicate symbols are reported at a stage when the second object file isn't fully loaded yet.) Differential Revision: https://reviews.llvm.org/D68975 llvm-svn: 375218 | 6 年前 | |
[COFF] Allow using custom .edata from input object files This is used by Wine for manually crafting export tables. If the input object contains .edata sections, GNU ld references them in the export directory instead of synthesizing an export table using either export directives or the normal auto export mechanism. (AFAIK, historically, way way back, GNU ld didn't support synthesizing the export table - one was supposed to generate it using dlltool and link it in instead.) If faced with --out-implib and --output-def, GNU ld still populates those output files with the same export info as it would have generated otherwise, disregarding the input .edata. As this isn't an intended usage combination, I'm not adding checks for that in tests. Differential Revision: https://reviews.llvm.org/D65903 llvm-svn: 369358 | 6 年前 | |
[COFF] Strip section name suffix from mingw comdats This is the second part of the fix for PR42217. Differential Revision: https://reviews.llvm.org/D63352 llvm-svn: 363457 | 6 年前 | |
[COFF] Link crtend.o as the last object file When faced with command line options such as "crtbegin.o appmain.o -lsomelib crtend.o", GNU ld pulls in all necessary object files from somelib before proceeding to crtend.o. LLD operates differently, only loading object files from any referenced static libraries after processing all input object files. This uses a similar hack as in the ELF linker. Here, it moves crtend.o to the end of the vector of object files. This makes sure that terminator chunks for sections such as .eh_frame gets ordered last, fixing DWARF exception handling for libgcc and gcc's crtend.o. Differential Revision: https://reviews.llvm.org/D60628 llvm-svn: 358394 | 7 年前 | |
[CodeView] Avoid emitting empty debug globals subsection. In https://reviews.llvm.org/D89072 I added static const data members to the debug subsection for globals. It skipped emitting an S_CONSTANT if it didn't have a value, which meant the subsection could be empty. This patch fixes the empty subsection issue. Differential Revision: https://reviews.llvm.org/D92049 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[COFF] Don't error if the only inputs are from /wholearchive: Fixes PR43744 Differential Revision: https://reviews.llvm.org/D69968 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
lld-link: Take /SUBSYSTEM into account for automatic /ENTRY detection. If /subsystem:windows is passed, link.exe only looks for WinMain and wWinMain, and if /subsystem:console is passed it only looks for main and wmain. lld-link used to look for all 4 in both cases. This patch makes lld-link match link.exe's behavior. This requires that the subsystem is known by the time findDefaultEntry() gets called. findDefaultEntry() is called before the main link loop, so that the loop can mark the entry point as undefined. That means inferSubsystem() has to be called above the main loop as well. This in turn means /subsystem: from .drectve sections only has an effect on entry point inference for obj files passed to lld-link directly (and not in obj files found later in .lib files). link.exe seems to ignore /subsystem: for obj files from lib files completely (while in lld it's ignored only for entry point detection but it still overrides /subsystem: flags passed on the command line for the value that gets written in the output file). Also, if the subsytem isn't needed (e.g. when only writing a /def: lib file and not writing a coff file), link.exe doesn't complain if the subsystem isn't known, so both subsystem and entry point handling should be below the early return lld has for that case. Fixes PR36523. https://reviews.llvm.org/D50316 llvm-svn: 339165 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
lld-link: Several tweaks to default entry point selection. Three related changes: 1. link.exe uses the presence of main and wmain to decide if it should call mainCRTStartup or wmainCRTStartup, even if /nodefaultlib is passed. For compatibility, remove FindMain logic. 2. Default to the non-wide entrypoint if main is not found. This has two effects: 2a. In normal links, lld-link now prints lld-link: error: undefined symbol: _main >>> referenced by f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:78 >>> libcmt.lib(exe_main.obj):("int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ)) >>> referenced by f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:283 >>> libcmt.lib(exe_main.obj):("int __cdecl __scrt_common_main_seh(void)" (?__scrt_common_main_seh@@YAHXZ)) instead of lld-link: error: entry point must be defined This is arguably a better error message, since it now mentions that _main is missing. (This matches link.exe's diagnostic in this case.) 2b. With /nodefautlib, we now default to mainCRTStartup if no main() is present, again matching link.exe. This makes r337407 obsolete. This means if you have a cc file containing both mainCRTStartup and wmainCRTStartup and you pass /nodefaultlib /subsystem:console, lld-link will now call mainCRTStartup, matching link.exe 3. Print a warning if both main and wmain are present, similar to link.exe's LNK4067. Differential Revision: https://reviews.llvm.org/D52832 llvm-svn: 343698 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
lld-link, clang: Treat non-existent input files as possible spellos for option flags OptTable treats arguments starting with / that aren't a known option as filenames. This means lld-link's and clang-cl's typo correction for unknown flags didn't do spell checking for misspelled options that start with /. I first tried changing OptTable, but that got pretty messy, see PR41787 comments 2 and 3. Instead, let lld-link's and clang's (including clang-cl's) "file not found" diagnostic check if a non-existent file looks like it could be a mis-spelled option, and if so add a "did you mean" suggestion to the "file not found" diagnostic. While here, make formatting of a few diagnostics a bit more self-consistent. Fixes PR41787. Differential Revision: https://reviews.llvm.org/D62276 llvm-svn: 361518 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD] [COFF] Add support for a new, mingw specific embedded directive -exclude-symbols: This is an entirely new embedded directive - extending the GNU ld command line option --exclude-symbols to be usable in embedded directives too. (GNU ld.bfd also got support for the same new directive, currently in the latest git version, after the 2.39 branch.) This works as an inverse to the regular embedded dllexport directives, for cases when autoexport of all eligible symbols is performed. Differential Revision: https://reviews.llvm.org/D130120 (cherry picked from commit 5d513ef6cf4646e64bbb1d5f8610afd530964588) | 3 年前 | |
[LLD] [MinGW] Implement the --exclude-symbols option This adds support for the existing GNU ld command line option, which allows excluding individual symbols from autoexport (when linking a DLL and no symbols are marked explicitly as dllexported). Differential Revision: https://reviews.llvm.org/D130118 (cherry picked from commit d1da6469f9ea9b078276ee2e098241f0440468be) | 3 年前 | |
[LLD] [COFF] Fix autoexport from LTO objects with comdat symbols Make sure that comdat symbols also have a non-null dummy SectionChunk associated. This requires moving around an existing FIXME regarding comdats in LTO. Differential Revision: https://reviews.llvm.org/D103012 | 4 年前 | |
[LLD] [COFF] Make -export-all-symbols work as intended for EXEs If some symbols are marked with dllexport, we still want to export all symbols if -export-all-symbols is specified. Previously, this only worked as it should for DLL output, not for EXE. This should fix downstream bug https://github.com/msys2/MINGW-packages/issues/9163. Differential Revision: https://reviews.llvm.org/D106245 | 4 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[lld-link] Warn on exported deleting dtor MSVC linker has this [[ https://docs.microsoft.com/en-us/cpp/error-messages/tool-errors/linker-tools-warning-lnk4102?view=msvc-160 | warning]], so lld-link should also warn on this. Differential Revision: https://reviews.llvm.org/D100606 | 5 年前 | |
COFF: We no longer require lib.exe to test DLL exports. llvm-svn: 289745 | 9 年前 | |
[LLD] [COFF] Improve the error message for too many exported symbols Print the actual number of symbols that would have been exported too, which helps assessing the situation. Differential Revision: https://reviews.llvm.org/D130117 | 3 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
[LLD] [COFF] Fix def file exporting of symbols containing periods This fixes an accidental breakage of exporting symbols using def files, when the symbol name contains a period, since commit 0ca06f7950e5, mixing up a symbol name containing a period with the case of exporting a symbol as a forward to another dll. Differential Revision: https://reviews.llvm.org/D79619 | 6 年前 | |
[COFF][X86] Add REQUIRES: x86 to a couple of tests Fix buildbot failure on native AArch64 buildbot that does not have X86 backend compiled in. Differential Revision: https://reviews.llvm.org/D63071 llvm-svn: 362926 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
COFF: Friendlier undefined symbol errors. Summary: This change does three things: - Try to find the file and line number of an undefined symbol reference by reading codeview debug info. - Try to find the name of the function or global variable with the undefined symbol reference by searching the object file's symbol table. - Prints the information in the same style as the ELF linker. Differential Revision: https://reviews.llvm.org/D45467 llvm-svn: 330235 | 8 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD] [COFF] Support merging resource object files Extend WindowsResourceParser to support using a ResourceSectionRef for loading resources from an object file. Only allow merging resource object files in mingw mode; keep the existing error on multiple resource objects in link mode. If there only is one resource object file and no .res resources, don't parse and recreate the .rsrc section, but just link it in without inspecting it. This allows users to produce any .rsrc section (outside of what the parser supports), just like before. (I don't have a specific need for this, but it reduces the risk of this new feature.) Separate out the .rsrc section chunks in InputFiles.cpp, and only include them in the list of section chunks to link if we've determined that there only was one single resource object. (We need to keep other chunks from those object files, as they can legitimately contain other sections as well, in addition to .rsrc section chunks.) Differential Revision: https://reviews.llvm.org/D66824 llvm-svn: 370436 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] Add support for /FUNCTIONPADMIN command-line option Initial patch by Stefan Reinalter. Fixes PR36775 Differential Revision: https://reviews.llvm.org/D49366 llvm-svn: 354716 | 7 年前 | |
[LLD] [COFF] Fix including the personality function for DWARF EH when linking with --gc-sections Since c579a5b1d92a9bc2046d00ee2d427832e0f5ddec we don't traverse .eh_frame when doing GC. But the exception handling personality function needs to be included, and is only referenced from within .eh_frame. Differential Revision: https://reviews.llvm.org/D102138 | 5 年前 | |
[COFF] Don't treat DWARF sections as GC roots DWARF sections are typically live and not COMDAT, so they would be treated as GC roots. Enabling DWARF would essentially keep all code with debug info alive, preventing any section GC. Fixes PR45273 Reviewed By: mstorsjo, MaskRay Differential Revision: https://reviews.llvm.org/D76935 | 6 年前 | |
[LLD] Implement /guard:[no]ehcont Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99078 | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[LLD] Implement /guard:[no]ehcont Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99078 | 5 年前 | |
[LLD] Implement /guard:[no]ehcont Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99078 | 5 年前 | |
fix typos to cycle bots | 4 年前 | |
fix typos to cycle bots | 4 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[LLD] Implement /guard:[no]ehcont Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99078 | 5 年前 | |
[COFF] Cope with weak aliases produced by GNU tools When GNU tools create a weak alias, they produce a strong symbol named .weak.<weaksymbol>.<relatedstrongsymbol>. GNU ld allows many such weak alternatives for the same weak symbol, and the linker picks the first one encountered. This can't be reproduced by assembling from .s files, since llvm-mc produces symbols named .weak.<weaksymbol>.default in these cases. Differential Revision: https://reviews.llvm.org/D52601 llvm-svn: 343704 | 7 年前 | |
[LLD] Implement /guard:[no]ehcont Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99078 | 5 年前 | |
[LLD] Implement /guard:[no]ehcont Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99078 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD] Implement /guard:[no]ehcont Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D99078 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
COFF: Make test commands shorter. NFC. llvm-svn: 244227 | 10 年前 | |
[COFF] Simplify ICF associated comdat handling This is a different approach from D98993 that should achieve most of the same benefit. The two changes are: 1. Sort the list of associated child sections by section name 2. Do not consider associated sections to have children themselves This fixes the main issue, which was that we sometimes considered an .xdata section to have a child .pdata section. That lead to slow links and larger binaries (less xdata folding). Otherwise, this should be NFC: we go back to ignoring .debug/.gljmp and other metadata sections rather than only looking at pdata/xdata. We discovered that we do care about other associated sections, like ASan global registration metadata. | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[lld] Add REQUIRES: x86 where needed to tests If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 llvm-svn: 334095 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[lld-link] Add safe icf mode to lld-link, which does safe icf for all sections. Differential Revision: https://reviews.llvm.org/D97436 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
COFF: Allow ICF on vtable sections. Differential Revision: https://reviews.llvm.org/D46734 llvm-svn: 332059 | 7 年前 | |
[COFF] Simplify ICF associated comdat handling This is a different approach from D98993 that should achieve most of the same benefit. The two changes are: 1. Sort the list of associated child sections by section name 2. Do not consider associated sections to have children themselves This fixes the main issue, which was that we sometimes considered an .xdata section to have a child .pdata section. That lead to slow links and larger binaries (less xdata folding). Otherwise, this should be NFC: we go back to ignoring .debug/.gljmp and other metadata sections rather than only looking at pdata/xdata. We discovered that we do care about other associated sections, like ASan global registration metadata. | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Require an explicit -implib option for creating implibs in mingw mode GNU ld doesn't produce implibs unless explicitly requested. Differential Revision: https://reviews.llvm.org/D66367 llvm-svn: 369363 | 6 年前 | |
[lld] Add REQUIRES: x86 where needed to tests If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 llvm-svn: 334095 | 7 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[test] lld/test/: change llvm-objdump single-dash long options to double-dash options | 6 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] lld/test/: change llvm-objdump single-dash long options to double-dash options | 6 年前 | |
[X86InstPrinter] Change printPCRelImm to print the target address in hexadecimal form // llvm-objdump -d output (before) 400000: e8 0b 00 00 00 callq 11 400005: e8 0b 00 00 00 callq 11 // llvm-objdump -d output (after) 400000: e8 0b 00 00 00 callq 0x400010 400005: e8 0b 00 00 00 callq 0x400015 // GNU objdump -d. The lack of 0x is not ideal because the result cannot be re-assembled 400000: e8 0b 00 00 00 callq 400010 400005: e8 0b 00 00 00 callq 400015 In llvm-objdump, we pass the address of the next MCInst. Ideally we should just thread the address of the current address, unfortunately we cannot call X86MCCodeEmitter::encodeInstruction (X86MCCodeEmitter requires MCInstrInfo and MCContext) to get the length of the MCInst. MCInstPrinter::printInst has other callers (e.g llvm-mc -filetype=asm, llvm-mca) which set Address to 0. They leave MCInstPrinter::PrintBranchImmAsAddress as false and this change is a no-op for them. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D76580 | 6 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD] [COFF] Fix export directives in object files from -includeoptional When an object file contains an export directive, we normally do some amount of deferred processing of them at the end of the linking process. The -includeoptional option was handled after this, and any object files (defining new exports) weren't handled. Move the handling of the -includeoptional into the same late loop which does the fixups for e.g. export directives. Ideally, this would also be done for object files that are pulled in by the wrap options, and for mingw autoimports, but those changes require more modifications, to make them safe for potentially being executed multiple times. This fixes https://github.com/llvm/llvm-project/issues/57243. Differential Revision: https://reviews.llvm.org/D132361 (cherry picked from commit af39e6f6fc905f3c067f022fb44136779d2f9c84) | 3 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] On Windows, fix the date formatting in the 'incremental' test. On my system the date formatting is a bit different from what the test used to support. I'm using: Windows 11 version 21H2, build 22000.795 using the English(Canada) region. ls from BusyBox 1.36 VS 2022 17.2.5 WinSDK 10.0.22000 | 3 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[LLD][COFF] Support GNU style == aliases D46245 added support for this in llvm-libtool, but while lld-link can also create .lib files from .def files it didn't support aliases. I compared the Inputs/library.def test against the output from llvm-libtool and it matches, except for the fact that lld-link reorders functions for some reason. I have also verified that this fixes a bug I was running into while trying to compile .def files to .lib files in MinGW-w64 (using lld-link instead of llvm-libtool). Differential Revision: https://reviews.llvm.org/D113365 | 4 年前 | |
Revert "[X86][LLD] Update datelayout in LLD tests. NFCI" This reverts commit 9b43237128da0a7a3bc8a16f6f2c0897b9e842be. | 4 年前 | |
[COFF] Look for libfoo.a if foo.lib is specified, for MinGW This allows using #pragma comment(lib, "foo") in MinGW built code, if built with -fms-extensions. (This works for system libraries and static libraries only, as it doesn't try to look for .dll.a. As ld.bfd doesn't support embedded defaultlib directives, this isn't in widespread use among mingw users.) Differential Revision: https://reviews.llvm.org/D53017 llvm-svn: 344124 | 7 年前 | |
lld-link: Add a flag /lldignoreenv that makes lld-link ignore env vars. This is useful for enforcing that builds are independent of the environment; it can be used when all system library paths are added via /libpath: already. It's similar ot cl.exe's /X flag. Since it should also affect %LINK% (the other caller of Process::GetEnv in lld/COFF), the early-option-parsing needs to move around a bit. The options are: - Add a manual loop over the argv ArrayRef and look for "/lldignoreenv". This repeats the name of the flag in both Options.td and in DriverUtils.cpp. - Add yet another table.ParseArgs() call just for /lldignoreenv before adding %LINK%. - Use the existing early ParseArgs() that's there for --rsp-quoting and use it for /lldignoreenv for %LINK% as well. This means --rsp-quoting and /lldignoreenv can't be passed via %LINK%. I went with the third approach. Differential Revision: https://reviews.llvm.org/D67456 llvm-svn: 371852 | 6 年前 | |
Delete trailing \r. NFC llvm-svn: 359745 | 7 年前 | |
[LLD] [COFF] Support linking directly against DLLs in MinGW mode GNU ld.bfd supports linking directly against DLLs without using an import library, and some projects have picked up on this habit. (There's no one single unsurmountable issue with using import libraries, but this is a regularly surfacing missing feature.) As long as one is linking by name (instead of by ordinal), the DLL export table contains most of the information needed. (One can inspect what section a symbol points at, to see if it's a function or data symbol. The practical implementation of this loops over all sections for each symbol, but as long as they're not very many, that should hopefully be tolerable performance wise.) One exception where the information in the DLL isn't entirely enough is on i386 with stdcall functions; depending on how they're done, the exported function name can be a plain undecorated name, while the import library would contain the full decorated symbol name. This issue is addressed separately in a different patch. This is implemented mimicing the structure of a regular import library, with one InputFile corresponding to the static archive that just adds lazy symbols, which then are fetched when they are needed. When such a symbol is fetched, we synthesize a coff_import_header structure in memory and create a regular ImportFile out of it. The implementation could be even smaller by just creating ImportFiles for every symbol available immediately, but that would have the drawback of actually ending up importing all symbols unless running with GC enabled (and mingw mode defaults to having it disabled for historical reasons). Differential Revision: https://reviews.llvm.org/D104530 | 4 年前 | |
[LLD] [COFF] Fix up missing stdcall decorations in MinGW mode If linking directly against a DLL without an import library, the DLL export symbols might not contain stdcall decorations. If we have an undefined symbol with decoration, and we happen to have a matching undecorated symbol (which either is lazy and can be loaded, or already defined), then alias it against that instead. This matches what's done in reverse, when we have a def file declaring to export a symbol without decoration, but we only have a defined decorated symbol. In that case we do a fuzzy match (SymbolTable::findMangle). This case is more straightforward; if we have a decorated undefined symbol, just strip the decoration and look for the corresponding undecorated symbol name. Add warnings and options for either silencing the warning or disabling the whole feature, corresponding to how ld.bfd does it. (This feature works for any symbol decoration mismatch, not only when linking against a DLL directly; ld.bfd also tolerates it anywhere, and also fixes up mismatches in the other direction, like SymbolTable::findMangle, for any symbol, not only exports. But in practice, at least for lld, it would primarily end up used for linking against DLLs.) Differential Revision: https://reviews.llvm.org/D104532 | 4 年前 | |
[LLD] [COFF] Support linking directly against DLLs in MinGW mode GNU ld.bfd supports linking directly against DLLs without using an import library, and some projects have picked up on this habit. (There's no one single unsurmountable issue with using import libraries, but this is a regularly surfacing missing feature.) As long as one is linking by name (instead of by ordinal), the DLL export table contains most of the information needed. (One can inspect what section a symbol points at, to see if it's a function or data symbol. The practical implementation of this loops over all sections for each symbol, but as long as they're not very many, that should hopefully be tolerable performance wise.) One exception where the information in the DLL isn't entirely enough is on i386 with stdcall functions; depending on how they're done, the exported function name can be a plain undecorated name, while the import library would contain the full decorated symbol name. This issue is addressed separately in a different patch. This is implemented mimicing the structure of a regular import library, with one InputFile corresponding to the static archive that just adds lazy symbols, which then are fetched when they are needed. When such a symbol is fetched, we synthesize a coff_import_header structure in memory and create a regular ImportFile out of it. The implementation could be even smaller by just creating ImportFiles for every symbol available immediately, but that would have the drawback of actually ending up importing all symbols unless running with GC enabled (and mingw mode defaults to having it disabled for historical reasons). Differential Revision: https://reviews.llvm.org/D104530 | 4 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[lld/COFF] Improve handling of the /manifestdependency: flag If multiple /manifestdependency: flags are passed, they are naively deduped, but after that each of them should have an effect, instead of just the last one. Also, /manifestdependency: flags are allowed in .drectve sections (from #pragma comment(linker, ...). To make the interaction between /manifestdependency: flags enabling manifest by default but /manifest:no overriding this work, add an explict ManifestKind::Default state to represent no explicit /manifest flag being passed. To make /manifestdependency: flags from input file .drectve sections work with /manifest:embed, delay embedded manifest emission until after input files have been read. Differential Revision: https://reviews.llvm.org/D108628 | 4 年前 | |
[lld-link] Add /reproduce: support for several flags /reproduce: now works correctly with: - /call-graph-ordering-file: - /def: - /natvis: - /order: - /pdbstream: I went through all instances of MemoryBuffer::getFile() and made sure everything that didn't already do so called takeBuffer(). For natvis, that wasn't possible since DebugInfo/PDB wants to take owernship of the natvis buffer. For that case, I'm manually adding the tar file entry. /natvis: and /pdbstream: is slightly awkward, since createResponseFile() always adds these flags to the response file but createPDB() (which ultimately adds the files referenced by the flags) is only called if /debug is also passed. So when using /natvis: without /debug with /reproduce:, lld won't warn, but when linking using the response file from the archive, it won't find the natvis file since it's not in the tar. This isn't a new issue though, and after this patch things at least work with using /natvis: _with_ debug with /reproduce:. (Same for /pdbstream:) Differential Revison: https://reviews.llvm.org/D97212 | 5 年前 | |
Revert r371729: lld-link: Make /linkrepro: take a filename, not a directory. This reverts commit r371729 because /linkrepro option also exists in Microsoft link.exe and their linker takes not a filename but a directory name as an argument for /linkrepro. Differential Revision: https://reviews.llvm.org/D68378 llvm-svn: 373703 | 6 年前 | |
[lld-link] Add /reproduce: support for several flags /reproduce: now works correctly with: - /call-graph-ordering-file: - /def: - /natvis: - /order: - /pdbstream: I went through all instances of MemoryBuffer::getFile() and made sure everything that didn't already do so called takeBuffer(). For natvis, that wasn't possible since DebugInfo/PDB wants to take owernship of the natvis buffer. For that case, I'm manually adding the tar file entry. /natvis: and /pdbstream: is slightly awkward, since createResponseFile() always adds these flags to the response file but createPDB() (which ultimately adds the files referenced by the flags) is only called if /debug is also passed. So when using /natvis: without /debug with /reproduce:, lld won't warn, but when linking using the response file from the archive, it won't find the natvis file since it's not in the tar. This isn't a new issue though, and after this patch things at least work with using /natvis: _with_ debug with /reproduce:. (Same for /pdbstream:) Differential Revison: https://reviews.llvm.org/D97212 | 5 年前 | |
[LLD][COFF] Cover usage of LLD-as-a-library in tests In lit tests, we run each LLD invocation twice (LLD_IN_TEST=2), without shutting down the process in-between. This ensures a full cleanup is properly done between runs. Only active for the COFF driver for now. Other drivers still use LLD_IN_TEST=1 which executes just one iteration with full cleanup, like before. When the environment variable LLD_IN_TEST is unset, a shortcut is taken, only one iteration is executed, no cleanup for faster exit, like before. A public API, lld::safeLldMain(), is also available when using LLD as a library. Differential Revision: https://reviews.llvm.org/D70378 | 5 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Repair Windows buildbots after r320792 Windows paths have colons in them, so the regex will fail there. Just match for any character; the rest of the message will restrict the match to the path anyway. llvm-svn: 320793 | 8 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[ThinLTO] Also prune Thin-* files from the ThinLTO cache Such files (Thin-%%%%%%.tmp.o) are supposed to be deleted immediately after they're used (either by renaming or deletion). However, we've seen instances on Windows where this doesn't happen, probably due to the filesystem being flaky. This is effectively a resource leak which has prevented us from using the ThinLTO cache on Windows. Since those temporary files are in the thinlto cache directory which we prune periodically anyway, allowing them to be pruned too seems like a tidy way to solve the problem. Differential revision: https://reviews.llvm.org/D94962 | 5 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[LLD] [COFF] Fix handling of LTO comdats with nontrivial selection types after 728cc0075e5dfdb454eb Commit 728cc0075e5dfdb454ebe6418b63bdffae71ec14 made comdat symbols from LTO objects be treated as any regular comdat symbol. This works great for symbols that actually are IMAGE_COMDAT_SELECT_ANY, but if the symbols have a less trivial selection type that require comparing either the section chunk size or contents, we can't check that before actually doing the LTO compilation. Therefore bring back one aspect of handling from before; that comdat resolution with a leader from an LTO symbol is essentially skipped, like it was before 728cc0075e5dfdb454ebe6418b63bdffae71ec14. Differential Revision: https://reviews.llvm.org/D104605 | 4 年前 | |
[X86InstPrinter] Change printPCRelImm to print the target address in hexadecimal form // llvm-objdump -d output (before) 400000: e8 0b 00 00 00 callq 11 400005: e8 0b 00 00 00 callq 11 // llvm-objdump -d output (after) 400000: e8 0b 00 00 00 callq 0x400010 400005: e8 0b 00 00 00 callq 0x400015 // GNU objdump -d. The lack of 0x is not ideal because the result cannot be re-assembled 400000: e8 0b 00 00 00 callq 400010 400005: e8 0b 00 00 00 callq 400015 In llvm-objdump, we pass the address of the next MCInst. Ideally we should just thread the address of the current address, unfortunately we cannot call X86MCCodeEmitter::encodeInstruction (X86MCCodeEmitter requires MCInstrInfo and MCContext) to get the length of the MCInst. MCInstPrinter::printInst has other callers (e.g llvm-mc -filetype=asm, llvm-mca) which set Address to 0. They leave MCInstPrinter::PrintBranchImmAsAddress as false and this change is a no-op for them. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D76580 | 6 年前 | |
[test] lld/test/: change llvm-objdump single-dash long options to double-dash options | 6 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
Revert "[X86][LLD] Update datelayout in LLD tests. NFCI" This reverts commit 9b43237128da0a7a3bc8a16f6f2c0897b9e842be. | 4 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[lld] Remove support for legacy pass manager This removes options for performing LTO with the legacy pass manager in LLD. Options that explicitly enable the new pass manager are retained as no-ops. Differential Revision: https://reviews.llvm.org/D123219 | 4 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[LTO] Suppress emission of empty combined module by default Summary: That unless the user requested an output object (--lto-obj-path), the an unused empty combined module is not emitted. This changed is helpful for some target (ex. RISCV-V) which encoded the ABI info in IR module flags (target-abi). Empty unused module has no ABI info so the linker would get the linking error during merging incompatible ABIs. Reviewers: tejohnson, espindola, MaskRay Subscribers: emaste, inglorion, arichardson, hiraditya, simoncook, MaskRay, steven_wu, dexonsmith, PkmX, dang, lenary, s.egerton, luismarques, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D78988 | 6 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[COFF] Assign unique identifiers to ObjFiles from LTO Use the unique filenames that are used when /lldsavetemps is passed. After this change, module names for LTO blobs in PDBs will be unique. Visual Studio and probably other debuggers expect module names to be unique. Revert some changes from 1e0b158db (2017) that are no longer necessary after removing MSVC LTO support. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D78221 | 6 年前 | |
Revert "[X86][LLD] Update datelayout in LLD tests. NFCI" This reverts commit 9b43237128da0a7a3bc8a16f6f2c0897b9e842be. | 4 年前 | |
[X86] Enable multibyte NOPs in 64-bit mode for padding/alignment. The default CPU used by llvm-mc doesn't have the NOPL feature, but if we know we're compiling in 64-bit mode we should be able to use nopl. | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[lld/COFF] Improve handling of the /manifestdependency: flag If multiple /manifestdependency: flags are passed, they are naively deduped, but after that each of them should have an effect, instead of just the last one. Also, /manifestdependency: flags are allowed in .drectve sections (from #pragma comment(linker, ...). To make the interaction between /manifestdependency: flags enabling manifest by default but /manifest:no overriding this work, add an explict ManifestKind::Default state to represent no explicit /manifest flag being passed. To make /manifestdependency: flags from input file .drectve sections work with /manifest:embed, delay embedded manifest emission until after input files have been read. Differential Revision: https://reviews.llvm.org/D108628 | 4 年前 | |
[test] Use host platform specific error message substitution in lit tests On z/OS, the following error message is not matched correctly in lit tests. EDC5129I No such file or directory. This patch uses a lit config substitution to check for platform specific error messages. Reviewed By: muiez, jhenderson Differential Revision: https://reviews.llvm.org/D95246 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Check errorCount before committing the output file This avoids producing an output file if errors appeared late in the linking process (e.g. while fixing relocations, or as in the test, while checking for multiple resources). If an output file is produced, build tools might not retry building it on rebuilds, even if a previous build failed due to the error return code. Differential Revision: https://reviews.llvm.org/D66491 llvm-svn: 369445 | 6 年前 | |
[test] lld/test/: change llvm-objdump single-dash long options to double-dash options | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Use host platform specific error message substitution in lit tests On z/OS, the following error message is not matched correctly in lit tests. EDC5129I No such file or directory. This patch uses a lit config substitution to check for platform specific error messages. Reviewed By: muiez, jhenderson Differential Revision: https://reviews.llvm.org/D95246 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] Add support for /noimplib Mostly for compatibility reasons with link.exe this flag makes sure we don't write a implib - not even when /implib is also passed, that's how link.exe works. Reviewed By: mstorsjo Differential Revision: https://reviews.llvm.org/D123591 | 4 年前 | |
[LLD] [MinGW] Implement the --no-seh flag Previously this flag was just ignored. If set, set the IMAGE_DLL_CHARACTERISTICS_NO_SEH bit, regardless of the normal safeSEH machinery. In mingw configurations, the safeSEH bit might not be set in e.g. object files built from handwritten assembly, making it impossible to use the normal safeseh flag. As mingw setups don't generally use SEH on 32 bit x86 at all, it should be fine to set that flag bit though - hook up the existing GNU ld flag for controlling that. Differential Revision: https://reviews.llvm.org/D84701 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Update LLD yaml test cases to include .bss size These yaml test cases appear to have been affected by PR41836 Right now what happens is that these empty .bss sections are merged into .data, then the .data output section ends up having a zero virtual size, and it is discarded from the output after addresses are assigned. However, we've already assigned OutputSections to Chunks, so we don't correctly report the zero-sized chunks that were in there as having been discarded. Soon, we will report them as discarded, so these test cases need to be updated to have a non-zero size so they aren't discarded. llvm-svn: 360476 | 7 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[PDB] Write FPO Data to the PDB. llvm-svn: 342003 | 7 年前 | |
Deduplicate S_CONSTANTs in LLD. Summary: Deduplicate S_CONSTANTS when linking, if they have the same value. Reviewers: rnk Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63151 llvm-svn: 363089 | 6 年前 | |
[DebugInfo][PDB] Don't write empty debug streams Before, empty debug streams were written as 8 bytes (4 bytes signature + 4 bytes for the GlobalRefs count). With this patch, unused empty streams aren't emitted anymore. Modules now encode 65535 as an 'unused stream' value, by convention. Also fix the * Linker * contrib section which wasn't correctly emitted previously. Differential Revision: https://reviews.llvm.org/D59502 llvm-svn: 356395 | 7 年前 | |
Re-land "[PDB] Merge types in parallel when using ghashing" Stored Error objects have to be checked, even if they are success values. This reverts commit 8d250ac3cd48d0f17f9314685a85e77895c05351. Relands commit 49b3459930655d879b2dc190ff8fe11c38a8be5f.. Original commit message: ----------------------------------------- This makes type merging much faster (-24% on chrome.dll) when multiple threads are available, but it slightly increases the time to link (+10%) when /threads:1 is passed. With only one more thread, the new type merging is faster (-11%). The output PDB should be identical to what it was before this change. To give an idea, here is the /time output placed side by side: BEFORE | AFTER Input File Reading: 956 ms | 968 ms Code Layout: 258 ms | 190 ms Commit Output File: 6 ms | 7 ms PDB Emission (Cumulative): 6691 ms | 4253 ms Add Objects: 4341 ms | 2927 ms Type Merging: 2814 ms | 1269 ms -55%! Symbol Merging: 1509 ms | 1645 ms Publics Stream Layout: 111 ms | 112 ms TPI Stream Layout: 764 ms | 26 ms trivial Commit to Disk: 1322 ms | 1036 ms -300ms ----------------------------------------- -------- Total Link Time: 8416 ms 5882 ms -30% overall The main source of the additional overhead in the single-threaded case is the need to iterate all .debug$T sections up front to check which type records should go in the IPI stream. See fillIsItemIndexFromDebugT. With changes to the .debug$H section, we could pre-calculate this info and eliminate the need to do this walk up front. That should restore single-threaded performance back to what it was before this change. This change will cause LLD to be much more parallel than it used to, and for users who do multiple links in parallel, it could regress performance. However, when the user is only doing one link, it's a huge improvement. In the future, we can use NT worker threads to avoid oversaturating the machine with work, but for now, this is such an improvement for the single-link use case that I think we should land this as is. Algorithm ---------- Before this change, we essentially used a DenseMap<GloballyHashedType, TypeIndex> to check if a type has already been seen, and if it hasn't been seen, insert it now and use the next available type index for it in the destination type stream. DenseMap does not support concurrent insertion, and even if it did, the linker must be deterministic: it cannot produce different PDBs by using different numbers of threads. The output type stream must be in the same order regardless of the order of hash table insertions. In order to create a hash table that supports concurrent insertion, the table cells must be small enough that they can be updated atomically. The algorithm I used for updating the table using linear probing is described in this paper, "Concurrent Hash Tables: Fast and General(?)!": https://dl.acm.org/doi/10.1145/3309206 The GHashCell in this change is essentially a pair of 32-bit integer indices: <sourceIndex, typeIndex>. The sourceIndex is the index of the TpiSource object, and it represents an input type stream. The typeIndex is the index of the type in the stream. Together, we have something like a ragged 2D array of ghashes, which can be looked up as: tpiSources[tpiSrcIndex]->ghashes[typeIndex] By using these side tables, we can omit the key data from the hash table, and keep the table cell small. There is a cost to this: resolving hash table collisions requires many more loads than simply looking at the key in the same cache line as the insertion position. However, most supported platforms should have a 64-bit CAS operation to update the cell atomically. To make the result of concurrent insertion deterministic, the cell payloads must have a priority function. Defining one is pretty straightforward: compare the two 32-bit numbers as a combined 64-bit number. This means that types coming from inputs earlier on the command line have a higher priority and are more likely to appear earlier in the final PDB type stream than types from an input appearing later on the link line. After table insertion, the non-empty cells in the table can be copied out of the main table and sorted by priority to determine the ordering of the final type index stream. At this point, item and type records must be separated, either by sorting or by splitting into two arrays, and I chose sorting. This is why the GHashCell must contain the isItem bit. Once the final PDB TPI stream ordering is known, we need to compute a mapping from source type index to PDB type index. To avoid starting over from scratch and looking up every type again by its ghash, we save the insertion position of every hash table insertion during the first insertion phase. Because the table does not support rehashing, the insertion position is stable. Using the array of insertion positions indexed by source type index, we can replace the source type indices in the ghash table cells with the PDB type indices. Once the table cells have been updated to contain PDB type indices, the mapping for each type source can be computed in parallel. Simply iterate the list of cell positions and replace them with the PDB type index, since the insertion positions are no longer needed. Once we have a source to destination type index mapping for every type source, there are no more data dependencies. We know which type records are "unique" (not duplicates), and what their final type indices will be. We can do the remapping in parallel, and accumulate type sizes and type hashes in parallel by type source. Lastly, TPI stream layout must be done serially. Accumulate all the type records, sizes, and hashes, and add them to the PDB. Differential Revision: https://reviews.llvm.org/D87805 | 5 年前 | |
[PDB] One more fix for hasing GSI records. The reference implementation uses a case-insensitive string comparison for strings of equal length. This will cause the string "tEo" to compare less than "VUo". However we were using a case sensitive comparison, which would generate the opposite outcome. Switch to a case insensitive comparison. Also, when one of the strings contains non-ascii characters, fallback to a straight memcmp. The only way to really test this is with a DIA test. Before this patch, the test will fail (but succeed if link.exe is used instead of lld-link). After the patch, it succeeds even with lld-link. llvm-svn: 336464 | 7 年前 | |
Relax filechecks in r336405 tests They were failing in Chromium's packaging builds with: C:\b\rr\tmphqfaff\w\src\third_party\llvm\tools\lld\test\COFF\pdb-globals-dia-vfunc-collision2.test:24:8: error: expected string not found in input CHECK: func [0x00001060+ 0 - 0x0000106c-12 | sizeof= 12] (FPO) virtual int __cdecl A132() ^ <stdin>:8:11: note: scanning from here struct S [sizeof = 8] { ^ <stdin>:9:2: note: possible intended match here func [0x00001060+ 0 - 0x0000106c-12 | sizeof= 12] (FPO) virtual int __cdecl S::A132() ^ Maybe due to different DIA versions. llvm-svn: 336424 | 7 年前 | |
Relax filechecks in r336405 tests They were failing in Chromium's packaging builds with: C:\b\rr\tmphqfaff\w\src\third_party\llvm\tools\lld\test\COFF\pdb-globals-dia-vfunc-collision2.test:24:8: error: expected string not found in input CHECK: func [0x00001060+ 0 - 0x0000106c-12 | sizeof= 12] (FPO) virtual int __cdecl A132() ^ <stdin>:8:11: note: scanning from here struct S [sizeof = 8] { ^ <stdin>:9:2: note: possible intended match here func [0x00001060+ 0 - 0x0000106c-12 | sizeof= 12] (FPO) virtual int __cdecl S::A132() ^ Maybe due to different DIA versions. llvm-svn: 336424 | 7 年前 | |
Relax filechecks in r336405 tests They were failing in Chromium's packaging builds with: C:\b\rr\tmphqfaff\w\src\third_party\llvm\tools\lld\test\COFF\pdb-globals-dia-vfunc-collision2.test:24:8: error: expected string not found in input CHECK: func [0x00001060+ 0 - 0x0000106c-12 | sizeof= 12] (FPO) virtual int __cdecl A132() ^ <stdin>:8:11: note: scanning from here struct S [sizeof = 8] { ^ <stdin>:9:2: note: possible intended match here func [0x00001060+ 0 - 0x0000106c-12 | sizeof= 12] (FPO) virtual int __cdecl S::A132() ^ Maybe due to different DIA versions. llvm-svn: 336424 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Update LLD tests for CodeView dumper change in r339907 llvm-svn: 339913 | 7 年前 | |
Disable GC and ICF when /debug is present ICF and GC impair debugging, so MSVC disables these optimizations when /debug is passed. They are still on by default when no PDB is produced. This change also makes /opt:ref enable ICF, which is consistent with MSVC: https://msdn.microsoft.com/en-us/library/bxwfs976.aspx We should consider making /opt:icf fold readonly data in the near future. LLD used to do this, but we disabled it because it breaks too many programs. MSVC only does this if the user explicitly passes /opt:icf. Reviewers: ruiu, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D39885 llvm-svn: 318071 | 8 年前 | |
[PDB] Copy inlinee lines records into the PDB Summary: - Fixes inline call frame line table display in windbg. - Improve llvm-pdbutil to dump extra file ids. - Warn on unknown subsections so we don't have this kind of bug in the future. Reviewers: inglorion, akhuang, aganea Subscribers: eraman, zturner, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62701 llvm-svn: 362429 | 6 年前 | |
[PDB] Copy inlinee lines records into the PDB Summary: - Fixes inline call frame line table display in windbg. - Improve llvm-pdbutil to dump extra file ids. - Warn on unknown subsections so we don't have this kind of bug in the future. Reviewers: inglorion, akhuang, aganea Subscribers: eraman, zturner, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D62701 llvm-svn: 362429 | 6 年前 | |
[PDB] Add missing test for b552adf8b388a4 | 5 年前 | |
[PDB] Fix linking of function symbols and local variables. The compiler outputs PROC32_ID symbols into the object files for functions, and these symbols have an embedded type index which, when copied to the PDB, refer to the IPI stream. However, the symbols themselves are also converted into regular symbols (e.g. S_GPROC32_ID -> S_GPROC32), and type indices in the regular symbol records refer to the TPI stream. So this patch applies two fixes to function records. 1. It converts ID symbols to the proper non-ID record type. 2. After remapping the type index from the object file's index space to the PDB file/IPI stream's index space, it then remaps that index to the TPI stream's index space by. Besides functions, during the remapping process we were also discarding symbol record types which we did not recognize. In particular, we were discarding S_BPREL32 records, which is what MSVC uses to describe local variables on the stack. So this patch fixes that as well by copying them to the PDB. Differential Revision: https://reviews.llvm.org/D36426 llvm-svn: 310394 | 8 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
[PDB] Quote linker arguments containing spaces (mimic MSVC) Initial patch by Will Wilson (@lantictac) Differential Revision: https://reviews.llvm.org/D55074 llvm-svn: 348001 | 7 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Re-land "[PDB] Merge types in parallel when using ghashing" Stored Error objects have to be checked, even if they are success values. This reverts commit 8d250ac3cd48d0f17f9314685a85e77895c05351. Relands commit 49b3459930655d879b2dc190ff8fe11c38a8be5f.. Original commit message: ----------------------------------------- This makes type merging much faster (-24% on chrome.dll) when multiple threads are available, but it slightly increases the time to link (+10%) when /threads:1 is passed. With only one more thread, the new type merging is faster (-11%). The output PDB should be identical to what it was before this change. To give an idea, here is the /time output placed side by side: BEFORE | AFTER Input File Reading: 956 ms | 968 ms Code Layout: 258 ms | 190 ms Commit Output File: 6 ms | 7 ms PDB Emission (Cumulative): 6691 ms | 4253 ms Add Objects: 4341 ms | 2927 ms Type Merging: 2814 ms | 1269 ms -55%! Symbol Merging: 1509 ms | 1645 ms Publics Stream Layout: 111 ms | 112 ms TPI Stream Layout: 764 ms | 26 ms trivial Commit to Disk: 1322 ms | 1036 ms -300ms ----------------------------------------- -------- Total Link Time: 8416 ms 5882 ms -30% overall The main source of the additional overhead in the single-threaded case is the need to iterate all .debug$T sections up front to check which type records should go in the IPI stream. See fillIsItemIndexFromDebugT. With changes to the .debug$H section, we could pre-calculate this info and eliminate the need to do this walk up front. That should restore single-threaded performance back to what it was before this change. This change will cause LLD to be much more parallel than it used to, and for users who do multiple links in parallel, it could regress performance. However, when the user is only doing one link, it's a huge improvement. In the future, we can use NT worker threads to avoid oversaturating the machine with work, but for now, this is such an improvement for the single-link use case that I think we should land this as is. Algorithm ---------- Before this change, we essentially used a DenseMap<GloballyHashedType, TypeIndex> to check if a type has already been seen, and if it hasn't been seen, insert it now and use the next available type index for it in the destination type stream. DenseMap does not support concurrent insertion, and even if it did, the linker must be deterministic: it cannot produce different PDBs by using different numbers of threads. The output type stream must be in the same order regardless of the order of hash table insertions. In order to create a hash table that supports concurrent insertion, the table cells must be small enough that they can be updated atomically. The algorithm I used for updating the table using linear probing is described in this paper, "Concurrent Hash Tables: Fast and General(?)!": https://dl.acm.org/doi/10.1145/3309206 The GHashCell in this change is essentially a pair of 32-bit integer indices: <sourceIndex, typeIndex>. The sourceIndex is the index of the TpiSource object, and it represents an input type stream. The typeIndex is the index of the type in the stream. Together, we have something like a ragged 2D array of ghashes, which can be looked up as: tpiSources[tpiSrcIndex]->ghashes[typeIndex] By using these side tables, we can omit the key data from the hash table, and keep the table cell small. There is a cost to this: resolving hash table collisions requires many more loads than simply looking at the key in the same cache line as the insertion position. However, most supported platforms should have a 64-bit CAS operation to update the cell atomically. To make the result of concurrent insertion deterministic, the cell payloads must have a priority function. Defining one is pretty straightforward: compare the two 32-bit numbers as a combined 64-bit number. This means that types coming from inputs earlier on the command line have a higher priority and are more likely to appear earlier in the final PDB type stream than types from an input appearing later on the link line. After table insertion, the non-empty cells in the table can be copied out of the main table and sorted by priority to determine the ordering of the final type index stream. At this point, item and type records must be separated, either by sorting or by splitting into two arrays, and I chose sorting. This is why the GHashCell must contain the isItem bit. Once the final PDB TPI stream ordering is known, we need to compute a mapping from source type index to PDB type index. To avoid starting over from scratch and looking up every type again by its ghash, we save the insertion position of every hash table insertion during the first insertion phase. Because the table does not support rehashing, the insertion position is stable. Using the array of insertion positions indexed by source type index, we can replace the source type indices in the ghash table cells with the PDB type indices. Once the table cells have been updated to contain PDB type indices, the mapping for each type source can be computed in parallel. Simply iterate the list of cell positions and replace them with the PDB type index, since the insertion positions are no longer needed. Once we have a source to destination type index mapping for every type source, there are no more data dependencies. We know which type records are "unique" (not duplicates), and what their final type indices will be. We can do the remapping in parallel, and accumulate type sizes and type hashes in parallel by type source. Lastly, TPI stream layout must be done serially. Accumulate all the type records, sizes, and hashes, and add them to the PDB. Differential Revision: https://reviews.llvm.org/D87805 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Re-land [CodeView] Add full repro to LF_BUILDINFO record This patch writes the full -cc1 command into the resulting .OBJ, like MSVC does. This allows for external tools (Recode, Live++) to rebuild a source file without any external dependency but the .OBJ itself (other than the compiler) and without knowledge of the build system. The LF_BUILDINFO record stores a full path to the compiler, the PWD (CWD at program startup), a relative or absolute path to the source, and the full CC1 command line. The stored command line is self-standing (does not depend on the environment). In the same way, MSVC doesn't exactly store the provided command-line, but an expanded version (a somehow equivalent of CC1) which is also self-standing. For more information see PR36198 and D43002. Differential Revision: https://reviews.llvm.org/D80833 | 4 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
COFF: Layout sections in the same order as link.exe One place where this seems to matter is to make sure the .rsrc section comes after .text. The Win32 UpdateResource() function can change the contents of .rsrc. It will move the sections that come after, but if .text gets moved, the entry point header will not get updated and the executable breaks. This was found by a test in Chromium. Differential Revision: https://reviews.llvm.org/D45260 llvm-svn: 329221 | 8 年前 | |
[LLD/PDB] Write actual records to the globals stream. Previously we were writing an empty globals stream. Windows tools interpret this as "private symbols are not present in this PDB", even when they are, so we need to fix this. Regardless, without it we don't have information about global variables, so we need to fix it anyway. This patch does that. With this patch, the "lm" command in WinDbg correctly reports that we have private symbols available, but the "dv" command still refuses to display local variables. Differential Revision: https://reviews.llvm.org/D36535 llvm-svn: 310743 | 8 年前 | |
Resubmit "Fix some incorrect fields in our generated PDBs." This fixes the failing tests. They simply hadn't been updated to match the new output resulting from this patch. llvm-svn: 330145 | 8 年前 | |
[PDB] Emit S_UDT records in LLD. Previously these were dropped. We now understand them sufficiently well to start emitting them. From the debugger's perspective, this now enables us to have debug info about typedefs (both global and function-locally scoped) Differential Revision: https://reviews.llvm.org/D55228 llvm-svn: 348306 | 7 年前 | |
[LTO] Suppress emission of empty combined module by default Summary: That unless the user requested an output object (--lto-obj-path), the an unused empty combined module is not emitted. This changed is helpful for some target (ex. RISCV-V) which encoded the ABI info in IR module flags (target-abi). Empty unused module has no ABI info so the linker would get the linking error during merging incompatible ABIs. Reviewers: tejohnson, espindola, MaskRay Subscribers: emaste, inglorion, arichardson, hiraditya, simoncook, MaskRay, steven_wu, dexonsmith, PkmX, dang, lenary, s.egerton, luismarques, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D78988 | 6 年前 | |
Update LLD tests for CodeView dumper change in r339907 llvm-svn: 339913 | 7 年前 | |
fix typo to cycle bots | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD][COFF] Fix TypeServerSource matcher with more than one collision Follow-up from 98bc304e9faded44f1d8988ffa4c5d8b50c759ec - while that commit fixed when you had two PDBs colliding on the same Guid it didn't fix the case where you had more than two PDBs using the same Guid. This commit fixes that and also tests much more carefully that all the types are correct no matter the order. Reviewed By: aganea, saudi Differential Revision: https://reviews.llvm.org/D123185 | 4 年前 | |
[LLD][COFF] Fix TypeServerSource matcher with more than one collision Follow-up from 98bc304e9faded44f1d8988ffa4c5d8b50c759ec - while that commit fixed when you had two PDBs colliding on the same Guid it didn't fix the case where you had more than two PDBs using the same Guid. This commit fixes that and also tests much more carefully that all the types are correct no matter the order. Reviewed By: aganea, saudi Differential Revision: https://reviews.llvm.org/D123185 | 4 年前 | |
[PDB] Check the type server guid when ghashing Previously we simply didn't check this. Prereq to make the test suite pass with ghash enabled by default. Differential Revision: https://reviews.llvm.org/D102885 | 5 年前 | |
[lld] Fixed CodeView GuidAdapter::format to handle GUID bytes in the right order. This fixes https://bugs.llvm.org/show_bug.cgi?id=41712 bug. Reviewed By: aganea Differential Revision: https://reviews.llvm.org/D99978 | 5 年前 | |
[lld] Fixed CodeView GuidAdapter::format to handle GUID bytes in the right order. This fixes https://bugs.llvm.org/show_bug.cgi?id=41712 bug. Reviewed By: aganea Differential Revision: https://reviews.llvm.org/D99978 | 5 年前 | |
[PDB] Enable parallel ghash type merging by default Ghashing is probably going to be faster in most cases, even without precomputed ghashes in object files. Here is my table of results linking clang.pdb: ------------------------------- | threads | GHASH | NOGHASH | ------------------------------- | j1 | 51.031s | 25.141s | | j2 | 31.079s | 22.109s | | j4 | 18.609s | 23.156s | | j8 | 11.938s | 21.984s | | j28 | 8.375s | 18.391s | ------------------------------- This shows that ghashing is faster if at least four cores are available. This may make the linker slower if most cores are busy in the middle of a build, but in that case, the linker probably isn't on the critical path of the build. Incremental build performance is arguably more important than highly contended batch build link performance. The -time output indicates that ghash computation is the dominant factor: Input File Reading: 924 ms ( 1.8%) GC: 689 ms ( 1.3%) ICF: 527 ms ( 1.0%) Code Layout: 414 ms ( 0.8%) Commit Output File: 24 ms ( 0.0%) PDB Emission (Cumulative): 49938 ms ( 94.8%) Add Objects: 46783 ms ( 88.8%) Global Type Hashing: 38983 ms ( 74.0%) GHash Type Merging: 5640 ms ( 10.7%) Symbol Merging: 2154 ms ( 4.1%) Publics Stream Layout: 188 ms ( 0.4%) TPI Stream Layout: 18 ms ( 0.0%) Commit to Disk: 2818 ms ( 5.4%) -------------------------------------------------- Total Link Time: 52669 ms (100.0%) We can speed that up with a faster content hash (not SHA1). Differential Revision: https://reviews.llvm.org/D102888 | 4 年前 | |
[LLD][COFF] Ignore DEBUG_S_XFGHASH_TYPE/VIRTUAL These are new debug types that ships with the latest Windows SDK and would warn and finally fail lld-link. The symbols seems to be related to Microsoft's XFG which is their version of CFG. We can't handle any of this yet, so for now we can just ignore these types so that lld doesn't fail with a new version of Windows SDK. Fixes: #56285 Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D129378 (cherry picked from commit 576375a2d670a7b1bd84b53b0187605a5f4ea0c8) | 3 年前 | |
[LLD][COFF] Ignore DEBUG_S_XFGHASH_TYPE/VIRTUAL These are new debug types that ships with the latest Windows SDK and would warn and finally fail lld-link. The symbols seems to be related to Microsoft's XFG which is their version of CFG. We can't handle any of this yet, so for now we can just ignore these types so that lld doesn't fail with a new version of Windows SDK. Fixes: #56285 Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D129378 (cherry picked from commit 576375a2d670a7b1bd84b53b0187605a5f4ea0c8) | 3 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Add "REQUIRES: x86" to test as it calls llc with an x86_64 triple. | 4 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Enable pdbpagesize to allow support for PDB file sizes > 4GB Enable the pdbpagesize flag to allow linking of PDB files > 4GB. Also includes a couple small fixes to change to uint64_t to support the larger file sizes. I updated the max file size check in MSFBuilder.cpp to take into account the page size. Differential Revision: https://reviews.llvm.org/D115051 | 4 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Handle comdat sections without leader symbols Discard them unless they have been associated by other means (yet uimplemented). According to MS link.exe, such sections are illegal, but MinGW setups use them in their take on associative comdats. This avoids leaving references to the bogus SectionChunk* PendingComdat, which cannot be dereferenced. This fixes PR38183. Differential Revision: https://reviews.llvm.org/D49653 llvm-svn: 338064 | 7 年前 | |
[PDB] Do not record PGO or coverage public symbols These symbols are long, and they tend to cause the PDB file size to overflow. They are generally not necessary when debugging problems in user code. This change reduces the size of chrome.dll.pdb with coverage from 6,937,108,480 bytes to 4,690,210,816 bytes. Differential Revision: https://reviews.llvm.org/D102719 | 5 年前 | |
[LTO][lld] Add lto-pgo-warn-mismatch option When enable CSPGO for ThinLTO, there are profile cfg mismatch warnings that will cause lld-link errors (with /WX) due to source changes (e.g. #if code runs for profile generation but not for profile use) To disable it we have to use an internal "/mllvm:-no-pgo-warn-mismatch" option. In contrast clang uses option ”-Wno-backend-plugin“ to avoid such warnings and gcc has an explicit "-Wno-coverage-mismatch" option. Add "lto-pgo-warn-mismatch" option to lld COFF/ELF to help turn on/off the profile mismatch warnings explicitly when build with ThinLTO and CSPGO. Differential Revision: https://reviews.llvm.org/D104431 | 4 年前 | |
Fix build after eaadb41db6233cf1c9e882d74a31c1f9d6e211ff when the MSVC libs are not in PATH. | 5 年前 | |
[PDB] Fix bug when using multiple PCH header objects with the same name. A common pattern in Windows is to have all your precompiled headers use an object named stdafx.obj. If you've got a project with many different static libs, you might use a separate PCH for each one of these. During the final link step, a file from A might reference the PCH object from A, but it will have the same name (stdafx.obj) as any other PCH from another project. The only difference will be the path. For example, A might be A/stdafx.obj while B is B/stdafx.obj. The existing algorithm checks only the filename that was passed on the command line (or stored in archive), but this is insufficient in the case where relative paths are used, because depending on the command line object file / library order, it might find the wrong PCH object first resulting in a signature mismatch. The fix here is to simply check whether the absolute path of the PCH object (which is stored in the input obj file for the file that references the PCH) *ends with* the full relative path of whatever is specified on the command line (or is in the archive). Differential Revision: https://reviews.llvm.org/D66431 llvm-svn: 374442 | 6 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[LLD][COFF] Add more type record information to /summary This adds the following two new lines to /summary: 21351 Input OBJ files (expanded from all cmd-line inputs) 61 PDB type server dependencies 38 Precomp OBJ dependencies 1420669231 Input type records <<<< 78665073382 Input type records bytes <<<< 8801393 Merged TPI records 3177158 Merged IPI records 59194 Output PDB strings 71576766 Global symbol records 25416935 Module symbol records 2103431 Public symbol records Differential Revision: https://reviews.llvm.org/D88703 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[lld] Add REQUIRES: x86 where needed to tests If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 llvm-svn: 334095 | 7 年前 | |
[lld] Add REQUIRES: x86 where needed to tests If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 llvm-svn: 334095 | 7 年前 | |
[lld] Add REQUIRES: x86 where needed to tests If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 llvm-svn: 334095 | 7 年前 | |
[COFF] Improve relocation against discarded section error Summary: Reuse the "referenced by" note diagnostic code that we already use for undefined symbols. In my case, it turned this: lld-link: error: relocation against symbol in discarded section: .text lld-link: error: relocation against symbol in discarded section: .text ... Into this: lld-link: error: relocation against symbol in discarded section: .text >>> referenced by libANGLE.lib(CompilerGL.obj):(.SCOVP$M) >>> referenced by libANGLE.lib(CompilerGL.obj):(.SCOVP$M) ... lld-link: error: relocation against symbol in discarded section: .text >>> referenced by obj/third_party/angle/libGLESv2/entry_points_egl_ext.obj:(.SCOVP$M) >>> referenced by obj/third_party/angle/libGLESv2/entry_points_egl_ext.obj:(.SCOVP$M) ... I think the new output is more useful. Reviewers: ruiu, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D54240 llvm-svn: 346427 | 7 年前 | |
[COFF] Bounds check relocations Summary: This would have caught the invalid object file I used in my test case in r307726. The OOB was only caught by ASan later, which is slow and doesn't work on some platforms. LLD should do some basic input validation itself. This check isn't perfect, so relocations can reach OOB by up to seven bytes, but it's better than what we had and probably cheap. Reviewers: ruiu Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D35371 llvm-svn: 307948 | 8 年前 | |
[LLD][COFF] PR49068: Include the IMAGE_REL_BASED_HIGHLOW relocation base type when the machine is 64 bits and the relocation type is ADDR32 The COFF driver produces an ABSOLUTE relocation base for an ADDR32 relocation type and the system is 64 bits (machine=AMD64). The relocation information won't be added in the output and could produce an incorrect address access during run-time. This change set checks if the relocation type is IMAGE_REL_AMD64_ADDR32 and if so, adds the relocated symbol as IMAGE_REL_BASED_HIGHLOW base. Differential Revision: https://reviews.llvm.org/D96619 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Avoid llvm-readelf/llvm-readobj one-dash long options and deprecated aliases (e.g. --file-headers) | 4 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Re-land "[PDB] Merge types in parallel when using ghashing" Stored Error objects have to be checked, even if they are success values. This reverts commit 8d250ac3cd48d0f17f9314685a85e77895c05351. Relands commit 49b3459930655d879b2dc190ff8fe11c38a8be5f.. Original commit message: ----------------------------------------- This makes type merging much faster (-24% on chrome.dll) when multiple threads are available, but it slightly increases the time to link (+10%) when /threads:1 is passed. With only one more thread, the new type merging is faster (-11%). The output PDB should be identical to what it was before this change. To give an idea, here is the /time output placed side by side: BEFORE | AFTER Input File Reading: 956 ms | 968 ms Code Layout: 258 ms | 190 ms Commit Output File: 6 ms | 7 ms PDB Emission (Cumulative): 6691 ms | 4253 ms Add Objects: 4341 ms | 2927 ms Type Merging: 2814 ms | 1269 ms -55%! Symbol Merging: 1509 ms | 1645 ms Publics Stream Layout: 111 ms | 112 ms TPI Stream Layout: 764 ms | 26 ms trivial Commit to Disk: 1322 ms | 1036 ms -300ms ----------------------------------------- -------- Total Link Time: 8416 ms 5882 ms -30% overall The main source of the additional overhead in the single-threaded case is the need to iterate all .debug$T sections up front to check which type records should go in the IPI stream. See fillIsItemIndexFromDebugT. With changes to the .debug$H section, we could pre-calculate this info and eliminate the need to do this walk up front. That should restore single-threaded performance back to what it was before this change. This change will cause LLD to be much more parallel than it used to, and for users who do multiple links in parallel, it could regress performance. However, when the user is only doing one link, it's a huge improvement. In the future, we can use NT worker threads to avoid oversaturating the machine with work, but for now, this is such an improvement for the single-link use case that I think we should land this as is. Algorithm ---------- Before this change, we essentially used a DenseMap<GloballyHashedType, TypeIndex> to check if a type has already been seen, and if it hasn't been seen, insert it now and use the next available type index for it in the destination type stream. DenseMap does not support concurrent insertion, and even if it did, the linker must be deterministic: it cannot produce different PDBs by using different numbers of threads. The output type stream must be in the same order regardless of the order of hash table insertions. In order to create a hash table that supports concurrent insertion, the table cells must be small enough that they can be updated atomically. The algorithm I used for updating the table using linear probing is described in this paper, "Concurrent Hash Tables: Fast and General(?)!": https://dl.acm.org/doi/10.1145/3309206 The GHashCell in this change is essentially a pair of 32-bit integer indices: <sourceIndex, typeIndex>. The sourceIndex is the index of the TpiSource object, and it represents an input type stream. The typeIndex is the index of the type in the stream. Together, we have something like a ragged 2D array of ghashes, which can be looked up as: tpiSources[tpiSrcIndex]->ghashes[typeIndex] By using these side tables, we can omit the key data from the hash table, and keep the table cell small. There is a cost to this: resolving hash table collisions requires many more loads than simply looking at the key in the same cache line as the insertion position. However, most supported platforms should have a 64-bit CAS operation to update the cell atomically. To make the result of concurrent insertion deterministic, the cell payloads must have a priority function. Defining one is pretty straightforward: compare the two 32-bit numbers as a combined 64-bit number. This means that types coming from inputs earlier on the command line have a higher priority and are more likely to appear earlier in the final PDB type stream than types from an input appearing later on the link line. After table insertion, the non-empty cells in the table can be copied out of the main table and sorted by priority to determine the ordering of the final type index stream. At this point, item and type records must be separated, either by sorting or by splitting into two arrays, and I chose sorting. This is why the GHashCell must contain the isItem bit. Once the final PDB TPI stream ordering is known, we need to compute a mapping from source type index to PDB type index. To avoid starting over from scratch and looking up every type again by its ghash, we save the insertion position of every hash table insertion during the first insertion phase. Because the table does not support rehashing, the insertion position is stable. Using the array of insertion positions indexed by source type index, we can replace the source type indices in the ghash table cells with the PDB type indices. Once the table cells have been updated to contain PDB type indices, the mapping for each type source can be computed in parallel. Simply iterate the list of cell positions and replace them with the PDB type index, since the insertion positions are no longer needed. Once we have a source to destination type index mapping for every type source, there are no more data dependencies. We know which type records are "unique" (not duplicates), and what their final type indices will be. We can do the remapping in parallel, and accumulate type sizes and type hashes in parallel by type source. Lastly, TPI stream layout must be done serially. Accumulate all the type records, sizes, and hashes, and add them to the PDB. Differential Revision: https://reviews.llvm.org/D87805 | 5 年前 | |
[COFF] Improve synthetic symbol handling Summary: The main change is that we can have SECREL and SECTION relocations against ___safe_se_handler_table, which is important for handling the debug info in the MSVCRT. Previously we were using DefinedRelative for __safe_se_handler_table and __ImageBase, and after we implement CFGuard, we plan to extend it to handle __guard_fids_table, __guard_longjmp_table, and more. However, DefinedRelative is really only suitable for implementing __ImageBase, because it lacks a Chunk, which you need in order to figure out the output section index and output section offset when resolving SECREl and SECTION relocations. This change renames DefinedRelative to DefinedSynthetic and gives it a Chunk. One wart is that __ImageBase doesn't have a chunk. It points to the PE header, effectively. We could split DefinedRelative and DefinedSynthetic if we think that's cleaner and creates fewer special cases. I also added safeseh.s, which checks that we don't emit a safe seh table entries pointing to garbage collected handlers and that we don't emit a table at all when there are no handlers. Reviewers: ruiu Reviewed By: ruiu Subscribers: inglorion, pcc, llvm-commits, aprantl Differential Revision: https://reviews.llvm.org/D34577 llvm-svn: 306293 | 8 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
Add REQUIRES: x86 to safeseh-no.s test for x86 llvm-svn: 366273 | 6 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[llvm-objdump] Print file format in lowercase to match GNU output. Summary: GNU objdump prints the file format in lowercase, e.g. elf64-x86-64. llvm-objdump prints ELF64-x86-64 right now, even though piping that into llvm-objcopy refuses that as a valid arch to use. As an example of a problem this causes, see: https://github.com/ClangBuiltLinux/linux/issues/779 Reviewers: MaskRay, jhenderson, alexshap Reviewed By: MaskRay Subscribers: tpimh, sbc100, grimar, jvesely, nhaehnle, kerbowa, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D74433 | 6 年前 | |
[COFF][test] Fix llvm-readobj tests | 4 年前 | |
[lld] Add REQUIRES: x86 where needed to tests If building lld without x86 support, tests that require that support should be treated as unsupported, not errors. Tested using: 1. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64;X86' make check-lld => Expected Passes : 1406 Unsupported Tests : 287 2. cmake '-DLLVM_TARGETS_TO_BUILD=AArch64' make check-lld => Expected Passes : 410 Unsupported Tests : 1283 Patch by Joel Jones Differential Revision: https://reviews.llvm.org/D47748 llvm-svn: 334095 | 7 年前 | |
[COFF][test] Fix llvm-readobj tests | 4 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
COFF: Merge .bss into .data by default. Differential Revision: https://reviews.llvm.org/D45803 llvm-svn: 330483 | 8 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD] [COFF] Order .debug_* sections at the end, to avoid leaving gaps if stripped So far, we sort all discardable sections at the end, with only some extra logic to make sure that the .reloc section is at the start of that group of sections. But if there are other discardable sections, other than .reloc, they must also be ordered before .debug_* sections, to avoid leaving gaps if the executable is stripped. (Stripping executables doesn't remove all discardable sections, only the ones named .debug_*). Rust binaries seem to include a .rmeta section, which is marked discardable. This fixes stripping such binaries if built with dwarf debug info included. This fixes issues observed in MSYS2 in https://github.com/msys2/MINGW-packages/pull/10555. Differential Revision: https://reviews.llvm.org/D120805 | 4 年前 | |
Allow /STACK in #pragma comment(linker, ...) The Halide project uses #pragma comment(linker, "/STACK:...") to set the stack size high enough for our embedded compiler to run in end-user programs on Windows. Unfortunately, lld-link.exe breaks on this when embedded in a COFF object, despite supporting the flag on the command line. MSVC's link.exe supports this fine. This patch extends support for this to lld-link.exe for better compatibility with MSVC projects. Differential Revision: https://reviews.llvm.org/D99680 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
reland "[lld-link] implement -start-lib and -end-lib" Summary: This is a re-land of r370487 with a fix for the use-after-free bug that rev contained. This implements -start-lib and -end-lib flags for lld-link, analogous to the similarly named options in ld.lld. Object files after -start-lib are included in the link only when needed to resolve undefined symbols. The -end-lib flag goes back to the normal behavior of always including object files in the link. This mimics the semantics of static libraries, but without needing to actually create the archive file. Reviewers: ruiu, smeenai, MaskRay Reviewed By: ruiu, MaskRay Subscribers: akhuang, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D66848 llvm-svn: 370816 | 6 年前 | |
[lld][test] Make tests pass when the test directory matches bar Reviewed By: jhenderson, MaskRay Differential Revision: https://reviews.llvm.org/D72360 | 6 年前 | |
COFF: Add a flag for disabling string tail merging. We discovered (crbug.com/838449#c24) that string tail merging can negatively affect compressed binary size, so provide a flag to turn it off for users who care more about compressed size than uncompressed size. Differential Revision: https://reviews.llvm.org/D46780 llvm-svn: 332149 | 7 年前 | |
[LLD] [COFF] Omit section symbols and IMAGE_SYM_CLASS_LABEL from the PE symbol table The section symbols aren't of much practical use when looking at a linked image. This shrinks one observed mingw style unstripped binary by 14%. IMAGE_SYM_CLASS_LABEL is in spirit the same as a temporary assembler label that isn't emitted on the object file level at all. Differential Revision: https://reviews.llvm.org/D113866 | 4 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[COFF] Allow setting subsystem versions while inferring the subsystem type implicitly Differential Revision: https://reviews.llvm.org/D63248 llvm-svn: 363431 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[COFF] Implement /safeseh:no and check @feat.00 flags by default Summary: Fixes PR41828. Before this, LLD always emitted SafeSEH chunks and defined __safe_se_handler_table & size. Now, /safeseh:no leaves those undefined. Additionally, we were checking for the safeseh @feat.00 flag in two places: once to emit errors, and once during safeseh table construction. The error was set up to be off by default, but safeseh is supposed to be on by default. I combined the two checks, so now LLD emits an error if an input object lacks @feat.00 and safeseh is enabled. This caused the majority of 32-bit LLD tests to fail, since many test input object files lack @feat.00 symbols. I explicitly added -safeseh:no to those tests to preserve behavior. Finally, LLD no longer sets IMAGE_DLL_CHARACTERISTICS_NO_SEH if any input file wasn't compiled for safeseh. Reviewers: mstorsjo, ruiu, thakis Reviewed By: ruiu, thakis Subscribers: llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63570 llvm-svn: 366238 | 6 年前 | |
[LLD] [COFF] Add a private option for setting the os version separately from subsystem version The MinGW driver has separate options for OS and subsystem version. Having this available in lld-link allows the MinGW driver to both match GNU ld better and simplifies the code for merging two (potentially mismatching) arguments into one. Differential Revision: https://reviews.llvm.org/D88802 | 5 年前 | |
[llvm-symbolizer] Fix line offset for inline site. This fixes the issue when the current line offset is actually for next range. Maintain a current code range with current line offset and cache next file/line offset. Update file/line offset after finishing current range. Differential Revision: https://reviews.llvm.org/D123151 | 4 年前 | |
[llvm-symbolizer][Windows] Add start line when searching in line table sections. Fixes issue where if a line section doesn't start with a line number then the addresses at the beginning of the section don't have line numbers. For example, for a line section like this 0001:00000010-00000014, line/column/addr entries = 1 7 00000013 ! a line number wouldn't be found for addresses from 10 to 12. This matches behavior when using the DIA SDK. Differential Revision: https://reviews.llvm.org/D93306 | 5 年前 | |
[test] Change llvm-readobj -long-option to --long-option or well-known short options. NFC Also change some options that have different semantics (cause confusion) in llvm-readelf mode: -s => -S -t => --symbols -sd => --section-data llvm-svn: 359651 | 7 年前 | |
[LLD] [COFF] Omit section symbols and IMAGE_SYM_CLASS_LABEL from the PE symbol table The section symbols aren't of much practical use when looking at a linked image. This shrinks one observed mingw style unstripped binary by 14%. IMAGE_SYM_CLASS_LABEL is in spirit the same as a temporary assembler label that isn't emitted on the object file level at all. Differential Revision: https://reviews.llvm.org/D113866 | 4 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[test] Use host platform specific error message substitution in lit tests - continued On z/OS, other error messages are not matched correctly in lit tests. EDC5121I Invalid argument. EDC5111I Permission denied. This patch adds a lit substitution to fix it. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D95808 | 5 年前 | |
[ThinLTO] Compute the basic block count across modules. Summary: Count the per-module number of basic blocks when the module summary is computed and sum them up during Thin LTO indexing. This is used to estimate the working set size under the partial sample PGO. This is split off of D79831. Reviewers: davidxl, espindola Subscribers: emaste, inglorion, hiraditya, MaskRay, steven_wu, dexonsmith, arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80403 | 5 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
Re-land [ThinLTO] Re-order modules for optimal multi-threaded processing This reverts 9b5b3050237db3642ed7ab1bdb3ffa2202511b99 and fixes the unwanted re-ordering when generating ThinLTO indexes. The goal of this patch is to better balance thread utilization during ThinLTO in-process linking (in llvm-lto2 or in LLD). Before this patch, large modules would often be scheduled late during execution, taking a long time to complete, thus starving the thread pool. We now sort modules in descending order, based on each module's bitcode size, so that larger modules are processed first. By doing so, smaller modules have a better chance to keep the thread pool active, and thus avoid starvation when the bitcode compilation is almost complete. In our case (on dual Intel Xeon Gold 6140, Windows 10 version 2004, two-stage build), this saves 15 sec when linking clang.exe with LLD & -flto=thin, /opt:lldltojobs=all, no ThinLTO cache, -DLLVM_INTEGRATED_CRT_ALLOC=d:\git\rpmalloc. Before patch: 100 sec After patch: 85 sec Inspired by the work done by David Callahan in D60495. Differential Revision: https://reviews.llvm.org/D87966 | 5 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[LLD][COFF] Add index to disambiguate archive members when using -wholearchive Patch by Markus Böck. PR42951: When linking an archive with members that have the same name linking fails when using the -wholearchive option. This patch passes the index of the member in the archive to the offset parameter to disambiguate the member. Differential Revision: https://reviews.llvm.org/D66239 llvm-svn: 371509 | 6 年前 | |
[COFF] Assign unique identifiers to ObjFiles from LTO Use the unique filenames that are used when /lldsavetemps is passed. After this change, module names for LTO blobs in PDBs will be unique. Visual Studio and probably other debuggers expect module names to be unique. Revert some changes from 1e0b158db (2017) that are no longer necessary after removing MSVC LTO support. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D78221 | 6 年前 | |
[LLD][COFF] When using LLD-as-a-library, always prevent re-entrance on failures This is a follow-up for D70378 (Cover usage of LLD as a library). While debugging an intermittent failure on a bot, I recalled this scenario which causes the issue: 1.When executing lld/test/ELF/invalid/symtab-sh-info.s L45, we reach lld::elf::Obj-File::ObjFile() which goes straight into its base ELFFileBase(), then ELFFileBase::init(). 2.At that point fatal() is thrown in lld/ELF/InputFiles.cpp L381, leaving a half-initialized ObjFile instance. 3.We then end up in lld::exitLld() and since we are running with LLD_IN_TEST, we hapily restore the control flow to CrashRecoveryContext::RunSafely() then back in lld::safeLldMain(). 4.Before this patch, we called errorHandler().reset() just after, and this attempted to reset the associated SpecificAlloc<ObjFile<ELF64LE>>. That tried to free the half-initialized ObjFile instance, and more precisely its ObjFile::dwarf member. Sometimes that worked, sometimes it failed and was catched by the CrashRecoveryContext. This scenario was the reason we called errorHandler().reset() through a CrashRecoveryContext. But in some rare cases, the above repro somehow corrupted the heap, creating a stack overflow. When the CrashRecoveryContext's filter (that is, __except (ExceptionFilter(GetExceptionInformation()))) tried to handle the exception, it crashed again since the stack was exhausted -- and that took the whole application down. That is the issue seen on the bot. Locally it happens about 1 times out of 15. Now this situation can happen anywhere in LLD. Since catching stack overflows is not a reliable scenario ATM when using CrashRecoveryContext, we're now preventing further re-entrance when such failures occur, by signaling lld::SafeReturn::canRunAgain=false. When running with LLD_IN_TEST=2 (or above), only one iteration will be executed, instead of two. Differential Revision: https://reviews.llvm.org/D88348 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[LLD] Set alignment as part of Characteristics in TLS table. Fixes https://bugs.llvm.org/show_bug.cgi?id=46473 LLD wasn't previously specifying any specific alignment in the TLS table's Characteristics field so the loader would just assume the default value (16 bytes). This works most of the time except if you have thread locals that want specific higher alignments (e.g. 32 as in the bug) *even* if they specify an alignment on the thread local. This change updates LLD to take the max alignment from tls section. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D88637 | 5 年前 | |
[LLD] Set alignment as part of Characteristics in TLS table. Fixes https://bugs.llvm.org/show_bug.cgi?id=46473 LLD wasn't previously specifying any specific alignment in the TLS table's Characteristics field so the loader would just assume the default value (16 bytes). This works most of the time except if you have thread locals that want specific higher alignments (e.g. 32 as in the bug) *even* if they specify an alignment on the thread local. This change updates LLD to take the max alignment from tls section. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D88637 | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Fix the test from the previous commit when run on windows. NFC. Apparently the escaped dollar sign didn't work the same way in "echo -e" on windows buildbots. llvm-svn: 366784 | 6 年前 | |
lld-link: Only print demangled symbol names by default This makes lld-link's output a bit more concise. Since most developers can't read mangled names, this should make the output a bit easier to understand as well. It also makes lld-link's output consistent with ld.lld's output. (link.exe prints both demangled and mangled names; lld-link used to match link.exe output but now no longer does.) For people working on toolchains, add a /demangle:no flag that makes lld-link print the mangled name instead of the demangled name. (If desired, people could pipe that through demumble -b to get the old behavior of both demangled and mangled output.) Differential Revision: https://reviews.llvm.org/D58132 llvm-svn: 355878 | 7 年前 | |
Revert "[DebugInfo] Remove dots from getFilenameByIndex return value" This is failing on Windows bots due to path separator normalization. This reverts commit 042c23506869b4ae9a49d2c4bc5ea6e6baeabe78. | 5 年前 | |
[LLD] [COFF] Always demangle the __imp_ prefix to __declspec(dllimport) Differential Revision: https://reviews.llvm.org/D68017 llvm-svn: 373781 | 6 年前 | |
[LLD] [COFF] Demangle itanium symbols in mingw mode Differential Revision: https://reviews.llvm.org/D67051 llvm-svn: 370654 | 6 年前 | |
Mark new test as requiring an x86 backend for LTO native object generation llvm-svn: 366245 | 6 年前 | |
[LLD][COFF] Skip computation of the undefined symbols references that are not shown The "undefined symbol" error message from lld-link displays up to 3 references to that symbol, and the number of extra references not shown. This patch removes the computation of the strings for those extra references. It fixes a freeze of lld-link we accidentally encountered when activating asan on a large project, without linking with the asan library. In that case, __asan_report_load8 was referenced more than 2 million times, causing the computation of that many display strings, of which only 3 were used. Differential Revision: https://reviews.llvm.org/D83510 | 5 年前 | |
[LLD] [COFF] Always demangle the __imp_ prefix to __declspec(dllimport) Differential Revision: https://reviews.llvm.org/D68017 llvm-svn: 373781 | 6 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
Reland "Change the X86 datalayout to add three address spaces for 32 bit signed, 32 bit unsigned, and 64 bit pointers." This reverts 57076d3199fc2b0af4a3736b7749dd5462cacda5. Original review at https://reviews.llvm.org/D64931. Review for added fix at https://reviews.llvm.org/D66843. llvm-svn: 371568 | 6 年前 | |
[LLD] [COFF] Fix parsing version numbers with leading zeros Parse the components as decimal, instead of decuding the base from the string. This avoids ambiguity if the second number contains leading zeros, which previously were parsed as indicating an octal number. MS link.exe doesn't support hexadecimal numbers in the version numbers, neither in /version nor in /subsystem. Differential Revision: https://reviews.llvm.org/D88801 | 5 年前 | |
Fix build on Windows It seems like the sed on Windows is not particularly smart. It's not actually needed in this place, so I've removed it's usage and just created an invalid yaml another way. | 3 年前 | |
[LLD][COFF] Convert file name to lowercase when inserting it into visitedLibs It seems to be a bug in LinkerDriver::findFile, the file name is not converted to lowercase when being inserted into visitedLibs. This is the only exception in the file and all other places always convert file names to lowercase when inserting them into visitedLibs (or visitedFiles). Reviewed By: thieta, hans Differential Revision: https://reviews.llvm.org/D127709 | 3 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[test] Replace yaml2obj > with yaml2obj -o and remove unneeded input redirection | 5 年前 | |
[lld-link] Tweak winsysroottest.test to have passing links on happy path Previously, the test checked for a "undefined symbol" error (instead of the "could not open std*.lib" which would happen without the flag). Instead, use /entry: so that the link succeeds. No behavior change, but maybe makes the test a bit easier to understand. Differential Revision: https://reviews.llvm.org/D121553 | 4 年前 | |
[LLD] [COFF] Allow wrapping dllimported functions GNU ld doesn't seem to do this though, but it looks like a reasonable use case, is easy to implement, and was requested in https://bugs.llvm.org/show_bug.cgi?id=47384. Differential Revision: https://reviews.llvm.org/D91689 | 5 年前 | |
Reapply [LLD] [COFF] Implement a GNU/ELF like -wrap option Add a simple forwarding option in the MinGW frontend, and implement the private -wrap option in the COFF linker. The feature in lld-link isn't gated by the -lldmingw option, but the option is left as a private, undocumented option primarily used by the MinGW driver. The implementation is significantly based on the support for --wrap in the ELF linker, but many small nuance details are different between the ELF and COFF linkers, ending up with more than a few implementation differences. This fixes https://bugs.llvm.org/show_bug.cgi?id=47384. Differential Revision: https://reviews.llvm.org/D89004 Reapplied with the bitfield member canInline fixed so it doesn't break builds targeting windows. | 5 年前 | |
[LLD] [COFF] Allow wrapping dllimported functions GNU ld doesn't seem to do this though, but it looks like a reasonable use case, is easy to implement, and was requested in https://bugs.llvm.org/show_bug.cgi?id=47384. Differential Revision: https://reviews.llvm.org/D91689 | 5 年前 | |
Reapply [LLD] [COFF] Implement a GNU/ELF like -wrap option Add a simple forwarding option in the MinGW frontend, and implement the private -wrap option in the COFF linker. The feature in lld-link isn't gated by the -lldmingw option, but the option is left as a private, undocumented option primarily used by the MinGW driver. The implementation is significantly based on the support for --wrap in the ELF linker, but many small nuance details are different between the ELF and COFF linkers, ending up with more than a few implementation differences. This fixes https://bugs.llvm.org/show_bug.cgi?id=47384. Differential Revision: https://reviews.llvm.org/D89004 Reapplied with the bitfield member canInline fixed so it doesn't break builds targeting windows. | 5 年前 | |
[test] Fix unuses FileCheck prefixes in lld | 5 年前 | |
fix typos to cycle bots | 4 年前 | |
Reapply [LLD] [COFF] Implement a GNU/ELF like -wrap option Add a simple forwarding option in the MinGW frontend, and implement the private -wrap option in the COFF linker. The feature in lld-link isn't gated by the -lldmingw option, but the option is left as a private, undocumented option primarily used by the MinGW driver. The implementation is significantly based on the support for --wrap in the ELF linker, but many small nuance details are different between the ELF and COFF linkers, ending up with more than a few implementation differences. This fixes https://bugs.llvm.org/show_bug.cgi?id=47384. Differential Revision: https://reviews.llvm.org/D89004 Reapplied with the bitfield member canInline fixed so it doesn't break builds targeting windows. | 5 年前 | |
Reapply [LLD] [COFF] Implement a GNU/ELF like -wrap option Add a simple forwarding option in the MinGW frontend, and implement the private -wrap option in the COFF linker. The feature in lld-link isn't gated by the -lldmingw option, but the option is left as a private, undocumented option primarily used by the MinGW driver. The implementation is significantly based on the support for --wrap in the ELF linker, but many small nuance details are different between the ELF and COFF linkers, ending up with more than a few implementation differences. This fixes https://bugs.llvm.org/show_bug.cgi?id=47384. Differential Revision: https://reviews.llvm.org/D89004 Reapplied with the bitfield member canInline fixed so it doesn't break builds targeting windows. | 5 年前 | |
lld, llvm-dlltool, llvm-lib: Use getAsString() instead of getSpelling() for printing unknown args Since OPT_UNKNOWN args never have any values and consist only of spelling (and are never aliased), this doesn't make any difference in practice, but it's more consistent with Arg's guidance to use getAsString() for diagnostics, and it matches what clang does. Also tweak two tests to use an unknown option that contains '=' for additional coverage while here. (The new tests pass fine with the old code too though.) llvm-svn: 365200 | 6 年前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 4 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 7 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 8 年前 | ||
| 3 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 9 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 8 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 4 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 9 年前 | ||
| 3 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 8 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 4 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 10 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 4 年前 | ||
| 4 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 4 年前 | ||
| 4 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 8 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 4 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 4 年前 | ||
| 6 年前 | ||
| 4 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 8 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 8 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 8 年前 | ||
| 8 年前 | ||
| 8 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 8 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 8 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 4 年前 | ||
| 7 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 8 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 7 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 7 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 6 年前 | ||
| 5 年前 | ||
| 3 年前 | ||
| 3 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 4 年前 | ||
| 5 年前 | ||
| 5 年前 | ||
| 6 年前 |