cooperp wrote:
> If your intent is to create an ordinary C string literal, maybe we should
> just call the standard routine for emitting a C string literal.
Yeah, that would be fine. My original attempt at this actually did just that.
It ends up changing more or less the same tests as this does, just that instead
of something like:
@OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant [3 x i8] c"T7\00"
you end up with:
@OBJC_CLASS_RO_T_{{.*}} = {{.*}} [3 x i8] c"T7\00"
as we are looking for the cstring inside the class_ro_t global initializer, not
in its own variable. But if you are ok with that (happy to give an actual
example of real IR if needed) then happy to go that way.
> I can't remember if these bitmaps can contain zero bytes, but if so,
> explicitly putting them in the C string literal section might be problematic.
I wondered that too. The existing code would put the bitmap in cstring for
fragile ABIs which would already have that problem if it exists. But as you
say, maybe zero bytes aren't possible.
Alternatively, if we want to be safe we could keep most of this PR as is, but
introduce a new section for the NonFragileABI case. Could later teach ld that
this section contains literal content its allowed to dedupe, etc.
https://github.com/llvm/llvm-project/pull/174705
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits