[PATCH] D52344: [Clang][CodeGen][ObjC]: Fix non-bridged CoreFoundation builds on ELF targets that use `-fconstant-cfstrings`.

Kristina Brooks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 21 16:35:43 PDT 2018


kristina updated this revision to Diff 166576.
kristina added a comment.

Does this look about right? I'm not sure what's up with DSO local attribute, it doesn't seem to apply, I think this test makes sense though. `ninja check-clang-codegen` succeeded this time:

  Testing Time: 12.77s
    Expected Passes    : 1242
    Expected Failures  : 2
    Unsupported Tests  : 120

Bitcode looks like this (for the 3rd case, which is a fairly odd one since it's a variable sized array without extern):

  /q/org.llvm.caches/llvm-8.0/4132/bin/clang -cc1 -internal-isystem /q/org.llvm.caches/llvm-8.0/4132/lib/clang/8.0.4132/include -nostdsysteminc -triple x86_64-elf -S -emit-llvm /SourceCache/llvm-trunk-8.0.4132/tools/clang/test/CodeGen/cfstring-elf.c -o -
  
  ; ModuleID = '/SourceCache/llvm-trunk-8.0.4132/tools/clang/test/CodeGen/cfstring-elf.c'
  source_filename = "/SourceCache/llvm-trunk-8.0.4132/tools/clang/test/CodeGen/cfstring-elf.c"
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-unknown-unknown-elf"
  
  %struct.__NSConstantString_tag = type { i32*, i32, i8*, i64 }
  %struct.__CFString = type opaque
  
  @.str = private unnamed_addr constant [7 x i8] c"string\00", section ".rodata", align 1
  @_unnamed_cfstring_ = private global %struct.__NSConstantString_tag { i32* getelementptr inbounds ([0 x i32], [0 x i32]* bitcast ([1 x i64]* @__CFConstantStringClassReference to [0 x i32]*), i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i64 6 }, section "cfstring", align 8
  @string = constant %struct.__CFString* bitcast (%struct.__NSConstantString_tag* @_unnamed_cfstring_ to %struct.__CFString*), align 8
  @__CFConstantStringClassReference = common global [1 x i64] zeroinitializer, align 8
  
  !llvm.module.flags = !{!0}
  !llvm.ident = !{!1}
  
  !0 = !{i32 1, !"wchar_size", i32 4}
  !1 = !{!"Kristina's toolchain (8.0.4132+assert+modules+thinlto+tests+debug) clang version 8.0.4132 (https://llvm.googlesource.com/clang 8c1a8e6be4042ef6e930f19162f5e308ac56a38e) (https://llvm.googlesource.com/llvm bf40f1cb4e37e0046f94428f6332255ccf00e440) (based on LLVM 8.0.4132svn)"}


Repository:
  rC Clang

https://reviews.llvm.org/D52344

Files:
  lib/CodeGen/CodeGenModule.cpp
  test/CodeGen/cfstring-elf.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52344.166576.patch
Type: text/x-patch
Size: 5598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180921/459ec1f3/attachment-0001.bin>


More information about the cfe-commits mailing list