# Fri, Jan 24

@chrisjackson, I assume this got committed, and just didn't get closed? Can you confirm?

# Jan 17 2020

ping

Jan 17 2020, 5:41 AM · Restricted Project

# Jan 14 2020

http://lists.llvm.org/pipermail/llvm-dev/2019-November/137108.html does not evoke many responses. I take the lack of responses on the RFC and questions from @JonChesterfield and @ruiu as people are still doubting whether this feature will be generic enough to benefit the community, rather than a feature used in a very specific scenario, which can be easily replaced by another tool.

Jan 14 2020, 6:26 AM · Restricted Project

# Jan 10 2020

ping

Jan 10 2020, 6:28 AM · Restricted Project

# Jan 8 2020

Hello @ruiu and @MaskRay , can I help with any more technical queries concerning this proposal? Also with respect to the associated D70316 that enables printing of watermark note sections and computing of watermarks in readobj?

Jan 8 2020, 10:59 AM · Restricted Project

# Jan 6 2020

Ping

Jan 6 2020, 4:07 AM · Restricted Project

# Dec 11 2019

As I understand it, the scenario is:

1. Do link; 2) Run the watermark tool to append .note.llvm.watermark; 3) Release SDK; 4) Downstream vendors modify .data and ship to end users; 5) End users verify that .note.llvm.watermark does not match computed watermark of loadable contents.

The build process before 3) are all controlled. The process should ensure there is no modification to .data between 1) and 2). How do you guarantee a linker side feature can prevent modification? How can you prevent the following:
2. Do link and generate .note.llvm.watermark in one step 1.5) Modify .data 2) Run the watermark tool to update .note.llvm.watermark

This is a motivation to not have an external tool on the watermarking. That being said, as @chrisjackson has said on more than one occasion, this isn't intended to be a security feature so we are not attempting to detect a malicious attacker. It could be possible for downstream LLD producers to add a local salt to the watermark to make it more secure, should they so choose, I suppose.

This is actually going to be an interesting problem. Do your users make post-link modifications to executables by intention or by accident? If it's intentional, you are raising a bar of an arms race, and they'll catch up by adding --update-watermark option or something to their tool, so that they'll update a watermark when a binary is modified, which nullifies the point of this change.

Dec 11 2019, 6:27 AM · Restricted Project

# Dec 9 2019

Modified extractSegments() in watermark.h.

Dec 9 2019, 5:18 AM · Restricted Project

# Dec 5 2019

Dec 5 2019, 11:31 AM · Restricted Project

Removed library test accidentally added in last update.

Dec 5 2019, 11:30 AM · Restricted Project

Dec 5 2019, 11:30 AM · Restricted Project

Watermark functionality now placed in separate source and header in the object library. This is used by Writer and SyntheticSections.

Dec 5 2019, 11:21 AM · Restricted Project

# Dec 4 2019

A post-link modification could recalculate and update the hash, but this would only occur in a deliberate attempt to subvert the watermark mechanism

I think it follows that this patch only detects accidental modifications to the binary that occur after linking. That seems to put it in the realm of network transmission errors, disk bit rot, optical media errors and so forth.

In which case, why only guard a subset of the binary, instead of computing a sha256 of all the compiled artifacts and checking that at install/network copy time? Then there is again no linker patch required.

Unless this is intended to catch people who deliberately change the binary, but lack the skills to then update the hash, which is surely vanishingly few people. Fewer when provided with convenient tools to recalculate the hash.

Dec 4 2019, 2:17 AM · Restricted Project

# Nov 27 2019

I sympathize with the requirement to tell whether a binary has been edited after the link step. E.g. one could then raise an error from the loader.

Writing 8 bytes to a known location in the binary can't achieve that. Whatever post link modification is performed will recalculate and update the hash in the binary. If I understand correctly, the plan is to enhance a llvm binary utility to conveniently perform this updating, or at least to provide the 8 bytes to be written into the known location by any other tool.

So I see the cost - lld and other tools get more complicated - and I see the requirement - but I can't see how the proposed change meets the requirement.

Nov 27 2019, 8:27 AM · Restricted Project

# Nov 20 2019

Nov 20 2019, 8:43 AM · Restricted Project

This patch introduces a new ELF extension with a new tag: NT_LLVM_WATERMARK. Last times such ELF extensions were made accompanying RFCs were posted:

I still have some concerns about the extension, especially its generality on the widely used ELF platforms.

We would like to have two PT_NOTEs, one for use by the OS and another for use by tooling. This is achieved by linker scripts. The second PT_NOTE is outside of any PT_LOAD and this is where the watermark would be housed. As described above, a required property of the watermark is that it can be recalculated by an external tool to infer whether or not the loadable parts of the ELF have been modified post-link. By having the watermark outside of any PT_LOAD, it is simpler for the external tool to recalculate. For a similar reason, it would actually be better in our case to have the watermark calculated after the build ID value has been "filled-in", as the build ID is inside a PT_LOAD.

Sorry, I am not following. Do you have a concrete readelf -Sl dump to help my understanding?
By linking a trivial executable with ld.lld a.o --watermark -o a, what I see is:

 PHDR           0x000040 0x0000000000200040 0x0000000000200040 0x000118 0x000118 R   0x8
LOAD           0x000000 0x0000000000200000 0x0000000000200000 0x000174 0x000174 R   0x1000
GNU_STACK      0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW  0
NOTE           0x000158 0x0000000000200158 0x0000000000200158 0x00001c 0x00001c R   0x4

Section to Segment mapping:
Segment Sections...
00
01     .note.llvm.watermark
02
03     .note.llvm.watermark

.note.llvm.watermark is still included in a PT_LOAD segment. I think you probably meant:

• .note.gnu.build-id is included in a PT_LOAD and a PT_NOTE
• .note.llvm.watermark is included in another PT_NOTE

There is also a question why .note.llvm.watermark should be flagged SHF_ALLOC if it is not supposed to be inspected at runtime.
Nov 20 2019, 6:23 AM · Restricted Project

# Nov 19 2019

@ruiu observed that the watermark computation was reliant on the segment ordering in the ELF file. This ordering can change without affecting the loadable image. Therefore, we now apply an ordering based on the segment's virtual address when calculating the watermark.

Nov 19 2019, 6:02 AM · Restricted Project

# Nov 15 2019

Nov 15 2019, 9:29 AM · Restricted Project
Nov 15 2019, 8:27 AM · Restricted Project

# Sep 13 2019

It seems the main reason why you guys wanted to avoid an external tool is that it is too easy to forget to run the tool after link. But that can be fixed easily by writing a shell script as ld.lld which invokes the real ld.lld and a watermarking tool. Or, you could make a change to lld so that, after creating an executable file and before existing, lld invokes a watermarking tool on a file that the linker just created (in this configuration, the watermarking tool can either run in the same process or as a child process). Have you considered that approach? I think it is fine to add this feature directly to lld if it is convenient, but I'd like to explore other possibilities before we make a decision.

Besides that, there are a few technical concerns in this patch as below:

• lld guarantees that the same build id will be computed only when the resulting output file (except the build id part itself) and the linker version are the same. We didn't guarantee that different versions of lld compute the build id in the same way. Actually, we have tweaked hash functions and the strategy for tree hash several times. This contract seems too weak for your use case -- for your use case, we need to guarantee that the way how we compute a hash value doesn't change over time. So, we need to make sure that the current way of hash computation is something that we want to maintain like forever.

If watermarking doesn't have to be fast (e.g. users only have to do this for release binaries), consider using a simple non-tree hash function.
• Maybe you should add a version field or something to the note section so that we can change a hash function or something in the future.
• The watermark feature is to make sure that the program image loaded to memory hasn't changed since its file is created. In that sense, the hash function seems a bit too fragile. If you move a segment within an ELF file, you'd have to change the file offset field of a program header, but the memory image won't change by doing that, so in the sense of watermarking, I don't think it should be considered a change.
Sep 13 2019, 6:53 AM · Restricted Project

# Sep 10 2019

chrisjackson added a comment to D62955: [llvm-nm] Additional lit tests for command line options.

This was closed with commit 7b39513302, svn r363248.

If your description included Differential Revision: https://reviews.llvm.org/D62955 (see other commits' descriptions), the revision would have been closed automatically when you committed.

# Sep 6 2019

This update applies suggested source corrections, enables readobj to output the note and adds logic to writeWatermark() to exclude the ELF Header and Program Header Table (PHT) from the watermark. In this diff the PHT can only be excluded if it is the first or last segment. If it is neither, an error is emitted.

Sep 6 2019, 3:42 AM · Restricted Project

# Sep 3 2019

This was closed with commit 41e20d210, svn r364559.

This was closed with commit 7b39513302, svn r363248.

# Aug 30 2019

This was closed with revision r370458, commit fa1fe93789.

Aug 30 2019, 3:28 AM · Restricted Project
[llvm-objcopy] Allow the visibility of symbols created by --binary and --add…

# Aug 29 2019

Update to apply the corrections pointed out by @MaskRay .

Aug 29 2019, 6:43 AM · Restricted Project

# Aug 28 2019

The diff has been updated to apply the visibility to symbols created with --add-symbol where a visibility flag is not specified. The flag name has also been changed from --binary-symbol-visibility to --new-symbol-visibility

Aug 28 2019, 9:29 AM · Restricted Project
chrisjackson retitled D65893: [llvm-objcopy] Allow the visibility of symbols created by --binary and --add-symbol to be specified with --new-symbol-visibility from [llvm-objcopy] Allow the visibility of the start, end and size symbols created by --binary to be specified with --news-symbol-visibility to [llvm-objcopy] Allow the visibility of symbols created by --binary and --add-symbol to be specified with --new-symbol-visibility.
Aug 28 2019, 9:26 AM · Restricted Project
chrisjackson retitled D65893: [llvm-objcopy] Allow the visibility of symbols created by --binary and --add-symbol to be specified with --new-symbol-visibility from [llvm-objcopy] Allow the visibility of the start, end and size symbols created by --binary to be specified with --binary-symbol-visibility to [llvm-objcopy] Allow the visibility of the start, end and size symbols created by --binary to be specified with --news-symbol-visibility.
Aug 28 2019, 9:26 AM · Restricted Project

# Aug 20 2019

Aug 20 2019, 2:37 AM · Restricted Project

# Aug 19 2019

Aug 19 2019, 10:00 AM · Restricted Project

# Aug 15 2019

Is your GNU objcopy patched to use STV_HIDDEN or STV_PROTECTED for _binary_a_{start,end,size}?

objcopy -I binary -O elf64-x86-64 a b => Symbols in b are STV_HIDDEN/STV_PROTECTED?

Aug 15 2019, 6:26 AM · Restricted Project

I agree that the generalized version is useful and I have been looking at a patch for this. However, in this specific case the symbol names are automatically generated based on the path of the binary, so it makes it difficult to specify these specific symbol names on the command line.

The symbol names are generated but that is unavoidable. You also have to specify the name in the source: extern const char _binary_a_start[];

With regards to the expected semantics, we anticipate standard ELF semantics when combining different visibilities. Our toolchain operates using a default visibility of STV_HIDDEN for definitions unless explicitly exported, in which case they are STV_PROTECTED. This means that declarations need not be explicitly marked with a visibility in order to be exported or not. The new switch allows the replication of the compiler's -fvisibility=hidden switch in llvm-objcopy. As an alternative to the name --binary-symbol-visibility, how about --symbol-visibility? This would affect the visibility of all the new symbols generated by llvm-objcopy, not just those symbols added for binary input.

There are no other options that add new symbols. --add-symbol has its own visibility flags, --symbol-visibility will not help that feature. --new-symbol-visibility might be a better name but people need to be taught it will be overridden by --add-symbol visibility flags. I am still not sure the little amount of saved labor (__attribute__((visibility("protected"))) marks) justifies a new option, given that Keil embedded development tools already require other markers like __declspec(dllexport) and __declspec(dllimport). And another question: how did you survive with GNU objcopy? It doesn't allow you to change the visibility of _binary_xxx_start...

Quote gABI:

> Second, if any reference to or definition of a name is a symbol with a non-default visibility attribute, the visibility attribute must be propagated to the resolving symbol in the linked object. If different visibility attributes are specified for distinct references to or definitions of a symbol, the most constraining visibility attribute must be propagated to the resolving symbol in the linked object. The attributes, ordered from least to most constraining, are: STV_PROTECTED, STV_HIDDEN and STV_INTERNAL.

You can achieve the same with: attribute((visibility("hidden"))) extern char _binary_a_start[]; So I'm not sure why another option is needed (I think my another concern is that the option name --binary-symbol-visibility can make people puzzled if they add/delete/change symbols). See D55682.

Aug 15 2019, 3:00 AM · Restricted Project
[llvm-objcopy] Allow 'protected' visibility to be set when using add-symbol

# Aug 14 2019

• For our use cases it is more convenient to change the symbol's visibility with an option than to have users alter their source code.

I accepted D65891 because:

• It deals with an existing option: --add-symbol. protected is a natural extension to the existing default/hidden visibility. Nobody will get puzzled by this addition.
• According to Changes to symbol visibility between RVCT v3.1 for µVision and RVCT v4.0 for µVision you linked, there are some use cases. I guess it is used for preventing inadvertent preemption in static linking.

The first bullet is sufficient for me to accept it, but I hope you can elaborate more on the second bullet. How do you use STV_PROTECTED in object files and shared objects? What semantics do you expected when linking STV_DEFAULT/STV_PROTECTED undefined/defined together?

For our use cases it is more convenient to change the symbol's visibility with an option than to have users alter their source code.

--binary-symbol-visibility can cause confusion. As suggested by rupprecht, it should be generalized to --redefine-visibility= if we do want the option.

Aug 14 2019, 6:35 AM · Restricted Project

# Aug 9 2019

Quote gABI:

Second, if any reference to or definition of a name is a symbol with a non-default visibility attribute, the visibility attribute must be propagated to the resolving symbol in the linked object. If different visibility attributes are specified for distinct references to or definitions of a symbol, the most constraining visibility attribute must be propagated to the resolving symbol in the linked object. The attributes, ordered from least to most constraining, are: STV_PROTECTED, STV_HIDDEN and STV_INTERNAL.

You can achieve the same with: __attribute__((visibility("hidden"))) extern char _binary_a_start[]; So I'm not sure why another option is needed (I think my another concern is that the option name --binary-symbol-visibility can make people puzzled if they add/delete/change symbols). See D55682.

Three symbols per embedding in an object results in bloated output.

I don't understand this point. How can the visibility change de-bloat the output?

Preventing this with many attribute statements seems like a clumsy approach.

I don't understand this, either. Your are going to reference _binary_a_start, (_binary_a_end or _binary_a_size) - two undefined symbols. Restrict the undefined symbol with a visibility attribute, then the linked exe/dso will change the symbol bindings accordingly. What's the problem?

With regards to the confusing option, we can just decide on a better name.

We can do that once we decide this option is useful.

Aug 9 2019, 9:22 AM · Restricted Project

It makes sense from the perspective of completeness but STV_PROTECTED is problematic and can hardly find a justified use case.

People use STV_PROTECTED when they want to avoid GOT/PLT costs in PIC code. However,

A protected STT_OBJECT prevents you from doing copy relocation. ld.bfd silently accepts this, which can cause ODR violations.
A protected STT_FUNC prevents you from making a canonical PLT (-fno-pic code in executable references an external function). If the linker fails to stop you, you'll get pointer equality problems. (It can be argued this case can be fixed by letting the compiler go through GOT when the address of a protected function is taken, but then the GOT indirection will likely break people's expectation. A symbol lookup change is also required on ld.so side.)

I think lld and gold reject both cases. So at the best, a protected symbol can be seen as a promise of the toolchain that the symbol will not be interposed.

Actually, in a DSO, a STV_PROTECTED use case can be easily replaced with the hidden+alias idiom:

__attribute__((visibility("hidden"))) void internal() {} // internal use
__attribute__((alias("internal"))) void external(); // external API

The reservation of STV_INTERNAL was requested by SGI when gABI was formulated. All other parties appear to treat STV_INTERNAL the same as STV_HIDDEN.

Aug 9 2019, 4:54 AM · Restricted Project

Quote gABI:

Second, if any reference to or definition of a name is a symbol with a non-default visibility attribute, the visibility attribute must be propagated to the resolving symbol in the linked object. If different visibility attributes are specified for distinct references to or definitions of a symbol, the most constraining visibility attribute must be propagated to the resolving symbol in the linked object. The attributes, ordered from least to most constraining, are: STV_PROTECTED, STV_HIDDEN and STV_INTERNAL.

You can achieve the same with: __attribute__((visibility("hidden"))) extern char _binary_a_start[]; So I'm not sure why another option is needed (I think my another concern is that the option name --binary-symbol-visibility can make people puzzled if they add/delete/change symbols). See D55682.

Aug 9 2019, 4:20 AM · Restricted Project

# Aug 7 2019

Aug 7 2019, 10:26 AM · Restricted Project
Aug 7 2019, 10:05 AM · Restricted Project

# Jul 25 2019

I don't think we should change the original error message, as the original message seems to make more sense than the new one for users.

The original error message, when --vs-diagnostics is not used, is mostly the same. There is only a small improvement for a case when only one section, either for an old or new definition, is present.

On the other hand, one of the reasons for --vs-diagnostics is to provide a user with means to jump to the mentioned location. That is achieved by placing the location in front of the error message. Thus, as there are usually two source locations, there should be two separate error messages.

Have you considered changing the regexp to parse this error message?

Jul 25 2019, 7:44 AM · Restricted Project

# Jul 18 2019

chrisjackson committed rG0b03429a9111: [lld] Fix vs-diagnostics-version-script test. NFC. (authored by chrisjackson).
[lld] Fix vs-diagnostics-version-script test. NFC.

# Jul 17 2019

chrisjackson committed rG87886299b468: [lld] Add Visual Studio compatible diagnostics (authored by chrisjackson).
[lld] Add Visual Studio compatible diagnostics

# Jul 15 2019

Does anyone have any thoughts on these additions?

Jul 15 2019, 5:25 AM · Restricted Project

# Jun 27 2019

[llvm-nm] Fix for BZ41711 - Class character for a symbol with undefined…

# Jun 26 2019

chrisjackson updated the diff for D58484: [DO NOT SUBMIT] Add -vs-diagnostics..

Additional regexes to match more messages containing source:line information. Also added a test.

Jun 26 2019, 8:22 AM · Restricted Project

# Jun 25 2019

Tidied up the test and added some additional cases. Added an assert explaining the tested binding values.

# Jun 13 2019

[llvm-nm] Additional lit tests for command line options

# Jun 6 2019

Have you made sure that there aren't any uses which would result in an undesired change in behaviour because of this? I feel like it's something that people wouldn't expect to change, and therefore wouldn't test explicitly necessarily.

There should also be a test case somewhere (not that I have a good suggestion for where).

I've checked the call sites:

In RuntimeDyld, if (Flags & SymbolRef::SF_Undefined) continue; filters out index 0.
In llvm-objdump, the filtering code is removed in this patch.
In lib/Object/SymbolSize.cpp, I think the code doesn't notice index 0 is included... but it doesn't seem to matter.
In llvm-nm.cpp, I'll leave the test to @chrisjackson in D62148

Jun 6 2019, 7:27 AM · Restricted Project

# Apr 12 2019

Does anyone have any comments on this expanded alternative implementation of vs-diagnostics?

Apr 12 2019, 8:10 AM · Restricted Project

# Mar 21 2019

chrisjackson updated the diff for D58484: [DO NOT SUBMIT] Add -vs-diagnostics..

I have expanded Rui's regex implementation to cover the existing tests for Visual Studio diagnostics compatibility patches,

Mar 21 2019, 8:49 AM · Restricted Project
Mar 21 2019, 8:47 AM · Restricted Project

# Mar 12 2019

I'm working on extending this to pass the existing tests from D58300. Like @ikudrin , I am not fond of this regex method, but I think we will all be in a better place to make an evaluation once this implementation can pass the tests.

Mar 12 2019, 3:57 AM · Restricted Project

# Feb 27 2019

chrisjackson added a comment to D58300: [lld] Enable Visual Studio compatible output.

I like @ruiu 's suggestion in D58484, it is simple and elegant. We don't need performance there, so a regex is fine.
In both cases, yours and @ruiu 's, it would be good to demonstrate usage in the COFF driver as well.
There will be less changes to the LLD codebase with the regex approach. More code changes/additions means more maintenance in the long term.
What do you think on building on @ruiu 's proposal, Chris?

# Feb 22 2019

chrisjackson updated the diff for D58300: [lld] Enable Visual Studio compatible output.

Used clang-format-diff against the patch is requested by @aganea.

# Jan 30 2019

chrisjackson added a comment to D50560: [LLD] Enable Visual Studio compatible diagnostics..

I will provide a patch for this as I'm very keen to add support for Visual Studio diagnostics, but I'm not currently working on it.

Jan 30 2019, 8:47 AM · Restricted Project, lld
chrisjackson added a comment to D56329: Fix some warnings on MSVC.

With regards to

93 if( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.15 )

# Sep 19 2018

chrisjackson added a comment to D50560: [LLD] Enable Visual Studio compatible diagnostics..

@ruiu
Hello Rui, do you have any thoughts on this implementation compared to D47540 ?

Sep 19 2018, 10:19 AM · Restricted Project, lld

# Sep 7 2018

chrisjackson added a comment to D50560: [LLD] Enable Visual Studio compatible diagnostics..

I have experimented with this implementation and I agree that separating the diagnostic location functions into a distinct library is a good structured approach. I think this would be a reasonable and more explicit support for Visual Studio Diagnostics than D47540 which really just shoehorned in support.

Sep 7 2018, 5:21 AM · Restricted Project, lld

# Aug 30 2018

chrisjackson added a reviewer for D51283: Drop __real_ symbol from the output symbol table.: bd1976llvm.

# Aug 23 2018

chrisjackson added a comment to rL340387: Change how we handle -wrap..

This revision contradicts what was agreed in D34993 because we now emit __real_foo in the symbol table. Is this an intended change in behaviour?

# Jul 26 2018

chrisjackson added a comment to D47540: [lld] Enable Visual Studio compatible output.

Can we try the approach where the final style of diagnostic messages is determined in the reporting module and all other code just don't care about it?
Right now, we have a bunch of functions here and there which prepare some parts of the message in a specific style. Maybe it will be more semantically clear if there is a distinct place where the resulting message is prepared while all other parts of the linker provide only basic parts of the message (like message text, source location(s), code location(s), etc.) in a structured form. In this case, we can adjust only that distinct place to add any required message styles.

# Jul 12 2018

chrisjackson updated subscribers of D49184: [lld] Make tests calling llvm-ar more robust.
chrisjackson added a comment to D49184: [lld] Make tests calling llvm-ar more robust.

@sbc100
I agree it would be nice to have an option for llvm-ar to start the archive anew.
I'm not sure about changing all the flag settings as you suggest though. I don't want to enforce a standard or accidentally change the way any of the tests work.
Perhaps standardisation of flags could be a different revision.

chrisjackson added a reviewer for D49184: [lld] Make tests calling llvm-ar more robust: ruiu.

# Jul 11 2018

chrisjackson added a reviewer for D49185: [llvm] Increase robustness of tests calling llvm-ar: ruiu.
chrisjackson updated the summary of D49185: [llvm] Increase robustness of tests calling llvm-ar.
chrisjackson updated the diff for D49185: [llvm] Increase robustness of tests calling llvm-ar.

# Jul 10 2018

chrisjackson updated the diff for D49090: [ThinLTO] Escape module paths when printing.

Followed suggestions to make the test simpler.

# Jul 6 2018

chrisjackson added a comment to D47540: [lld] Enable Visual Studio compatible output.

I think that if we are to add support for Visual Studio (VS) that any
implementation should be explicit and not rely on quietly attempting to
transform any messages to the desired format. As you suggest, the pattern
matching / transform solution is quite hacky. Also, it will implicitly rely on
the diagnostic message string passed having the properties that the
implementation matches on. If we use a pattern matching implementation, have you
considered how we would handle message strings that do not conform to the
expected pattern?

# Jul 4 2018

chrisjackson updated the diff for D47540: [lld] Enable Visual Studio compatible output.
chrisjackson updated the diff for D47540: [lld] Enable Visual Studio compatible output.

Added missing relocation test file in ELF/Inputs/

chrisjackson updated the diff for D47540: [lld] Enable Visual Studio compatible output.

There are several modifications to the code and lit test additions based
on the suggestions given. The default origin or source used to prefix any
diagnostics with no source code file is now stored in Driver and passed to
ErrorHandler. There are methods to set and get the private member
'DiagnosticSourceDefault'. This is a StringRef initialised to "lld", resembling
the previous behaviour of ErrorHandler.LogName.

# Jun 26 2018

chrisjackson updated the diff for D47540: [lld] Enable Visual Studio compatible output.
• Corrected paranthesised/parenthesized usage in source comments
• Updated the lit test to remove usage of deprecated %T
chrisjackson added a comment to D47540: [lld] Enable Visual Studio compatible output.

I created a program that doesn't link and tried to build it on VS. Linker error messages in the VS window are not clickable -- I couldn't jump to the location by clicking a filename and a linename (e.g. foo\bar\baz.cpp:42) in the linker error message. Is this expected?

# Jun 22 2018

chrisjackson added inline comments to D47540: [lld] Enable Visual Studio compatible output.

# Jun 15 2018

chrisjackson added a comment to D47540: [lld] Enable Visual Studio compatible output.

One thing I would have you consider is putting the origin before the message. This doesn't make a super big difference, but it's more consistent with how the code is currently written and the order in which the strings appear.

# Jun 14 2018

chrisjackson added a comment to D47540: [lld] Enable Visual Studio compatible output.
grep -ER '(error|fatal|warn)\(' lld/ELF

finds a lot of places where we are putting location information in diagnostics. Are you planning to convert those to use the new API/formatting, too?

@inglorion
I think this presents a choice that could affect the implementation. If all the call sites are converted, then potentially we could make the Src parameter non-optional. However, for the cases where a diagnostic lacks file source information we would risk inconsistent output of the Origin component of the message due to the lack of the optional default. One idea in this case is providing some functionality in the errorHandler class that helps enforce consistency e.g.

error("unknown argument: " + Arg->getSpelling(), errorSrcDefault());

Alternatively, we can convert only some of the calls and retain the optional class for Src. I'm assuming that for simplicity we are only considering options that have a single interface each for error/warn/fatal.

# Jun 12 2018

chrisjackson added a comment to D47540: [lld] Enable Visual Studio compatible output.

Could you share a few real examples of error messages with and without this patch to see how they look like?

chrisjackson updated the diff for D47540: [lld] Enable Visual Studio compatible output.

Updated the lit test to show more examples of the the new error function, in response to a request from Ruiu. Also, corrected the setting of errorHandler.LogName in driverutils as LogName was incorrectly being set even if the --vs-diagnostics flag was not set.

# Jun 1 2018

chrisjackson updated the diff for D47540: [lld] Enable Visual Studio compatible output.

Thanks for reviewing Rui, I've made the changes as described in my responses to your comments. Primarily:

• removed the extra set of LogName
• made clearer the extraction of the linker executable name from Args
• Made a correction to print() in ErrorHandler
• Removed unnecessary else in inputfiles.cpp

# May 30 2018

chrisjackson added inline comments to D47540: [lld] Enable Visual Studio compatible output.