[PATCH] D67774: [Mangle] Add flag to asm labels to disable '\01' prefixing

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 13:45:52 PST 2020


On Tue, Jan 7, 2020 at 3:40 PM John McCall <rjmccall at gmail.com> wrote:
>
> On Tue, Jan 7, 2020 at 3:18 PM Aaron Ballman <aaron at aaronballman.com> wrote:
> > It seems like GCC doesn't do good things when trying to link two
> > functions with empty asm labels but Clang does seem to do something
> > reasonable. I can't quite tell whether this is a case for a diagnostic
> > or not. Note the generated assembly in: https://godbolt.org/z/HFfPs6
>
> Interesting.  I'm glad we do something reasonable, but it's probably best not
> to call this supported behavior.
>
> > > > > Is this bug occurring with real code, or
> > > > > is LLDB constructing something bizarre?
> > > >
> > > > It was a c-reduced test case that we found when doing AST dumping to
> > > > JSON, so I think the code was probably real at one point.
> > >
> > > Unless your reducer is smart enough to try to minimize string
> > > literals, which it might be.
> >
> > Also possible. Regardless, a failed assertion isn't a good outcome.
>
> Yeah, agreed.  In general, allowing empty symbol names seems like it's
> just unnecessarily courting all sorts of weird corner cases like this.
>
> > If we think it's fine to diagnose empty labels, I'm fine with the change.
> > I don't know enough about how asm labels are used to have a feeling
> > for the correct way to resolve the issue.
>
> If GCC isn't doing anything reasonable on empty labels, let's just call them
> ill-formed and wash our hands of it.

Okay, that works for me. Thank you for the guidance (several others
agreed on IRC as well)! I'll put together a patch for this shortly.

~Aaron

>
> John.


More information about the llvm-commits mailing list