Defined atom are allocated in multiples thread. The static counter must be atomic, else the ordinal is not guarantee to be unique (which is required by the Mach-O writer).
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
am confused, Atoms live within a File and when the ordinals would be relative inside the file. So for your case do more than one file share the same SimpleDefinedAtom ? Am I missing some information ?
That’s true for input file, but having the same ordinal for 2 atoms raise an assert in MachO Layout Pass which is run on the generated file (that contains atom from many files)
Le 14 mars 2015 à 06:22, Shankar Kalpathi Easwaran <shankarke@gmail.com> a écrit :
am confused, Atoms live within a File and when the ordinals would be relative inside the file. So for your case do more than one file share the same SimpleDefinedAtom ? Am I missing some information ?
REPOSITORY
rL LLVMEMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
But now that I think about it, there is just something wrong in the first place with that ordinal. It it either meaning full inside a single input file, and we shouldn’t use a static or don’t care about race condition, or it is meaningful across files and I don’t see how it can be as loading file in parallel make it indeterministic anyway.
Le 14 mars 2015 à 07:22, Jean-Daniel Dupas <mailing@xenonium.com> a écrit :
That’s true for input file, but having the same ordinal for 2 atoms raise an assert in MachO Layout Pass which is run on the generated file (that contains atom from many files)
Le 14 mars 2015 à 06:22, Shankar Kalpathi Easwaran <shankarke@gmail.com> a écrit :
am confused, Atoms live within a File and when the ordinals would be relative inside the file. So for your case do more than one file share the same SimpleDefinedAtom ? Am I missing some information ?
REPOSITORY
rL LLVMEMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
Thank you for doing this. I wonder if we use _ordinal assigned here in the constructor. We usually assign ordinals explicitly in the reader, so I hope ordinals assigned here are overwritten in all use cases. If you change this to UINT_MAX or something and make ordinal() to abort if it's still UINT_MAX, does the linker fail with the assertion?
This change is good to mitigate the situation, so I'm OK to commit as a quick fix, but the actual fix should be assigning ordinals explicitly.
I just hit this bug too (see http://reviews.llvm.org/D8336), and I've committed this fix in r237857.
Jean-Daniel - did you end up having any insights into the Right Way to fix this?
Fixed in r238072 by moving the ordinal tracking into the File class as discussed in http://reviews.llvm.org/D9927.