1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00
llvm-mirror/lib/Object
Nico Weber 1aeeff713a lld-link: Reject more than one resource .obj file
Users are exepcted to pass all .res files to the linker, which then
merges all the resource in all .res files into a tree structure and then
converts the final tree structure to a .obj file with .rsrc$01 and
.rsrc$02 sections and then links that.

If the user instead passes several .obj files containing such resources,
the correct thing to do would be to have custom code to merge the trees
in the resource sections instead of doing normal section merging -- but
link.exe rejects if multiple resource obj files are passed in with
LNK4078, so let lld-link do that too instead of silently writing broken
.rsrc sections in that case.

The only real way to run into this is if users manually convert .res
files to .obj files by running cvtres and then handing the resulting
.obj files to lld-link instead, which in practice likely never happens.

(lld-link is slightly stricter than link.exe now: If link.exe is passed
one .obj file created by cvtres, and a .res file, for some reason it
just emits a warning instead of an error and outputs strange looking
data. lld-link now errors out on mixed input like this.)

One way users could accidentally run into this is the following
scenario: If a .res file is passed to lib.exe, then lib.exe calls
cvtres.exe on the .res file before putting it in the output .lib.
(llvm-lib currently doesn't do this.)
link.exe's /wholearchive seems to only add obj files referenced from the
static library index, but lld-link current really adds all files in the
archive. So if lld-link /wholearchive is used with .lib files produced
by lib.exe and .res files were among the files handed to lib.exe, we
previously silently produced invalid output, but now we error out.

link.exe's /wholearchive semantics on the other hand mean that it
wouldn't load the resource object files from the .lib file at all.
Since this scenario is probably still an unlikely corner case,
the difference in behavior here seems fine -- and lld-link might have to
change to use link.exe's /wholearchive semantics in the future anyways.

Vaguely related to PR42180.

Differential Revision: https://reviews.llvm.org/D63109

llvm-svn: 363078
2019-06-11 15:22:28 +00:00
..
Archive.cpp [libObject][NFC] Include filename in error message 2019-02-06 20:51:04 +00:00
ArchiveWriter.cpp [llvm-ar] Reapply Fix relative thin archive path handling 2019-06-04 10:13:03 +00:00
Binary.cpp [XCOFF] Add functionality for parsing AIX XCOFF object file headers 2019-04-04 00:53:21 +00:00
CMakeLists.txt [XCOFF] Add functionality for parsing AIX XCOFF object file headers 2019-04-04 00:53:21 +00:00
COFFImportFile.cpp [llvm-dlltool] Respect NONAME keyword 2019-05-22 09:49:54 +00:00
COFFModuleDefinition.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
COFFObjectFile.cpp [Object] Change ObjectFile::getSectionContents to return Expected<ArrayRef<uint8_t>> 2019-05-14 04:22:51 +00:00
Decompressor.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ELF.cpp [AArch64][ELF][llvm-readobj] Add support for BTI and PAC dynamic tags 2019-06-04 11:44:33 +00:00
ELFObjectFile.cpp [ARM] add target arch definitions for 8.1-M and MVE 2019-05-30 12:57:04 +00:00
Error.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
IRObjectFile.cpp Recommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef> 2019-05-16 13:24:04 +00:00
IRSymtab.cpp [ELF] Implement Dependent Libraries Feature 2019-05-17 03:44:15 +00:00
LLVMBuild.txt Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
MachOObjectFile.cpp [MACHO] Replaced calls to getStruct with getStructOrErr in functions returning Error or Expected or similar 2019-06-04 16:55:30 +00:00
MachOUniversal.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Minidump.cpp Minidump: Add support for the MemoryList stream 2019-05-16 15:17:30 +00:00
ModuleSymbolTable.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Object.cpp [LLVM-C] Add Accessor for Mach-O Universal Binary Slices 2019-05-25 16:47:27 +00:00
ObjectFile.cpp [Object] Change SymbolicFile::printSymbolName to use Error 2019-05-10 09:59:04 +00:00
RecordStreamer.cpp [AsmPrinter] Remove hidden flag -print-schedule. 2019-02-04 12:51:26 +00:00
RecordStreamer.h [AsmPrinter] Remove hidden flag -print-schedule. 2019-02-04 12:51:26 +00:00
RelocationResolver.cpp [DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries 2019-03-22 02:43:11 +00:00
SymbolicFile.cpp [XCOFF] Add functionality for parsing AIX XCOFF object file headers 2019-04-04 00:53:21 +00:00
SymbolSize.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
WasmObjectFile.cpp [Object] Change ObjectFile::getSectionContents to return Expected<ArrayRef<uint8_t>> 2019-05-14 04:22:51 +00:00
WindowsResource.cpp lld-link: Reject more than one resource .obj file 2019-06-11 15:22:28 +00:00
XCOFFObjectFile.cpp [XCOFF] Implement parsing symbol table for xcoffobjfile and output as yaml format 2019-05-28 14:37:59 +00:00