[PATCH] Make NaCl's use of .init_array for static constructors match Linux

Jan Voung jvoung at chromium.org
Tue Mar 10 18:04:15 PDT 2015


looks okay -- a couple nits


================
Comment at: lib/Target/X86/X86TargetMachine.cpp:41
@@ -41,2 +40,3 @@
+  if (TT.isOSLinux() || TT.isOSNaCl())
     return make_unique<X86LinuxTargetObjectFile>();
   if (TT.isOSBinFormatELF())
----------------
nit: the class is called "Linux" but now it applies to Linux and NaCl.

I wonder if the the X86ELFTargetObjectFile and X86Linux should just be merged.

It's kind of odd in terms of naming that the X86ELFTargetObjectFile doesn't call InitializeELF =)

The fact that some systems use ctors and others use init_array is supposed to be controlled by the TM.Options.UseInitArray not so much whether InitializeELF is called or not. On the other hand, I'm not sure if clang sets that option correctly for each user of ELF + X86, so that might be a reason to check that as a separate change.

================
Comment at: test/CodeGen/X86/constructor.ll:33
@@ +32,3 @@
+; NACL:		.section	.init_array.15,"aGw", at init_array,v,comdat
+; NACL:	.align	4
+; NACL:	.long	g
----------------
nit: Can these be NACL-NEXT for uniformity?

http://reviews.llvm.org/D8240

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list