To get this more correct we need to plumb a few additional values through, such as the argv0 and the command line. I need to get that done before I commit this, but throwing this up for early comments.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lld/COFF/PDB.cpp | ||
---|---|---|
411 ↗ | (On Diff #105706) | Is this value the same on x86-64? |
lld/COFF/PDB.cpp | ||
---|---|---|
411 ↗ | (On Diff #105706) | That's a good question, I should check. |
Update the test to properly check for x64, and finish up the remaining missing pieces. In particular, we need the value of argv[0] in order to portably get the executable name, and we need the values of argv[1] - argv[argc-1] in order to write them to the S_ENVBLOCK symbol. To address this, I deleted the global Argv0 variable that LLD currently used, and instead stored the entire argv array in the global configuration object.
I also added a test. Unfortunately checking for paths is pretty obnoxious in tests, requiring some magic sed incantation, so I've just regex'ed them all out in this test. Perhaps someone else can do better here.
lld/COFF/PDB.cpp | ||
---|---|---|
411 ↗ | (On Diff #105706) | Probably dumb question: what about ARM (and AArch64 in the future)? |
lld/COFF/Config.h | ||
---|---|---|
95 ↗ | (On Diff #105903) | In order to make it ArrayRef I have to make it ArrayRef<const char *>. This is what I had in an earlier version of the patch, but I had problems on the call to llvm::join() (because you can't use operator+ on two const char*. So if I want to be able to use StringRef, it has to be std::vector |
lld/COFF/PDB.cpp | ||
411 ↗ | (On Diff #105706) | Whoever's interested in adding PDB support for ARM and AArch64` can update this code :) The CPUType enumeration has a bunch of ARM values in the enumeration: ARM3 = 0x60, ARM4 = 0x61, ARM4T = 0x62, ARM5 = 0x63, ARM5T = 0x64, ARM6 = 0x65, ARM_XMAC = 0x66, ARM_WMMX = 0x67, ARM7 = 0x68, ARMNT = 0xf4, the differences between which are not obvious to me :) But the support is there (in theory) for whoever wants this. |
lld/COFF/PDB.cpp | ||
---|---|---|
411 ↗ | (On Diff #105706) | Actually ARM64 is probably ARM8, which does not seem to be represented in this enumeration. So there will be some head scratching involved to figure out what to do there |
lld/COFF/Error.h | ||
---|---|---|
21 ↗ | (On Diff #105903) | Sorry for the last-minute comment, but can you keep this variable and just change it stype from llvm::StringRef to std::vector<llvm::StringRef> to make it consistent with ELF? I don't want to make them being diverged too much. |
lld/COFF/Error.h | ||
---|---|---|
21 ↗ | (On Diff #105903) | Is it ok to have a global std::vector? This might invoke an undesirable global constructor. |
lld/COFF/Error.h | ||
---|---|---|
21 ↗ | (On Diff #105903) | Well, it might not be desirable, but we already have a few global std::vectors. |
Should I still leave the variable in Error.h? It seems a little illogical to have the variable in Error.h given that it's now being used outside of Error related code. Config.h seems like the logical place for it. Maybe the best thing to do is add the vector in Configuration of ELF linker too?
lld/COFF/Driver.cpp | ||
---|---|---|
59 ↗ | (On Diff #105917) | Yes, that works. In general assign is more efficient because it uses already reserved storage. In this case it doesn't matter since we're actually just initializing it. But say for example you have a vector with 1000 items in it, in that case assign() would be better since it wouldn't free the internal buffer. In any case, I've made the change you suggested and will submit like that. |