Rafael EspĂndola
2013-Oct-30 20:59 UTC
[LLVMdev] [RFC] Alias should not point to declarations
On 30 October 2013 16:16, Tim Northover <t.p.northover at gmail.com> wrote:> Hi Rafael, > >> With all that in mind, the attached patch changes the verifier to >> reject aliases to declarations and updates that language reference. > > MachO has an R_INDR (== "indirect") symbol flag/type that (from my > understanding) exactly reflects this. The linker is supposed to record > the alias and define both symbols when the referee is defined. In > fact, I've been working on exposing this to C code very recently so > I'd obviously quite like it to stick around. > > Currently I've not submitted a patch because, even though it's > documented, ld64 doesn't have support just yet so I can't actually > test things properly. > > I think the only benefit is going to be to compile-time and > source-structure, but it would still be a shame to lose it when LLVM > is so close to having the ideal model right now.We chatted a bit or IRC and it does look like N_INDR has the behaviour of llvm aliases. An alias to a declaration is a definition for example. It is documented here: https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html I will try to make the ELF/COFF restrictions explicit with errors in codegen instead. Cheers, Rafael
Rafael EspĂndola
2014-Mar-12 18:33 UTC
[LLVMdev] [RFC] Alias should not point to declarations
> We chatted a bit or IRC and it does look like N_INDR has the > behaviour of llvm aliases. An alias to a declaration is a definition > for example. It is documented here: > https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/MachORuntime/Reference/reference.htmlWe discussed this a bit more on IRC today. Fixing pr10367 is more important now that there is work under way to support comdats, which would use aliases to implement RTTI for the msvc abi. It is much easier to design a feature based on what existing tools (linkers in this case) support and N_INDR is not currently implemented. On the other hand, adding support for it once it is implemented should be relatively easy. The attached patch then effectively just replaces a report_fatal_error with a proper verifier check that represent what can currently be implemented. Tim, can you confirm that it is OK? Thanks, Rafael -------------- next part -------------- A non-text attachment was scrubbed... Name: t.patch Type: text/x-patch Size: 15096 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140312/682645ea/attachment.bin>
Tim Northover
2014-Mar-12 19:52 UTC
[LLVMdev] [RFC] Alias should not point to declarations
> Tim, can you confirm that it is OK?Yep. I'll try to make sure nothing makes N_INDR support impossible, but there's no particular reason to pretend it's already there as far as I can see. Cheers. Tim.