This is alternative to https://reviews.llvm.org/D30500 to simplify the
version definition parser and allow ":" in symbol names.
Details
Diff Detail
- Build Status
Buildable 4607 Build 4607: arc lint + arc unit
Event Timeline
This approach sure has simpler implementation,
(when I wrote my patch, I sure thought about doing the same),
but it may open Pandora's box.
For example it is easy to copypaste "global" instead of "local" and it be accepted:
{ global: aaa; global: *; };
At fact any combinations of local and global labels are possible with it:
{ global: aa; local: bb; global: cc; local: dd; }
That opens road to writing overcomplicated and what is probably
more important - a road to write scripts that are incompatible with both BFD and gold !
I think compatibility and simplicity is what we want to deliver and if gnu linkers do not
accept that, I see that is a reason also not to accept it.
At fact you want to accept such syntax because its simplifies implementation and
that is understandable position, though I think we probably should not do that here.
I disagree. If you intentionally try to break a thing, it will break, but that's not realistic. Your examples are clearly wrong and easy to fix for programmers. If you know the internal implementation of LLD and other linkers, you can always write a linker script that is broken in a subtle way in some linker but works perfectly fine with different one. For example, our lexer behaves different in corner cases from the GNU linker's because we aimed simplicity, and if you know about that, you can come up with many examples that doesn't work with our linker or their linkers. I think you are overthinking.
Note that we can easily reject linker scripts that you gave me as bad examples just by counting the number of occurrences of each label in the function and doesn't allow more than one label for each label name. That's worth to do though.
Implementation is LGTM. My concern stands, but we can change it to stricter behavior separatelly.