[PATCH] D30722: Handle ":" as a regular token character in linker scripts.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 09:56:52 PST 2017


ruiu added a comment.

In https://reviews.llvm.org/D30722#696406, @grimar wrote:

> 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.


https://reviews.llvm.org/D30722





More information about the llvm-commits mailing list