[llvm-commits] [PATCH] Fix assertion failure in MC

James Molloy james.molloy at arm.com
Fri Jan 27 09:43:58 PST 2012


Followup - Sorry Rafael, You didn't reply-to-all so your response didn't end
up in my inbox and I missed it :(

> This introduces an uncomfortable asymmetry between isInSection and
> getSection. Maybe isInSection should be changed too?

I agree - I changed getSection() rather than the caller because it looks
like something that is caller-independent. If the section information isn't
already set, unwinding the alias list is probably a good fallback.

That said, I don't know why it doesn't affect x86. It's something that is
very reliant on the order of the aliases at the MC level - it's entirely
possible that on x86 the MC orders the aliases correctly.

The answer of course could be that the order of initialisation should take
aliases into account. I hadn't considered a bug that fundamental when I was
debugging it though...

Cheers,

James

-----Original Message-----
From: James Molloy 
Sent: 27 January 2012 08:55
To: James Molloy; llvm-commits at cs.uiuc.edu
Subject: RE: [llvm-commits] [PATCH] Fix assertion failure in MC

Ping!

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu
[mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of James Molloy
Sent: 25 January 2012 10:12
To: llvm-commits at cs.uiuc.edu
Subject: [llvm-commits] [PATCH] Fix assertion failure in MC

Hi,

The attached patch fixes an assertion failure in the MC when chains of
aliases are used.

This was discovered by PlumHall C++ and the testcase was reduced and
anonymised from that. The main issue is if an alias points to another alias,
there is no guarantee on the order that the MC layer will initialise the
values in their MCSymbol representations.

Because of this it is possible for an alias to purport to have a null
Section field when it shouldn't, and an assertion fires in IsInSection().
The patch fixes this by changing IsInSection() to first follow aliases
transitively before returning or asserting.

Review requested.

Cheers,

James









More information about the llvm-commits mailing list