[llvm-branch-commits] [libunwind] release/19.x: [libunwind] Add GCS support for AArch64 (#99335) (PR #101888)

2024-08-04 Thread Nico Weber via llvm-branch-commits

nico wrote:

FYI, this seems to break building on Android, see comment on original PR. Maybe 
worth waiting with the cherry pick until that's resolved.

https://github.com/llvm/llvm-project/pull/101888
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [libcxx] release/18.x: [libc++] Simplify the implementation of (#86843) (PR #87374)

2024-04-10 Thread Nico Weber via llvm-branch-commits

nico wrote:

As mentioned on #86843, this breaks using `-pedantic` in code that includes 
libc++ headers. Since this got cherry-picked (…why? doesn't seem urgent?), we 
also must cherry-pick #88214.

https://github.com/llvm/llvm-project/pull/87374
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 8cd7184 - [gn] port 12bb2910c3e3

2023-11-28 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2023-11-28T08:33:41+09:00
New Revision: 8cd7184dc0f1e5e28e39b03c90bc9aeee96d104f

URL: 
https://github.com/llvm/llvm-project/commit/8cd7184dc0f1e5e28e39b03c90bc9aeee96d104f
DIFF: 
https://github.com/llvm/llvm-project/commit/8cd7184dc0f1e5e28e39b03c90bc9aeee96d104f.diff

LOG: [gn] port 12bb2910c3e3

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn
llvm/utils/gn/secondary/libcxx/src/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index 5017c2888a14093..4a7105f8253234e 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -989,22 +989,12 @@ if (current_toolchain == default_toolchain) {
   "experimental/__simd/traits.h",
   "experimental/__simd/utility.h",
   "experimental/__simd/vec_ext.h",
-  "experimental/deque",
-  "experimental/forward_list",
   "experimental/iterator",
-  "experimental/list",
-  "experimental/map",
-  "experimental/memory_resource",
+  "experimental/memory",
   "experimental/propagate_const",
-  "experimental/regex",
-  "experimental/set",
   "experimental/simd",
-  "experimental/string",
   "experimental/type_traits",
-  "experimental/unordered_map",
-  "experimental/unordered_set",
   "experimental/utility",
-  "experimental/vector",
   "ext/__hash",
   "ext/hash_map",
   "ext/hash_set",

diff  --git a/llvm/utils/gn/secondary/libcxx/src/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/src/BUILD.gn
index b50e9278e04538f..3cd6e9ef26cb421 100644
--- a/llvm/utils/gn/secondary/libcxx/src/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/src/BUILD.gn
@@ -307,7 +307,7 @@ if (libcxx_enable_experimental) {
   static_library("cxx_experimental") {
 output_dir = runtimes_dir
 output_name = "c++experimental"
-sources = [ "experimental/memory_resource.cpp" ]
+sources = [ "experimental/keep.cpp" ]
 if (libcxx_enable_filesystem && libcxx_enable_time_zone_database) {
   sources += [
 "tz.cpp",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ed65602 - [gn] add a bunch of missing libc++ headers

2023-11-28 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2023-11-28T08:40:19+09:00
New Revision: ed6560240d5b0e2faa993e86d0ded0f5be0c8d19

URL: 
https://github.com/llvm/llvm-project/commit/ed6560240d5b0e2faa993e86d0ded0f5be0c8d19
DIFF: 
https://github.com/llvm/llvm-project/commit/ed6560240d5b0e2faa993e86d0ded0f5be0c8d19.diff

LOG: [gn] add a bunch of missing libc++ headers

Ports:
* fcaccf817d31d (mdspan)
* 73d94b1916135 (source_location)
* b77e50e6aef56 (stop_token)
* 7cc72a0a2ec22 (syncstream)

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index 4a7105f8253234e..c698338792e22be 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -1021,6 +1021,7 @@ if (current_toolchain == default_toolchain) {
   "locale.h",
   "map",
   "math.h",
+  "mdspan",
   "memory",
   "memory_resource",
   "mutex",
@@ -1039,6 +1040,7 @@ if (current_toolchain == default_toolchain) {
   "semaphore",
   "set",
   "shared_mutex",
+  "source_location",
   "span",
   "sstream",
   "stack",
@@ -1049,11 +1051,13 @@ if (current_toolchain == default_toolchain) {
   "stdint.h",
   "stdio.h",
   "stdlib.h",
+  "stop_token",
   "streambuf",
   "string",
   "string.h",
   "string_view",
   "strstream",
+  "syncstream",
   "system_error",
   "tgmath.h",
   "thread",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] be1e8a6 - [gn] port 12bb2910c3e3 more

2023-11-28 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2023-11-28T08:43:16+09:00
New Revision: be1e8a659df5003fa74e1f55c40acf3667f3cdb9

URL: 
https://github.com/llvm/llvm-project/commit/be1e8a659df5003fa74e1f55c40acf3667f3cdb9
DIFF: 
https://github.com/llvm/llvm-project/commit/be1e8a659df5003fa74e1f55c40acf3667f3cdb9.diff

LOG: [gn] port 12bb2910c3e3 more

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index c698338792e22be..0e878ab39ce93ba 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -62,11 +62,7 @@ if (current_toolchain == default_toolchain) {
 output = "$libcxx_generated_include_dir/module.modulemap"
 
 #no = "requires LIBCXX_CONFIGURED_WITHOUT_SUPPORT_FOR_THIS_HEADER"
-values = [
-  # An empty value here means the feature is supported.
-  # Unsupported values should be set to `$no`.
-  "requires_LIBCXX_ENABLE_LOCALIZATION=",
-]
+values = []
   }
 
   copy("copy_headers") {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lldb] a6c62bf - [lldb] try to fix build on linux after fc6b72523f3d7

2023-11-28 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2023-11-28T08:53:05+09:00
New Revision: a6c62bf1a4717accc852463b664cd1012237d334

URL: 
https://github.com/llvm/llvm-project/commit/a6c62bf1a4717accc852463b664cd1012237d334
DIFF: 
https://github.com/llvm/llvm-project/commit/a6c62bf1a4717accc852463b664cd1012237d334.diff

LOG: [lldb] try to fix build on linux after fc6b72523f3d7

Tries to fix:

../../lldb/source/Breakpoint/WatchpointResource.cpp:59:12:
error: no member named 'find' in namespace 'std'; did you mean 'fill'?
  std::find(m_constituents.begin(), m_constituents.end(), wp_sp);
  ~^~~~
   fill

Added: 


Modified: 
lldb/source/Breakpoint/WatchpointResource.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/WatchpointResource.cpp 
b/lldb/source/Breakpoint/WatchpointResource.cpp
index 4b8fbe42c865e25..d0f8dc346f3c024 100644
--- a/lldb/source/Breakpoint/WatchpointResource.cpp
+++ b/lldb/source/Breakpoint/WatchpointResource.cpp
@@ -10,6 +10,8 @@
 
 #include "lldb/Breakpoint/WatchpointResource.h"
 
+#include 
+
 using namespace lldb;
 using namespace lldb_private;
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] f807825 - Revert "[JITLink] Enable exception handling for ELF."

2021-01-25 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-25T11:00:38-05:00
New Revision: f80782590c6cdba88e0072792b238ae8a5a4223d

URL: 
https://github.com/llvm/llvm-project/commit/f80782590c6cdba88e0072792b238ae8a5a4223d
DIFF: 
https://github.com/llvm/llvm-project/commit/f80782590c6cdba88e0072792b238ae8a5a4223d.diff

LOG: Revert "[JITLink] Enable exception handling for ELF."

This reverts commit 6884fbc2c4fb46d0528c02d16d510f4f725fac11.
Breaks tests on Windows: http://45.33.8.238/win/31981/step_11.txt

Added: 


Modified: 
llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
llvm/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h
llvm/lib/ExecutionEngine/JITLink/ELF_x86_64.cpp
llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h
llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp

Removed: 
llvm/test/ExecutionEngine/JITLink/X86/ELF_ehframe_basic.s



diff  --git a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp 
b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
index 3602601287f4..8b730bc23ce0 100644
--- a/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
+++ b/llvm/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp
@@ -119,10 +119,9 @@ Error EHFrameSplitter::processBlock(LinkGraph &G, Block &B,
 }
 
 EHFrameEdgeFixer::EHFrameEdgeFixer(StringRef EHFrameSectionName,
-   unsigned PointerSize, Edge::Kind Delta64,
-   Edge::Kind Delta32, Edge::Kind NegDelta32)
-: EHFrameSectionName(EHFrameSectionName), PointerSize(PointerSize),
-  Delta64(Delta64), Delta32(Delta32), NegDelta32(NegDelta32) {}
+   Edge::Kind Delta64, Edge::Kind NegDelta32)
+: EHFrameSectionName(EHFrameSectionName), Delta64(Delta64),
+  NegDelta32(NegDelta32) {}
 
 Error EHFrameEdgeFixer::operator()(LinkGraph &G) {
   auto *EHFrame = G.findSectionByName(EHFrameSectionName);
@@ -135,11 +134,6 @@ Error EHFrameEdgeFixer::operator()(LinkGraph &G) {
 return Error::success();
   }
 
-  // Check that we support the graph's pointer size.
-  if (G.getPointerSize() != 4 && G.getPointerSize() != 8)
-return make_error(
-"EHFrameEdgeFixer only supports 32 and 64 bit targets");
-
   LLVM_DEBUG({
 dbgs() << "EHFrameEdgeFixer: Processing " << EHFrameSectionName << "...\n";
   });
@@ -264,6 +258,7 @@ Error EHFrameEdgeFixer::processBlock(ParseContext &PC, 
Block &B) {
 Error EHFrameEdgeFixer::processCIE(ParseContext &PC, Block &B,
size_t RecordOffset, size_t RecordLength,
size_t CIEDeltaFieldOffset) {
+  using namespace dwarf;
 
   LLVM_DEBUG(dbgs() << "  Record is CIE\n");
 
@@ -334,12 +329,11 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, 
Block &B,
   uint8_t LSDAPointerEncoding;
   if (auto Err = RecordReader.readInteger(LSDAPointerEncoding))
 return Err;
-  if (!isSupportedPointerEncoding(LSDAPointerEncoding))
+  if (LSDAPointerEncoding != (DW_EH_PE_pcrel | DW_EH_PE_absptr))
 return make_error(
 "Unsupported LSDA pointer encoding " +
 formatv("{0:x2}", LSDAPointerEncoding) + " in CIE at " +
 formatv("{0:x16}", CIESymbol.getAddress()));
-  CIEInfo.LSDAPointerEncoding = LSDAPointerEncoding;
   break;
 }
 case 'P': {
@@ -347,8 +341,7 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, Block 
&B,
   if (auto Err = RecordReader.readInteger(PersonalityPointerEncoding))
 return Err;
   if (PersonalityPointerEncoding !=
-  (dwarf::DW_EH_PE_indirect | dwarf::DW_EH_PE_pcrel |
-   dwarf::DW_EH_PE_sdata4))
+  (DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4))
 return make_error(
 "Unspported personality pointer "
 "encoding " +
@@ -363,12 +356,12 @@ Error EHFrameEdgeFixer::processCIE(ParseContext &PC, 
Block &B,
   uint8_t FDEPointerEncoding;
   if (auto Err = RecordReader.readInteger(FDEPointerEncoding))
 return Err;
-  if (!isSupportedPointerEncoding(FDEPointerEncoding))
+  if (FDEPointerEncoding != (DW_EH_PE_pcrel | DW_EH_PE_absptr))
 return make_error(
-"Unsupported FDE pointer encoding " +
+"Unsupported FDE address pointer "
+"encoding " +
 formatv("{0:x2}", FDEPointerEncoding) + " in CIE at " +
 formatv("{0:x16}", CIESymbol.getAddress()));
-  CIEInfo.FDEPointerEncoding = FDEPointerEncoding;
   break;
 }
 default:
@@ -452,13 +445,11 @@ Error EHFrameEdgeFixer::processFDE(ParseContext &PC, 
Block &B,
 JITTargetAddress PCBeginFieldOffset = RecordReader.getOffset();
 auto PCEdgeItr = BlockEdges.find(RecordOffset + PCBeginFieldOffset);
 if (PCEdgeItr == BlockEdges.end()) {
-  auto PCBeginPtrInfo =
-  readEncodedPointer(CIEInfo->FDEPointerEncoding,
- 

[llvm-branch-commits] [cfe-branch] r277751 - Add a note about clang-cl pch support to the 3.9 release notes.

2016-08-11 Thread Nico Weber via llvm-branch-commits
Author: nico
Date: Thu Aug  4 13:55:57 2016
New Revision: 277751

URL: http://llvm.org/viewvc/llvm-project?rev=277751&view=rev
Log:
Add a note about clang-cl pch support to the 3.9 release notes.

Modified:
cfe/branches/release_39/docs/ReleaseNotes.rst

Modified: cfe/branches/release_39/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/docs/ReleaseNotes.rst?rev=277751&r1=277750&r2=277751&view=diff
==
--- cfe/branches/release_39/docs/ReleaseNotes.rst (original)
+++ cfe/branches/release_39/docs/ReleaseNotes.rst Thu Aug  4 13:55:57 2016
@@ -95,6 +95,11 @@ TLS is enabled for Cygwin defaults to -f
 Proper support, including correct mangling and overloading, added for
 MS-specific "__unaligned" type qualifier.
 
+clang-cl now has limited support for the precompiled header flags /Yc, /Yu, and
+/Fp.  If the precompiled header is passed on the compile command with /FI, then
+the precompiled header flags are honored.  But if the precompiled header is
+included by an `#include ` in each source file instead of by a
+`/FIstdafx.h` flag, these flag continue to be ignored.
 
 C Language Changes in Clang
 ---


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [cfe-branch] r277750 - grammar fix

2016-08-11 Thread Nico Weber via llvm-branch-commits
Author: nico
Date: Thu Aug  4 13:52:17 2016
New Revision: 277750

URL: http://llvm.org/viewvc/llvm-project?rev=277750&view=rev
Log:
grammar fix

Modified:
cfe/branches/release_39/docs/ReleaseNotes.rst

Modified: cfe/branches/release_39/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_39/docs/ReleaseNotes.rst?rev=277750&r1=277749&r2=277750&view=diff
==
--- cfe/branches/release_39/docs/ReleaseNotes.rst (original)
+++ cfe/branches/release_39/docs/ReleaseNotes.rst Thu Aug  4 13:52:17 2016
@@ -47,7 +47,7 @@ sections with improvements to Clang's su
 Major New Features
 --
 
-- Clang will no longer passes --build-id by default to the linker. In modern
+- Clang will no longer pass --build-id by default to the linker. In modern
   linkers that is a relatively expensive option. It can be passed explicitly
   with -Wl,--build-id. To have clang always pass it, build clang with
   -DENABLE_LINKER_BUILD_ID.


___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 25b3921 - [gn build] (manually) port 79f99ba65d96

2021-01-12 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-12T20:30:56-05:00
New Revision: 25b3921f2fcd8fb3241c2f79e488f25a6374b99f

URL: 
https://github.com/llvm/llvm-project/commit/25b3921f2fcd8fb3241c2f79e488f25a6374b99f
DIFF: 
https://github.com/llvm/llvm-project/commit/25b3921f2fcd8fb3241c2f79e488f25a6374b99f.diff

LOG: [gn build] (manually) port 79f99ba65d96

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index 64253c6e72df..f1f1f37686e2 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -209,6 +209,7 @@ copy("include") {
 "support/musl/xlocale.h",
 "support/newlib/xlocale.h",
 "support/nuttx/xlocale.h",
+"support/openbsd/xlocale.h",
 "support/solaris/floatingpoint.h",
 "support/solaris/wchar.h",
 "support/solaris/xlocale.h",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] acea470 - [gn build] Reorganize libcxx/include/BUILD.gn a bit

2021-01-12 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-12T21:30:06-05:00
New Revision: acea470c167fc40990d9a0f06d625a34d8a4a146

URL: 
https://github.com/llvm/llvm-project/commit/acea470c167fc40990d9a0f06d625a34d8a4a146
DIFF: 
https://github.com/llvm/llvm-project/commit/acea470c167fc40990d9a0f06d625a34d8a4a146.diff

LOG: [gn build] Reorganize libcxx/include/BUILD.gn a bit

- Merge 6706342f48bea80 -- no more libcxx_needs_site_config, we now
  always need it
- Since it was always off in practice, write_config bitrot. Unbitrot
  it so that it works
- Remove copy step and let concat step write to final location
  immediately -- and fix copy destination directory

As a side effect, libcxx/include/BUILD.gn now has only a single
sources list, which means the cmake sync script should be able to
automatically sync additions and removals of .h files. On the flipside,
this means this file now must be updated after most changes to
libcxx/include/__config_site.in, and looking through the last few months
of changes this looks like it's going to be a wash.

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index f1f1f37686e2..4d7cdbefb2e6 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -1,52 +1,68 @@
-import("//clang/resource_dir.gni")
 import("//libcxx/config.gni")
 import("//llvm/utils/gn/build/write_cmake_config.gni")
 
-libcxx_needs_site_config =
-libcxx_abi_version != 1 || libcxx_abi_namespace != "" || 
libcxx_abi_unstable
+write_cmake_config("write_config") {
+  input = "__config_site.in"
+  output = "$target_gen_dir/__config_site"
 
-if (libcxx_needs_site_config) {
-  write_cmake_config("write_config") {
-input = "__config_site.in"
-output = "$target_gen_dir/__config_site"
-
-values = []
-if (libcxx_abi_version != 1) {
-  values += [ "_LIBCPP_ABI_VERSION=$libcxx_abi_version" ]
-}
-if (libcxx_abi_namespace != "") {
-  values += [ "_LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace" ]
-}
-if (libcxx_abi_unstable) {
-  values += [ "_LIBCPP_ABI_UNSTABLE=1" ]
-}
+  values = [
+"_LIBCPP_ABI_FORCE_ITANIUM=",
+"_LIBCPP_ABI_FORCE_MICROSOFT=",
+"_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT=",
+"_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE=",
+"_LIBCPP_HAS_NO_STDIN=",
+"_LIBCPP_HAS_NO_STDOUT=",
+"_LIBCPP_HAS_NO_THREADS=",
+"_LIBCPP_HAS_NO_MONOTONIC_CLOCK=",
+"_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS=",
+"_LIBCPP_HAS_MUSL_LIBC=",
+"_LIBCPP_HAS_THREAD_API_PTHREAD=",
+"_LIBCPP_HAS_THREAD_API_EXTERNAL=",
+"_LIBCPP_HAS_THREAD_API_WIN32=",
+"_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL=",
+"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=",
+"_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS=1",
+"_LIBCPP_NO_VCRUNTIME=",
+"_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=",
+"_LIBCPP_ABI_NAMESPACE=",
+"_LIBCPP_HAS_PARALLEL_ALGORITHMS=",
+"_LIBCPP_HAS_NO_RANDOM_DEVICE=",
+"_LIBCPP_HAS_NO_LOCALIZATION=",
+"_LIBCPP_ABI_DEFINES=",
+  ]
+  if (libcxx_abi_version != 1) {
+values += [ "_LIBCPP_ABI_VERSION=$libcxx_abi_version" ]
+  } else {
+values += [ "_LIBCPP_ABI_VERSION=" ]
   }
-
-  # Generate a custom __config header. The new header is created
-  # by prepending __config_site to the current __config header.
-  action("concat_config") {
-script = "//libcxx/utils/cat_files.py"
-inputs = [
-  "$target_gen_dir/__config_site",
-  "__config",
-]
-outputs = [ "$target_gen_dir/__config" ]
-args = [
-  "$target_gen_dir/__config_site",
-  "__config",
-  "-o",
-  "$target_gen_dir/__config",
-]
-deps = [ ":write_config" ]
+  if (libcxx_abi_namespace != "") {
+values += [ "_LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace" ]
   }
-
-  copy("copy_config") {
-sources = [ "$target_gen_dir/__config" ]
-outputs = [ "$clang_resource_dir/include/c++/v1/{{source_file_part}}" ]
-deps = [ ":concat_config" ]
+  if (libcxx_abi_unstable) {
+values += [ "_LIBCPP_ABI_UNSTABLE=1" ]
+  } else {
+values += [ "_LIBCPP_ABI_UNSTABLE=" ]
   }
 }
 
+# Generate a custom __config header. The new header is created
+# by prepending __config_site to the current __config header.
+action("concat_config") {
+  script = "//libcxx/utils/cat_files.py"
+  inputs = [
+"$target_gen_dir/__config_site",
+"__config",
+  ]
+  outputs = [ "$root_build_dir/include/c++/v1/__config" ]
+  args = [
+rebase_path("$target_gen_dir/__config_site", root_build_dir),
+rebase_path("__config", root_build_dir),
+"-o",
+rebase_path(outputs[0], root_build_dir)
+  ]
+  deps = [ ":write_config" ]
+}
+
 copy("include") {
   sources = [
 "__availability",
@@ -235,7 +251,7 @@ copy("include") {
 "wchar.h",
 "wctyp

[llvm-branch-commits] [compiler-rt] 704831f - Revert "Hwasan InitPrctl check for error using internal_iserror"

2021-01-13 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-13T08:30:11-05:00
New Revision: 704831fe1f1f02e41ab7440a6f6c2c390ec183b1

URL: 
https://github.com/llvm/llvm-project/commit/704831fe1f1f02e41ab7440a6f6c2c390ec183b1
DIFF: 
https://github.com/llvm/llvm-project/commit/704831fe1f1f02e41ab7440a6f6c2c390ec183b1.diff

LOG: Revert "Hwasan InitPrctl check for error using internal_iserror"

This reverts commit 1854594b80b444dc21b830b51e53e05d38fc7d60.
See https://reviews.llvm.org/D94425#2495621

Added: 


Modified: 
compiler-rt/lib/hwasan/hwasan_linux.cpp

Removed: 




diff  --git a/compiler-rt/lib/hwasan/hwasan_linux.cpp 
b/compiler-rt/lib/hwasan/hwasan_linux.cpp
index 793fd2fab6bf..e99926d355cf 100644
--- a/compiler-rt/lib/hwasan/hwasan_linux.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_linux.cpp
@@ -119,10 +119,8 @@ void InitPrctl() {
 #define PR_GET_TAGGED_ADDR_CTRL 56
 #define PR_TAGGED_ADDR_ENABLE (1UL << 0)
   // Check we're running on a kernel that can use the tagged address ABI.
-  int local_errno = 0;
-  if (internal_iserror(internal_prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0),
-   &local_errno) &&
-  local_errno == EINVAL) {
+  if (internal_prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0) == (uptr)-1 &&
+  errno == EINVAL) {
 #if SANITIZER_ANDROID
 // Some older Android kernels have the tagged pointer ABI on
 // unconditionally, and hence don't have the tagged-addr prctl while still
@@ -139,8 +137,8 @@ void InitPrctl() {
   }
 
   // Turn on the tagged address ABI.
-  if (internal_iserror(internal_prctl(PR_SET_TAGGED_ADDR_CTRL,
-  PR_TAGGED_ADDR_ENABLE, 0, 0, 0)) ||
+  if (internal_prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) 
==
+  (uptr)-1 ||
   !internal_prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0)) {
 Printf(
 "FATAL: HWAddressSanitizer failed to enable tagged address syscall "



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 0975604 - [gn build] (manually) port 387d3c24792f

2021-01-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-14T16:19:25-05:00
New Revision: 0975604cc013b51ef2435199bd74a6d635b11150

URL: 
https://github.com/llvm/llvm-project/commit/0975604cc013b51ef2435199bd74a6d635b11150
DIFF: 
https://github.com/llvm/llvm-project/commit/0975604cc013b51ef2435199bd74a6d635b11150.diff

LOG: [gn build] (manually) port 387d3c24792f

Added: 


Modified: 
llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn
llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn
llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn
llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn

Removed: 
llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn



diff  --git a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn
index 5469696c0de3..55f10cd5c82b 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/AsmParser/BUILD.gn
@@ -18,7 +18,6 @@ static_library("AsmParser") {
 "//llvm/lib/Support",
 "//llvm/lib/Target/RISCV:RISCVGenCompressInstEmitter",
 "//llvm/lib/Target/RISCV/MCTargetDesc",
-"//llvm/lib/Target/RISCV/Utils",
   ]
   include_dirs = [ ".." ]
   sources = [ "RISCVAsmParser.cpp" ]

diff  --git a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn
index c63ab84d9baf..366623cb0fad 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/BUILD.gn
@@ -50,7 +50,6 @@ static_library("LLVMRISCVCodeGen") {
 "AsmParser:RISCVGenAsmMatcher",
 "MCTargetDesc",
 "TargetInfo",
-"Utils",
 "//llvm/include/llvm/Config:llvm-config",
 "//llvm/lib/CodeGen",
 "//llvm/lib/CodeGen/AsmPrinter",
@@ -97,6 +96,5 @@ group("RISCV") {
 "Disassembler",
 "MCTargetDesc",
 "TargetInfo",
-"Utils",
   ]
 }

diff  --git 
a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn
index 09a5a367164a..cb579221fd36 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Disassembler/BUILD.gn
@@ -13,7 +13,6 @@ static_library("Disassembler") {
 "//llvm/lib/MC/MCDisassembler",
 "//llvm/lib/Support",
 "//llvm/lib/Target/RISCV/MCTargetDesc",
-"//llvm/lib/Target/RISCV/Utils",
   ]
   include_dirs = [ ".." ]
   sources = [ "RISCVDisassembler.cpp" ]

diff  --git 
a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn
index f6326a596920..47d526840fe0 100644
--- a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/MCTargetDesc/BUILD.gn
@@ -24,6 +24,12 @@ tablegen("RISCVGenRegisterInfo") {
   td_file = "../RISCV.td"
 }
 
+tablegen("RISCVGenSearchableTables") {
+  visibility = [ ":tablegen" ]
+  args = [ "-gen-searchable-tables" ]
+  td_file = "../RISCV.td"
+}
+
 tablegen("RISCVGenSubtargetInfo") {
   visibility = [ ":tablegen" ]
   args = [ "-gen-subtarget" ]
@@ -36,11 +42,11 @@ tablegen("RISCVGenSubtargetInfo") {
 group("tablegen") {
   visibility = [
 ":MCTargetDesc",
-"../Utils",
   ]
   public_deps = [
 ":RISCVGenInstrInfo",
 ":RISCVGenRegisterInfo",
+":RISCVGenSearchableTables",
 ":RISCVGenSubtargetInfo",
   ]
 }
@@ -54,11 +60,11 @@ static_library("MCTargetDesc") {
 "//llvm/lib/MC",
 "//llvm/lib/Support",
 "//llvm/lib/Target/RISCV:RISCVGenCompressInstEmitter",
-"//llvm/lib/Target/RISCV/Utils",
   ]
   include_dirs = [ ".." ]
   sources = [
 "RISCVAsmBackend.cpp",
+"RISCVBaseInfo.cpp",
 "RISCVELFObjectWriter.cpp",
 "RISCVELFStreamer.cpp",
 "RISCVInstPrinter.cpp",
@@ -66,6 +72,7 @@ static_library("MCTargetDesc") {
 "RISCVMCCodeEmitter.cpp",
 "RISCVMCExpr.cpp",
 "RISCVMCTargetDesc.cpp",
+"RISCVMatInt.cpp",
 "RISCVTargetStreamer.cpp",
   ]
 }

diff  --git a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn
deleted file mode 100644
index 5bce835f1dd2..
--- a/llvm/utils/gn/secondary/llvm/lib/Target/RISCV/Utils/BUILD.gn
+++ /dev/null
@@ -1,27 +0,0 @@
-import("//llvm/utils/TableGen/tablegen.gni")
-
-# Generates RISCVGenSearchableTables.inc
-tablegen("RISCVGenSearchableTables") {
-  visibility = [ ":Utils" ]
-  args = [ "-gen-searchable-tables" ]
-  td_file = "../RISCV.td"
-}
-
-static_library("Utils") {
-  output_name = "LLVMRISCVUtils"
-  public_deps = [ ":RISCVGenSearchableTables" ]
-  deps = [
-"//llvm/lib/MC",
-"//llvm/lib/Support",
-
-# MCTargetDesc depends on Utils, so we can't de

[llvm-branch-commits] [llvm] be59bac - [gn build] (manually) port 933518fff82c

2021-01-19 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-19T18:51:39-05:00
New Revision: be59bac184e3a3ccdd3c7f41f31e48ffe77f443d

URL: 
https://github.com/llvm/llvm-project/commit/be59bac184e3a3ccdd3c7f41f31e48ffe77f443d
DIFF: 
https://github.com/llvm/llvm-project/commit/be59bac184e3a3ccdd3c7f41f31e48ffe77f443d.diff

LOG: [gn build] (manually) port 933518fff82c

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index 4d7cdbefb2e6..faaaf049b063 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -9,6 +9,7 @@ write_cmake_config("write_config") {
 "_LIBCPP_ABI_FORCE_ITANIUM=",
 "_LIBCPP_ABI_FORCE_MICROSOFT=",
 "_LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT=",
+"_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY=",
 "_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE=",
 "_LIBCPP_HAS_NO_STDIN=",
 "_LIBCPP_HAS_NO_STDOUT=",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 7f36df0 - [gn build] fix libcxx gn file with libcxx_abi_namespace set

2021-01-19 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-19T19:02:40-05:00
New Revision: 7f36df0fb19c08879822cf5b7d4bba300fc8c058

URL: 
https://github.com/llvm/llvm-project/commit/7f36df0fb19c08879822cf5b7d4bba300fc8c058
DIFF: 
https://github.com/llvm/llvm-project/commit/7f36df0fb19c08879822cf5b7d4bba300fc8c058.diff

LOG: [gn build] fix libcxx gn file with libcxx_abi_namespace set

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index faaaf049b063..644f0a767558 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -25,7 +25,6 @@ write_cmake_config("write_config") {
 "_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS=1",
 "_LIBCPP_NO_VCRUNTIME=",
 "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION=",
-"_LIBCPP_ABI_NAMESPACE=",
 "_LIBCPP_HAS_PARALLEL_ALGORITHMS=",
 "_LIBCPP_HAS_NO_RANDOM_DEVICE=",
 "_LIBCPP_HAS_NO_LOCALIZATION=",
@@ -38,6 +37,8 @@ write_cmake_config("write_config") {
   }
   if (libcxx_abi_namespace != "") {
 values += [ "_LIBCPP_ABI_NAMESPACE=$libcxx_abi_namespace" ]
+  } else {
+values += [ "_LIBCPP_ABI_NAMESPACE=" ]
   }
   if (libcxx_abi_unstable) {
 values += [ "_LIBCPP_ABI_UNSTABLE=1" ]



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] c1e85b6 - sanitizer: fix typo/spelling: Dissassemble → Disassemble

2020-12-29 Thread Nico Weber via llvm-branch-commits

Author: Michael Stapelberg
Date: 2020-12-29T12:26:57-05:00
New Revision: c1e85b6c1b4d83d24b130b191112e1b99cf74a8a

URL: 
https://github.com/llvm/llvm-project/commit/c1e85b6c1b4d83d24b130b191112e1b99cf74a8a
DIFF: 
https://github.com/llvm/llvm-project/commit/c1e85b6c1b4d83d24b130b191112e1b99cf74a8a.diff

LOG: sanitizer: fix typo/spelling: Dissassemble → Disassemble

Differential Revision: https://reviews.llvm.org/D93902

Added: 


Modified: 
compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp

Removed: 




diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp 
b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
index 06301b83ea1f..c99a6ceaa562 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_report.cpp
@@ -211,7 +211,7 @@ static void ReportDeadlySignalImpl(const SignalContext 
&sig, u32 tid,
 Report("The signal is caused by a %s memory access.\n", access_type);
 if (!sig.is_true_faulting_addr)
   Report("Hint: this fault was caused by a dereference of a high value "
- "address (see register values below).  Dissassemble the provided "
+ "address (see register values below).  Disassemble the provided "
  "pc to learn which register was used.\n");
 else if (sig.addr < GetPageSizeCached())
   Report("Hint: address points to the zero page.\n");



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 51a292d - [gn build] Switch copy_bundle_data from pax to cpio

2020-12-30 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-30T13:59:03-05:00
New Revision: 51a292d994535d14af1873f09534a352da1d5456

URL: 
https://github.com/llvm/llvm-project/commit/51a292d994535d14af1873f09534a352da1d5456
DIFF: 
https://github.com/llvm/llvm-project/commit/51a292d994535d14af1873f09534a352da1d5456.diff

LOG: [gn build] Switch copy_bundle_data from pax to cpio

This will hopefully fix the build not becoming clean when using Ninja
1.9+. Ninja 1.9 enabled high-resolution time stamps, but pax doesn't
correctly set high-resolution timestamps on its output.

See https://github.com/nico/hack/blob/master/notes/copydir.md for a
detailed writeup of problem and alternatives.

Added: 


Modified: 
llvm/utils/gn/build/toolchain/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/build/toolchain/BUILD.gn 
b/llvm/utils/gn/build/toolchain/BUILD.gn
index 570ab1d31fdd..d01cad98e190 100644
--- a/llvm/utils/gn/build/toolchain/BUILD.gn
+++ b/llvm/utils/gn/build/toolchain/BUILD.gn
@@ -143,9 +143,9 @@ template("unix_toolchain") {
 
 if (current_os == "ios" || current_os == "mac") {
   tool("copy_bundle_data") {
-# http://serverfault.com/q/209888/43689
-_copydir = "mkdir -p {{output}} && cd {{source}} && " +
-   "pax -rwl . \"\$OLDPWD\"/{{output}}"
+# https://github.com/nico/hack/blob/master/notes/copydir.md
+_copydir = "cd {{source}} && " +
+   "find . | cpio -pdl \"\$OLDPWD\"/{{output}} 2>/dev/null"
 command = "rm -rf {{output}} && if [[ -d {{source}} ]]; then " +
   _copydir + "; else " + copy_command + "; fi"
 description = "COPY_BUNDLE_DATA {{source}} {{output}}"



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 8886be2 - [lld/mac] Add -adhoc_codesign / -no_adhoc_codesign flags

2020-12-30 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-30T20:57:25-05:00
New Revision: 8886be242de8af6531204e2586b023f03b56992a

URL: 
https://github.com/llvm/llvm-project/commit/8886be242de8af6531204e2586b023f03b56992a
DIFF: 
https://github.com/llvm/llvm-project/commit/8886be242de8af6531204e2586b023f03b56992a.diff

LOG: [lld/mac] Add -adhoc_codesign / -no_adhoc_codesign flags

These are new in Xcode 12's ld64. lld never codesigns at the moment, so
-no_adhoc_codesign doesn't even have to warn that it's not implemented.

Added: 


Modified: 
lld/MachO/Options.td

Removed: 




diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 8e88c74efc0e..6928cf209eb1 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -512,6 +512,13 @@ def grp_rare : OptionGroup<"rare">, HelpText<"RARELY 
USED">;
 def v : Flag<["-"], "v">,
  HelpText<"Print the linker version and search paths and exit">,
  Group;
+def adhoc_codesign : Flag<["-"], "adhoc_codesign">,
+ HelpText<"Write an ad-hocd code signature to the output file.">,
+ Flags<[HelpHidden]>,
+ Group;
+def no_adhoc_codesign : Flag<["-"], "no_adhoc_codesign">,
+ HelpText<"Do not write an ad-hocd code signature to the output file.">,
+ Group;
 def version_details : Flag<["-"], "version_details">,
  HelpText<"Print the linker version in JSON form">,
  Flags<[HelpHidden]>,



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] fc3f53f - [gn build] (manually) port 5e31e226b5: Use Py3 for the build

2021-01-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-01T22:14:03-05:00
New Revision: fc3f53fcda1adf8720462ba4c45406860514c1b2

URL: 
https://github.com/llvm/llvm-project/commit/fc3f53fcda1adf8720462ba4c45406860514c1b2
DIFF: 
https://github.com/llvm/llvm-project/commit/fc3f53fcda1adf8720462ba4c45406860514c1b2.diff

LOG: [gn build] (manually) port 5e31e226b5: Use Py3 for the build

Made necessary by 20670ba440, the first Py3-only change.

Added: 


Modified: 
llvm/utils/gn/.gn

Removed: 




diff  --git a/llvm/utils/gn/.gn b/llvm/utils/gn/.gn
index 6c77157731e9..4eccc2fc168c 100644
--- a/llvm/utils/gn/.gn
+++ b/llvm/utils/gn/.gn
@@ -8,6 +8,9 @@ buildconfig = "//llvm/utils/gn/build/BUILDCONFIG.gn"
 # whitelisting things here.
 exec_script_whitelist = []
 
+# Execute action() targets using Python 3.
+script_executable = "python3"
+
 # The normal GN setup is to have BUILD.gn files in-tree and a root BUILD.gn
 # file.  Since LLVM's GN build is unofficial, set secondary_source to tell GN
 # that e.g. llvm/lib/Demangle/BUILD.gn is found at



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 5688247 - fix typo to cycle bots

2021-01-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-01T22:28:11-05:00
New Revision: 568824798f658b8dc9ee7f97de6a1178a61e807a

URL: 
https://github.com/llvm/llvm-project/commit/568824798f658b8dc9ee7f97de6a1178a61e807a
DIFF: 
https://github.com/llvm/llvm-project/commit/568824798f658b8dc9ee7f97de6a1178a61e807a.diff

LOG: fix typo to cycle bots

Added: 


Modified: 
lld/MachO/UnwindInfoSection.cpp

Removed: 




diff  --git a/lld/MachO/UnwindInfoSection.cpp b/lld/MachO/UnwindInfoSection.cpp
index b4c3a31f8565..afaa69dac8dc 100644
--- a/lld/MachO/UnwindInfoSection.cpp
+++ b/lld/MachO/UnwindInfoSection.cpp
@@ -165,7 +165,7 @@ void UnwindInfoSection::finalize() {
 });
 
   // Truncate the vector to 127 elements.
-  // Common encoding indexes are limited to 0..126, while enconding
+  // Common encoding indexes are limited to 0..126, while encoding
   // indexes 127..255 are local to each second-level page
   if (commonEncodings.size() > COMMON_ENCODINGS_MAX)
 commonEncodings.resize(COMMON_ENCODINGS_MAX);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] c8dedfe - fix typos to cycle bots

2021-01-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-01T22:58:40-05:00
New Revision: c8dedfe269b1cca34d811ef60162a47db6b88cfc

URL: 
https://github.com/llvm/llvm-project/commit/c8dedfe269b1cca34d811ef60162a47db6b88cfc
DIFF: 
https://github.com/llvm/llvm-project/commit/c8dedfe269b1cca34d811ef60162a47db6b88cfc.diff

LOG: fix typos to cycle bots

Added: 


Modified: 
llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp

Removed: 




diff  --git a/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp 
b/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
index 06b20ba33eec..bf98e974cfec 100644
--- a/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
+++ b/llvm/lib/DebugInfo/CodeView/LazyRandomTypeCollection.cpp
@@ -185,7 +185,7 @@ Error LazyRandomTypeCollection::visitRangeForType(TypeIndex 
TI) {
 // They've asked us to fetch a type index, but the entry we found in the
 // partial offsets array has already been visited.  Since we visit an 
entire
 // block every time, that means this record should have been previously
-// discovered.  Ultimately, this means this is a request for a non-existant
+// discovered.  Ultimately, this means this is a request for a non-existent
 // type index.
 return make_error("Invalid type index");
   }

diff  --git a/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp 
b/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
index e7f032f9c670..63ce302a4e09 100644
--- a/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
+++ b/llvm/lib/DebugInfo/CodeView/RecordSerialization.cpp
@@ -34,7 +34,7 @@ StringRef llvm::codeview::getBytesAsCString(ArrayRef 
LeafData) {
 }
 
 Error llvm::codeview::consume(BinaryStreamReader &Reader, APSInt &Num) {
-  // Used to avoid overload ambiguity on APInt construtor.
+  // Used to avoid overload ambiguity on APInt constructor.
   bool FalseVal = false;
   uint16_t Short;
   if (auto EC = Reader.readInteger(Short))

diff  --git a/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp 
b/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
index bb71c86a0609..7ac376156146 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeRecordMapping.cpp
@@ -232,7 +232,7 @@ Error TypeRecordMapping::visitMemberBegin(CVMemberRecord 
&Record) {
 
   // The largest possible subrecord is one in which there is a record prefix,
   // followed by the subrecord, followed by a continuation, and that entire
-  // sequence spaws `MaxRecordLength` bytes.  So the record's length is
+  // sequence spawns `MaxRecordLength` bytes.  So the record's length is
   // calculated as follows.
 
   constexpr uint32_t ContinuationLength = 8;

diff  --git a/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp 
b/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
index 8c4b640bcd19..587a68142a4a 100644
--- a/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
+++ b/llvm/lib/DebugInfo/CodeView/TypeStreamMerger.cpp
@@ -38,7 +38,7 @@ namespace {
 /// 0x1000.
 ///
 /// Type records are only allowed to use type indices smaller than their own, 
so
-/// a type stream is effectively a topologically sorted DAG. Cycles occuring in
+/// a type stream is effectively a topologically sorted DAG. Cycles occurring 
in
 /// the type graph of the source program are resolved with forward declarations
 /// of composite types. This class implements the following type stream merging
 /// algorithm, which relies on this DAG structure:



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] b4c5e19 - Temporarily disable to clang-tidy tests on Windows

2021-01-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-01T23:19:48-05:00
New Revision: b4c5e19da74773b86662cbe5a7437f72116f3615

URL: 
https://github.com/llvm/llvm-project/commit/b4c5e19da74773b86662cbe5a7437f72116f3615
DIFF: 
https://github.com/llvm/llvm-project/commit/b4c5e19da74773b86662cbe5a7437f72116f3615.diff

LOG: Temporarily disable to clang-tidy tests on Windows

They fail at least on my Win bot after switching it to Py3.
See PR48646 for details.

Added: 


Modified: 

clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp

clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp

Removed: 




diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
index e25eae323094..b3075324efdb 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-macro-usage-custom.cpp
@@ -1,3 +1,6 @@
+// FIXME: PR48646
+// UNSUPPORTED: system-windows
+
 // RUN: %check_clang_tidy %s cppcoreguidelines-macro-usage %t \
 // RUN: -config='{CheckOptions: \
 // RUN:  [{key: cppcoreguidelines-macro-usage.AllowedRegexp, value: 
"DEBUG_*|TEST_*"}]}' --

diff  --git 
a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
index e99edff5cc21..625b7dc9134a 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/readability-identifier-naming-ignored-regexp.cpp
@@ -1,3 +1,6 @@
+// FIXME: PR48646
+// UNSUPPORTED: system-windows
+
 // RUN: %check_clang_tidy %s readability-identifier-naming %t -- \
 // RUN:   -config='{CheckOptions: [ \
 // RUN: {key: readability-identifier-naming.ParameterCase, value: 
CamelCase}, \



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [compiler-rt] fe9976c - Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl"

2021-01-02 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-02T18:59:26-05:00
New Revision: fe9976c02c09f105751f787ec998abeb3414a235

URL: 
https://github.com/llvm/llvm-project/commit/fe9976c02c09f105751f787ec998abeb3414a235
DIFF: 
https://github.com/llvm/llvm-project/commit/fe9976c02c09f105751f787ec998abeb3414a235.diff

LOG: Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX 
feature detection and support musl"

...and follow-ups. It still doesn't build on Android, see 
https://reviews.llvm.org/D93848#2476310

This reverts commit a92d01534f1c4fb79210975573e774d0393f2533.
This reverts commit 52d7e183bf25ea38e1149e39e19d21e6212e701f.
This reverts commit 34489da81b39972b40d2ff5581fe48911339406e.

Added: 


Modified: 
compiler-rt/cmake/Modules/AddCompilerRT.cmake
compiler-rt/lib/asan/asan_interceptors.h
compiler-rt/lib/asan/tests/asan_test.cpp
compiler-rt/lib/interception/interception_linux.cpp
compiler-rt/lib/interception/interception_linux.h
compiler-rt/lib/msan/tests/msan_test.cpp
compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
compiler-rt/lib/sanitizer_common/sanitizer_platform.h
compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp

Removed: 




diff  --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake 
b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
index 361538a58e47..0b8db6a868a1 100644
--- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake
+++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake
@@ -583,7 +583,6 @@ macro(add_custom_libcxx name prefix)
 CMAKE_OBJDUMP
 CMAKE_STRIP
 CMAKE_SYSROOT
-LIBCXX_HAS_MUSL_LIBC
 PYTHON_EXECUTABLE
 Python3_EXECUTABLE
 Python2_EXECUTABLE

diff  --git a/compiler-rt/lib/asan/asan_interceptors.h 
b/compiler-rt/lib/asan/asan_interceptors.h
index 45cdb80b1b64..4266a31cecb9 100644
--- a/compiler-rt/lib/asan/asan_interceptors.h
+++ b/compiler-rt/lib/asan/asan_interceptors.h
@@ -60,7 +60,7 @@ void InitializePlatformInterceptors();
 # define ASAN_USE_ALIAS_ATTRIBUTE_FOR_INDEX 0
 #endif
 
-#if SANITIZER_GLIBC || SANITIZER_SOLARIS
+#if (SANITIZER_LINUX && !SANITIZER_ANDROID) || SANITIZER_SOLARIS
 # define ASAN_INTERCEPT_SWAPCONTEXT 1
 #else
 # define ASAN_INTERCEPT_SWAPCONTEXT 0
@@ -72,7 +72,7 @@ void InitializePlatformInterceptors();
 # define ASAN_INTERCEPT_SIGLONGJMP 0
 #endif
 
-#if SANITIZER_GLIBC
+#if SANITIZER_LINUX && !SANITIZER_ANDROID
 # define ASAN_INTERCEPT___LONGJMP_CHK 1
 #else
 # define ASAN_INTERCEPT___LONGJMP_CHK 0
@@ -106,7 +106,7 @@ void InitializePlatformInterceptors();
 # define ASAN_INTERCEPT_ATEXIT 0
 #endif
 
-#if SANITIZER_GLIBC
+#if SANITIZER_LINUX && !SANITIZER_ANDROID
 # define ASAN_INTERCEPT___STRDUP 1
 #else
 # define ASAN_INTERCEPT___STRDUP 0

diff  --git a/compiler-rt/lib/asan/tests/asan_test.cpp 
b/compiler-rt/lib/asan/tests/asan_test.cpp
index c0b79bba48ff..51a527359b49 100644
--- a/compiler-rt/lib/asan/tests/asan_test.cpp
+++ b/compiler-rt/lib/asan/tests/asan_test.cpp
@@ -804,7 +804,7 @@ char* MallocAndMemsetString(size_t size) {
   return MallocAndMemsetString(size, 'z');
 }
 
-#if SANITIZER_GLIBC
+#if defined(__linux__) && !defined(__ANDROID__)
 #define READ_TEST(READ_N_BYTES)  \
   char *x = new char[10];\
   int fd = open("/proc/self/stat", O_RDONLY);\
@@ -827,7 +827,7 @@ TEST(AddressSanitizer, pread64) {
 TEST(AddressSanitizer, read) {
   READ_TEST(read(fd, x, 15));
 }
-#endif  // SANITIZER_GLIBC
+#endif  // defined(__linux__) && !defined(__ANDROID__)
 
 // This test case fails
 // Clang optimizes memcpy/memset calls which lead to unaligned access

diff  --git a/compiler-rt/lib/interception/interception_linux.cpp 
b/compiler-rt/lib/interception/interception_linux.cpp
index 5111a87f0a6c..6883608d44f3 100644
--- a/compiler-rt/lib/interception/interception_linux.cpp
+++ b/compiler-rt/lib/interception/interception_linux.cpp
@@ -63,8 +63,8 @@ bool InterceptFunction(const char *name, uptr *ptr_to_real, 
uptr func,
   return addr && (func == wrapper);
 }
 
-// dlvsym is a GNU extension supported by some other platforms.
-#if SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER_NETBSD
+// Android and Solaris do not have dlvsym
+#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS
 static void *GetFuncAddr(const char *name, const char *ver) {
   return dlvsym(RTLD_NEXT, name, ver);
 }
@@ -75,7 +75,7 @@ bool InterceptFunction(const char *name, const char *ver, 
uptr *ptr_to_real,
   *ptr_to_real = (uptr)addr;
   return addr && (func == wrapper);
 }
-#endif  // SANITIZER_GLIBC || SANITIZER_FREEBSD || SANITIZER

[llvm-branch-commits] [llvm] 2759041 - [gn build] (manually) merge a whole bunch of libc++ header files

2021-01-07 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-07T22:09:35-05:00
New Revision: 2759041786e4fe0dfb3b4fe9a3107395be738b95

URL: 
https://github.com/llvm/llvm-project/commit/2759041786e4fe0dfb3b4fe9a3107395be738b95
DIFF: 
https://github.com/llvm/llvm-project/commit/2759041786e4fe0dfb3b4fe9a3107395be738b95.diff

LOG: [gn build] (manually) merge a whole bunch of libc++ header files

I noticed __availability was missing, so I manually diffed the
file lists and put all recently(ish) added headers:
* __availability from 2eadbc86142ba
* concepts from 601f7631827ae
* execution from 0a06eb911b830
* numbers from 4f6c4b473c4a5

Also remove libcxx_install_support_headers like the CMake build did in
6706342f48bea, and unconditionally copy
support/win32/{limits_msvc_win32.h,locale_win32.h} like the CMake
build always did as far as I can tell.

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index ac217956886a..64253c6e72df 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -2,11 +2,6 @@ import("//clang/resource_dir.gni")
 import("//libcxx/config.gni")
 import("//llvm/utils/gn/build/write_cmake_config.gni")
 
-declare_args() {
-  # Install libc++ support headers.
-  libcxx_install_support_headers = true
-}
-
 libcxx_needs_site_config =
 libcxx_abi_version != 1 || libcxx_abi_namespace != "" || 
libcxx_abi_unstable
 
@@ -54,6 +49,7 @@ if (libcxx_needs_site_config) {
 
 copy("include") {
   sources = [
+"__availability",
 "__bit_reference",
 "__bsd_locale_defaults.h",
 "__bsd_locale_fallbacks.h",
@@ -104,6 +100,7 @@ copy("include") {
 "compare",
 "complex",
 "complex.h",
+"concepts",
 "condition_variable",
 "csetjmp",
 "csignal",
@@ -122,6 +119,7 @@ copy("include") {
 "deque",
 "errno.h",
 "exception",
+"execution",
 "experimental/__config",
 "experimental/__memory",
 "experimental/algorithm",
@@ -174,6 +172,7 @@ copy("include") {
 "module.modulemap",
 "mutex",
 "new",
+"numbers",
 "numeric",
 "optional",
 "ostream",
@@ -200,6 +199,24 @@ copy("include") {
 "string.h",
 "string_view",
 "strstream",
+"support/android/locale_bionic.h",
+"support/fuchsia/xlocale.h",
+"support/ibm/limits.h",
+"support/ibm/locale_mgmt_aix.h",
+"support/ibm/nanosleep.h",
+"support/ibm/support.h",
+"support/ibm/xlocale.h",
+"support/musl/xlocale.h",
+"support/newlib/xlocale.h",
+"support/nuttx/xlocale.h",
+"support/solaris/floatingpoint.h",
+"support/solaris/wchar.h",
+"support/solaris/xlocale.h",
+"support/win32/limits_msvc_win32.h",
+"support/win32/locale_win32.h",
+"support/xlocale/__nop_locale_mgmt.h",
+"support/xlocale/__posix_l_fallback.h",
+"support/xlocale/__strtonum_fallback.h",
 "system_error",
 "tgmath.h",
 "thread",
@@ -234,31 +251,5 @@ copy("include") {
   } else {
 deps += [ ":copy_config" ]
   }
-  if (libcxx_install_support_headers) {
-sources += [
-  "support/android/locale_bionic.h",
-  "support/fuchsia/xlocale.h",
-  "support/ibm/limits.h",
-  "support/ibm/locale_mgmt_aix.h",
-  "support/ibm/nanosleep.h",
-  "support/ibm/support.h",
-  "support/ibm/xlocale.h",
-  "support/musl/xlocale.h",
-  "support/newlib/xlocale.h",
-  "support/nuttx/xlocale.h",
-  "support/solaris/floatingpoint.h",
-  "support/solaris/wchar.h",
-  "support/solaris/xlocale.h",
-  "support/xlocale/__nop_locale_mgmt.h",
-  "support/xlocale/__posix_l_fallback.h",
-  "support/xlocale/__strtonum_fallback.h",
-]
-if (target_os == "win") {
-  sources += [
-"support/win32/limits_msvc_win32.h",
-"support/win32/locale_win32.h",
-  ]
-}
-  }
   outputs = [ "$root_build_dir/include/c++/v1/{{source_target_relative}}" ]
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 87d4ea2 - [gn build] Make an explicit `use_lld = true` on mac use lld.darwinnew

2021-01-09 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-09T14:03:52-05:00
New Revision: 87d4ea2433663b4aabe9c979a4dd47ef6adedc8b

URL: 
https://github.com/llvm/llvm-project/commit/87d4ea2433663b4aabe9c979a4dd47ef6adedc8b
DIFF: 
https://github.com/llvm/llvm-project/commit/87d4ea2433663b4aabe9c979a4dd47ef6adedc8b.diff

LOG: [gn build] Make an explicit `use_lld = true` on mac use lld.darwinnew

use_lld defaults to true on non-mac if clang_base_path is set (i.e.
the host compiler is a locally-built clang). On mac, the lld Mach-O
port used to be unusable, but ld64.lld.darwinnew is close to usable.
When explicitly setting `use_lld = true` in a GN build on a mac host,
check-lld passes, two check-clang tests fail, and a handful check-llvm
tests fail (the latter all due to -flat_namespace not yet being implemented).

Added: 


Modified: 
llvm/utils/gn/build/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index 92d667c16f70..813f39ddb623 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -236,7 +236,11 @@ config("compiler_defaults") {
 
   # On Windows, the linker is not invoked through the compiler driver.
   if (use_lld && host_os != "win") {
-ldflags += [ "-fuse-ld=lld" ]
+if (host_os == "mac") {
+  ldflags += [ "-fuse-ld=lld.darwinnew" ]
+} else {
+  ldflags += [ "-fuse-ld=lld" ]
+}
   }
 
   if (llvm_build_instrumented_coverage) {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 1198478 - [lld/mac] remove redundant null check

2021-01-09 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-09T21:18:32-05:00
New Revision: 1198478c4208726774d6e31ac9be7fd2a8f0d802

URL: 
https://github.com/llvm/llvm-project/commit/1198478c4208726774d6e31ac9be7fd2a8f0d802
DIFF: 
https://github.com/llvm/llvm-project/commit/1198478c4208726774d6e31ac9be7fd2a8f0d802.diff

LOG: [lld/mac] remove redundant null check

This is already checked two lines up. No behavior change.

Added: 


Modified: 
lld/MachO/Driver.cpp

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 2e52ef9a07fe..857c9991a8e6 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -750,7 +750,7 @@ bool macho::link(ArrayRef argsArr, bool 
canExitEarly,
   if (const opt::Arg *arg =
   args.getLastArg(OPT_search_paths_first, OPT_search_dylibs_first))
 config->searchDylibsFirst =
-(arg && arg->getOption().getID() == OPT_search_dylibs_first);
+arg->getOption().getID() == OPT_search_dylibs_first;
 
   config->dylibCompatibilityVersion =
   parseDylibVersion(args, OPT_compatibility_version);



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 47991a1 - [lld/mac] llvm style fix: no else after return

2021-01-10 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-10T09:35:00-05:00
New Revision: 47991a15d1925cba4687c5077cc9c81c8fcd00bd

URL: 
https://github.com/llvm/llvm-project/commit/47991a15d1925cba4687c5077cc9c81c8fcd00bd
DIFF: 
https://github.com/llvm/llvm-project/commit/47991a15d1925cba4687c5077cc9c81c8fcd00bd.diff

LOG: [lld/mac] llvm style fix: no else after return

Added: 


Modified: 
lld/MachO/Writer.cpp

Removed: 




diff  --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 53267c072c59..bdc3609e033d 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -557,7 +557,8 @@ static int sectionOrder(OutputSection *osec) {
 .Case(section_names::unwindInfo, std::numeric_limits::max() - 1)
 .Case(section_names::ehFrame, std::numeric_limits::max())
 .Default(0);
-  } else if (segname == segment_names::data) {
+  }
+  if (segname == segment_names::data) {
 // For each thread spawned, dyld will initialize its TLVs by copying the
 // address range from the start of the first thread-local data section to
 // the end of the last one. We therefore arrange these sections 
contiguously
@@ -575,7 +576,8 @@ static int sectionOrder(OutputSection *osec) {
 default:
   return 0;
 }
-  } else if (segname == segment_names::linkEdit) {
+  }
+  if (segname == segment_names::linkEdit) {
 return StringSwitch(osec->name)
 .Case(section_names::rebase, -8)
 .Case(section_names::binding, -7)



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] d43a264 - Revert "[X86][SSE] Fold unpack(hop(), hop()) -> permute(hop())"

2021-01-10 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-10T20:22:53-05:00
New Revision: d43a264a5dd3c72bf9dc663551c0993921b28136

URL: 
https://github.com/llvm/llvm-project/commit/d43a264a5dd3c72bf9dc663551c0993921b28136
DIFF: 
https://github.com/llvm/llvm-project/commit/d43a264a5dd3c72bf9dc663551c0993921b28136.diff

LOG: Revert "[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())"

This reverts commit 80dee7965dffdfb866afa9d74f3a4a97453708b2.
Makes clang sometimes hang forever. See
https://bugs.chromium.org/p/chromium/issues/detail?id=1164786#c6 for a
stand-alone repro.

Added: 


Modified: 
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/horizontal-shuffle-2.ll

Removed: 




diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp 
b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 7b0e927a33d2..16f1023ed5f8 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -37513,12 +37513,10 @@ static SDValue combineShuffleOfConcatUndef(SDNode *N, 
SelectionDAG &DAG,
 
 /// Eliminate a redundant shuffle of a horizontal math op.
 static SDValue foldShuffleOfHorizOp(SDNode *N, SelectionDAG &DAG) {
-  // TODO: Can we use getTargetShuffleInputs instead?
   unsigned Opcode = N->getOpcode();
   if (Opcode != X86ISD::MOVDDUP && Opcode != X86ISD::VBROADCAST)
-if (Opcode != X86ISD::UNPCKL && Opcode != X86ISD::UNPCKH)
-  if (Opcode != ISD::VECTOR_SHUFFLE || !N->getOperand(1).isUndef())
-return SDValue();
+if (Opcode != ISD::VECTOR_SHUFFLE || !N->getOperand(1).isUndef())
+  return SDValue();
 
   // For a broadcast, peek through an extract element of index 0 to find the
   // horizontal op: broadcast (ext_vec_elt HOp, 0)
@@ -37537,24 +37535,6 @@ static SDValue foldShuffleOfHorizOp(SDNode *N, 
SelectionDAG &DAG) {
   HOp.getOpcode() != X86ISD::HSUB && HOp.getOpcode() != X86ISD::FHSUB)
 return SDValue();
 
-  // unpck(hop,hop) -> permute(hop,hop).
-  if (Opcode == X86ISD::UNPCKL || Opcode == X86ISD::UNPCKH) {
-SDValue HOp2 = N->getOperand(1);
-if (HOp.getOpcode() != HOp2.getOpcode() || VT.getScalarSizeInBits() != 32)
-  return SDValue();
-SDLoc DL(HOp);
-unsigned LoHi = Opcode == X86ISD::UNPCKL ? 0 : 1;
-SDValue Res = DAG.getNode(HOp.getOpcode(), DL, VT, HOp.getOperand(LoHi),
-  HOp2.getOperand(LoHi));
-// Use SHUFPS for the permute so this will work on SSE3 targets, shuffle
-// combining and domain handling will simplify this later on.
-EVT ShuffleVT = VT.changeVectorElementType(MVT::f32);
-Res = DAG.getBitcast(ShuffleVT, Res);
-Res = DAG.getNode(X86ISD::SHUFP, DL, ShuffleVT, Res, Res,
-  getV4X86ShuffleImm8ForMask({0, 2, 1, 3}, DL, DAG));
-return DAG.getBitcast(VT, Res);
-  }
-
   // 128-bit horizontal math instructions are defined to operate on adjacent
   // lanes of each operand as:
   // v4X32: A[0] + A[1] , A[2] + A[3] , B[0] + B[1] , B[2] + B[3]

diff  --git a/llvm/test/CodeGen/X86/horizontal-shuffle-2.ll 
b/llvm/test/CodeGen/X86/horizontal-shuffle-2.ll
index 6b4b8047d0f0..c012c88c6ed2 100644
--- a/llvm/test/CodeGen/X86/horizontal-shuffle-2.ll
+++ b/llvm/test/CodeGen/X86/horizontal-shuffle-2.ll
@@ -9,8 +9,9 @@
 define <4 x float> @test_unpacklo_hadd_v4f32(<4 x float> %0, <4 x float> %1, 
<4 x float> %2, <4 x float> %3) {
 ; CHECK-LABEL: test_unpacklo_hadd_v4f32:
 ; CHECK:   ## %bb.0:
-; CHECK-NEXT:vhaddps %xmm2, %xmm0, %xmm0
-; CHECK-NEXT:vpermilps {{.*#+}} xmm0 = xmm0[0,2,1,3]
+; CHECK-NEXT:vhaddps %xmm0, %xmm0, %xmm0
+; CHECK-NEXT:vhaddps %xmm0, %xmm2, %xmm1
+; CHECK-NEXT:vunpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
 ; CHECK-NEXT:ret{{[l|q]}}
   %5 = tail call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %0, <4 x 
float> %1) #4
   %6 = tail call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %2, <4 x 
float> %3) #4
@@ -21,8 +22,9 @@ define <4 x float> @test_unpacklo_hadd_v4f32(<4 x float> %0, 
<4 x float> %1, <4
 define <4 x float> @test_unpackhi_hadd_v4f32(<4 x float> %0, <4 x float> %1, 
<4 x float> %2, <4 x float> %3) {
 ; CHECK-LABEL: test_unpackhi_hadd_v4f32:
 ; CHECK:   ## %bb.0:
-; CHECK-NEXT:vhaddps %xmm3, %xmm1, %xmm0
-; CHECK-NEXT:vpermilps {{.*#+}} xmm0 = xmm0[0,2,1,3]
+; CHECK-NEXT:vhaddps %xmm1, %xmm0, %xmm0
+; CHECK-NEXT:vhaddps %xmm3, %xmm0, %xmm1
+; CHECK-NEXT:vunpckhps {{.*#+}} xmm0 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
 ; CHECK-NEXT:ret{{[l|q]}}
   %5 = tail call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %0, <4 x 
float> %1) #4
   %6 = tail call <4 x float> @llvm.x86.sse3.hadd.ps(<4 x float> %2, <4 x 
float> %3) #4
@@ -33,8 +35,9 @@ define <4 x float> @test_unpackhi_hadd_v4f32(<4 x float> %0, 
<4 x float> %1, <4
 define <4 x float> @test_unpacklo_hsub_v4f32(<4 x float> %0, <4 x float> %1, 
<4 x float> %2, <4 x float> %3) {
 ; CHECK-LABEL: test_unpacklo_hsub_v4f32:
 ; CHECK:

[llvm-branch-commits] [clang] 419ef38 - Revert "[attributes] Add a facility for enforcing a Trusted Computing Base."

2021-01-11 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-11T09:51:06-05:00
New Revision: 419ef38a50293c58078f830517f5e305068dbee6

URL: 
https://github.com/llvm/llvm-project/commit/419ef38a50293c58078f830517f5e305068dbee6
DIFF: 
https://github.com/llvm/llvm-project/commit/419ef38a50293c58078f830517f5e305068dbee6.diff

LOG: Revert "[attributes]  Add a facility for enforcing a Trusted Computing 
Base."

This reverts commit c163aae45ef6b7f3bd99601195d3ce4aad5850c6.
Doesn't compile on some bots
(http://lab.llvm.org:8011/#/builders/98/builds/3387/steps/9/logs/stdio),
breaks tests on bots where it does compile
(http://45.33.8.238/linux/36843/step_7.txt).

Added: 


Modified: 
clang/include/clang/Basic/Attr.td
clang/include/clang/Basic/AttrDocs.td
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaChecking.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclAttr.cpp

Removed: 
clang/test/Sema/attr-enforce-tcb-errors.cpp
clang/test/Sema/attr-enforce-tcb.c
clang/test/Sema/attr-enforce-tcb.cpp



diff  --git a/clang/include/clang/Basic/Attr.td 
b/clang/include/clang/Basic/Attr.td
index c51e95fa6fa8..248409946123 100644
--- a/clang/include/clang/Basic/Attr.td
+++ b/clang/include/clang/Basic/Attr.td
@@ -3653,19 +3653,3 @@ def Builtin : InheritableAttr {
   let SemaHandler = 0;
   let Documentation = [Undocumented];
 }
-
-def EnforceTCB : InheritableAttr {
-  let Spellings = [Clang<"enforce_tcb">];
-  let Subjects = SubjectList<[Function]>;
-  let Args = [StringArgument<"TCBName">];
-  let Documentation = [EnforceTCBDocs];
-  bit InheritEvenIfAlreadyPresent = 1;
-}
-
-def EnforceTCBLeaf : InheritableAttr {
-  let Spellings = [Clang<"enforce_tcb_leaf">];
-  let Subjects = SubjectList<[Function]>;
-  let Args = [StringArgument<"TCBName">];
-  let Documentation = [EnforceTCBLeafDocs];
-  bit InheritEvenIfAlreadyPresent = 1;
-}

diff  --git a/clang/include/clang/Basic/AttrDocs.td 
b/clang/include/clang/Basic/AttrDocs.td
index fffede41db1e..9cf0c59e07bb 100644
--- a/clang/include/clang/Basic/AttrDocs.td
+++ b/clang/include/clang/Basic/AttrDocs.td
@@ -5725,28 +5725,3 @@ Attribute docs`_, and `the GCC Inline docs`_.
 }];
   let Heading = "always_inline, __force_inline";
 }
-
-def EnforceTCBDocs : Documentation {
-  let Category = DocCatFunction;
-  let Content = [{
-  The ``enforce_tcb`` attribute can be placed on functions to enforce that a
-  trusted compute base (TCB) does not call out of the TCB. This generates a
-  warning every time a function not marked with an ``enforce_tcb`` attribute is
-  called from a function with the ``enforce_tcb`` attribute. A function may be 
a
-  part of multiple TCBs. Invocations through function pointers are currently
-  not checked. Builtins are considered to a part of every TCB.
-
-  - ``enforce_tcb(Name)`` indicates that this function is a part of the TCB 
named ``Name``
-  }];
-}
-
-def EnforceTCBLeafDocs : Documentation {
-  let Category = DocCatFunction;
-  let Content = [{
-  The ``enforce_tcb_leaf`` attribute satisfies the requirement enforced by
-  ``enforce_tcb`` for the marked function to be in the named TCB but does not
-  continue to check the functions called from within the leaf function.
-
-  - ``enforce_tcb_leaf(Name)`` indicates that this function is a part of the 
TCB named ``Name``
-  }];
-}

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index c048fc89813f..0405195912b2 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -6,11 +6,4 @@ def err_probability_not_constant_float : Error<
 def err_probability_out_of_range : Error<
"probability argument to __builtin_expect_with_probability is outside the "
"range [0.0, 1.0]">;
-
-// TCB warnings
-def err_tcb_conflicting_attributes : Error<
-  "attributes '%0(\"%2\")' and '%1(\"%2\")' are mutually exclusive">;
-def warn_tcb_enforcement_violation : Warning<
-  "calling %0 is a violation of trusted computing base '%1'">,
-  InGroup>;
 } // end of sema component.

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 4de3b962c660..1d79e5716ef7 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -3210,9 +3210,6 @@ class Sema final {
   Decl *D, const WebAssemblyImportNameAttr &AL);
   WebAssemblyImportModuleAttr *mergeImportModuleAttr(
   Decl *D, const WebAssemblyImportModuleAttr &AL);
-  EnforceTCBAttr *mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL);
-  EnforceTCBLeafAttr *mergeEnforceTCBLeafAttr(Decl *D,
-  const EnforceTCBLeafAttr &AL);
 
   void mergeDeclAttributes(NamedDecl *New, Decl *Old,
AvailabilityMergeKind AMK = AMK_Redeclaration);
@@ -12430,8 +12427,6 @@ class Sema fin

[llvm-branch-commits] [llvm] a06aa10 - Revert "[Test] Add failing test for PR48725"

2021-01-12 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2021-01-12T06:30:32-05:00
New Revision: a06aa1037c17dd3d60f5202b9877d8988e463353

URL: 
https://github.com/llvm/llvm-project/commit/a06aa1037c17dd3d60f5202b9877d8988e463353
DIFF: 
https://github.com/llvm/llvm-project/commit/a06aa1037c17dd3d60f5202b9877d8988e463353.diff

LOG: Revert "[Test] Add failing test for PR48725"

This reverts commit e8287cb2b2923af9da72fd953e2ec5495c33861a.
Test unexpectedly passes on mac, see comment 2 on PR48725.

Added: 


Modified: 


Removed: 
llvm/test/Transforms/LoopStrengthReduce/pr48725.ll



diff  --git a/llvm/test/Transforms/LoopStrengthReduce/pr48725.ll 
b/llvm/test/Transforms/LoopStrengthReduce/pr48725.ll
deleted file mode 100644
index ef25b92ffd1c..
--- a/llvm/test/Transforms/LoopStrengthReduce/pr48725.ll
+++ /dev/null
@@ -1,102 +0,0 @@
-; RUN: opt -S -loop-reduce < %s | FileCheck %s
-; XFAIL: *
-
-source_filename = "./simple.ll"
-target datalayout = 
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128-ni:1-p2:32:8:8:32-ni:2"
-target triple = "x86_64-unknown-linux-gnu"
-
-; CHECK-LABEL: test
-define void @test() {
-bb:
-  br label %bb1
-
-bb1:  ; preds = %bb1, %bb
-  %tmp = phi i32 [ undef, %bb ], [ %tmp87, %bb1 ]
-  %tmp2 = phi i32 [ undef, %bb ], [ %tmp86, %bb1 ]
-  %tmp3 = mul i32 %tmp, undef
-  %tmp4 = xor i32 %tmp3, -1
-  %tmp5 = add i32 %tmp, %tmp4
-  %tmp6 = add i32 %tmp2, -1
-  %tmp7 = add i32 %tmp5, %tmp6
-  %tmp8 = mul i32 %tmp7, %tmp3
-  %tmp9 = xor i32 %tmp8, -1
-  %tmp10 = add i32 %tmp7, %tmp9
-  %tmp11 = add i32 %tmp10, undef
-  %tmp12 = mul i32 %tmp11, %tmp8
-  %tmp13 = xor i32 %tmp12, -1
-  %tmp14 = add i32 %tmp11, %tmp13
-  %tmp15 = add i32 %tmp14, undef
-  %tmp16 = mul i32 %tmp15, %tmp12
-  %tmp17 = add i32 %tmp15, undef
-  %tmp18 = add i32 %tmp17, undef
-  %tmp19 = mul i32 %tmp18, %tmp16
-  %tmp20 = xor i32 %tmp19, -1
-  %tmp21 = add i32 %tmp18, %tmp20
-  %tmp22 = add i32 %tmp21, undef
-  %tmp23 = mul i32 %tmp22, %tmp19
-  %tmp24 = xor i32 %tmp23, -1
-  %tmp25 = add i32 %tmp22, %tmp24
-  %tmp26 = add i32 %tmp25, undef
-  %tmp27 = mul i32 %tmp26, %tmp23
-  %tmp28 = xor i32 %tmp27, -1
-  %tmp29 = add i32 %tmp26, %tmp28
-  %tmp30 = add i32 %tmp29, undef
-  %tmp31 = mul i32 %tmp30, %tmp27
-  %tmp32 = xor i32 %tmp31, -1
-  %tmp33 = add i32 %tmp30, %tmp32
-  %tmp34 = add i32 %tmp33, undef
-  %tmp35 = mul i32 %tmp34, %tmp31
-  %tmp36 = xor i32 %tmp35, -1
-  %tmp37 = add i32 %tmp34, %tmp36
-  %tmp38 = add i32 %tmp2, -9
-  %tmp39 = add i32 %tmp37, %tmp38
-  %tmp40 = mul i32 %tmp39, %tmp35
-  %tmp41 = xor i32 %tmp40, -1
-  %tmp42 = add i32 %tmp39, %tmp41
-  %tmp43 = add i32 %tmp42, undef
-  %tmp44 = mul i32 %tmp43, %tmp40
-  %tmp45 = xor i32 %tmp44, -1
-  %tmp46 = add i32 %tmp43, %tmp45
-  %tmp47 = add i32 %tmp46, undef
-  %tmp48 = mul i32 %tmp47, %tmp44
-  %tmp49 = xor i32 %tmp48, -1
-  %tmp50 = add i32 %tmp47, %tmp49
-  %tmp51 = add i32 %tmp50, undef
-  %tmp52 = mul i32 %tmp51, %tmp48
-  %tmp53 = xor i32 %tmp52, -1
-  %tmp54 = add i32 %tmp51, %tmp53
-  %tmp55 = add i32 %tmp54, undef
-  %tmp56 = mul i32 %tmp55, %tmp52
-  %tmp57 = xor i32 %tmp56, -1
-  %tmp58 = add i32 %tmp55, %tmp57
-  %tmp59 = add i32 %tmp2, -14
-  %tmp60 = add i32 %tmp58, %tmp59
-  %tmp61 = mul i32 %tmp60, %tmp56
-  %tmp62 = xor i32 %tmp61, -1
-  %tmp63 = add i32 %tmp60, %tmp62
-  %tmp64 = add i32 %tmp63, undef
-  %tmp65 = mul i32 %tmp64, %tmp61
-  %tmp66 = xor i32 %tmp65, -1
-  %tmp67 = add i32 %tmp64, %tmp66
-  %tmp68 = add i32 %tmp67, undef
-  %tmp69 = mul i32 %tmp68, %tmp65
-  %tmp70 = xor i32 %tmp69, -1
-  %tmp71 = add i32 %tmp68, %tmp70
-  %tmp72 = add i32 %tmp71, undef
-  %tmp73 = mul i32 %tmp72, %tmp69
-  %tmp74 = xor i32 %tmp73, -1
-  %tmp75 = add i32 %tmp72, %tmp74
-  %tmp76 = add i32 %tmp75, undef
-  %tmp77 = mul i32 %tmp76, %tmp73
-  %tmp78 = xor i32 %tmp77, -1
-  %tmp79 = add i32 %tmp76, %tmp78
-  %tmp80 = add i32 %tmp79, undef
-  %tmp81 = mul i32 %tmp80, %tmp77
-  %tmp82 = xor i32 %tmp81, -1
-  %tmp83 = add i32 %tmp80, %tmp82
-  %tmp84 = add i32 %tmp83, undef
-  %tmp85 = add i32 %tmp84, undef
-  %tmp86 = add i32 %tmp2, -21
-  %tmp87 = add i32 %tmp85, %tmp86
-  br label %bb1
-}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 9412932 - [gn build] (semi-manually) port 7ad49aec125

2020-12-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-14T18:22:54-05:00
New Revision: 9412932bb5992c9fcaec0d29f30c914f7fc821c3

URL: 
https://github.com/llvm/llvm-project/commit/9412932bb5992c9fcaec0d29f30c914f7fc821c3
DIFF: 
https://github.com/llvm/llvm-project/commit/9412932bb5992c9fcaec0d29f30c914f7fc821c3.diff

LOG: [gn build] (semi-manually) port 7ad49aec125

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index ccc024fdf88c..fd7da1d2311c 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -65,6 +65,9 @@ copy("include") {
 "__hash_table",
 "__libcpp_version",
 "__locale",
+"__memory/allocator_traits.h",
+"__memory/base.h",
+"__memory/pointer_traits.h",
 "__mutex_base",
 "__node_handle",
 "__nullptr",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 2733a5a - [gn build] (semi-manually) port 19d57b5c42b

2020-12-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-14T18:23:15-05:00
New Revision: 2733a5a5b445e773f038f35adce776e74f92ac00

URL: 
https://github.com/llvm/llvm-project/commit/2733a5a5b445e773f038f35adce776e74f92ac00
DIFF: 
https://github.com/llvm/llvm-project/commit/2733a5a5b445e773f038f35adce776e74f92ac00.diff

LOG: [gn build] (semi-manually) port 19d57b5c42b

Added: 


Modified: 
llvm/utils/gn/secondary/libcxx/include/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn 
b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
index fd7da1d2311c..ac217956886a 100644
--- a/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxx/include/BUILD.gn
@@ -68,6 +68,7 @@ copy("include") {
 "__memory/allocator_traits.h",
 "__memory/base.h",
 "__memory/pointer_traits.h",
+"__memory/utilities.h",
 "__mutex_base",
 "__node_handle",
 "__nullptr",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] d058b69 - [lld/mac] implement -compatibility_version, -current_version

2020-12-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-14T18:41:36-05:00
New Revision: d058b69b1cd3d71b9bcb45011f5f3ef3a576a5e2

URL: 
https://github.com/llvm/llvm-project/commit/d058b69b1cd3d71b9bcb45011f5f3ef3a576a5e2
DIFF: 
https://github.com/llvm/llvm-project/commit/d058b69b1cd3d71b9bcb45011f5f3ef3a576a5e2.diff

LOG: [lld/mac] implement -compatibility_version, -current_version

Differential Revision: https://reviews.llvm.org/D93237

Added: 
lld/test/MachO/dylib-version.s

Modified: 
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Options.td
lld/MachO/Writer.cpp

Removed: 




diff  --git a/lld/MachO/Config.h b/lld/MachO/Config.h
index 2835b5c1546e..029b9ab2296c 100644
--- a/lld/MachO/Config.h
+++ b/lld/MachO/Config.h
@@ -44,6 +44,8 @@ struct Configuration {
   bool searchDylibsFirst = false;
   bool saveTemps = false;
   uint32_t headerPad;
+  uint32_t dylibCompatibilityVersion = 0;
+  uint32_t dylibCurrentVersion = 0;
   llvm::StringRef installName;
   llvm::StringRef outputFile;
   llvm::StringRef ltoObjPath;

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 73846d420096..c456d2fb1fd5 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -663,6 +663,46 @@ static void parseClangOption(StringRef opt, const Twine 
&msg) {
   error(msg + ": " + StringRef(err).trim());
 }
 
+static uint32_t parseDylibVersion(const opt::ArgList& args, unsigned id) {
+  const opt::Arg *arg = args.getLastArg(id);
+  if (!arg)
+return 0;
+
+  if (config->outputType != MH_DYLIB) {
+error(arg->getAsString(args) + ": only valid with -dylib");
+return 0;
+  }
+
+  llvm::VersionTuple version;
+  if (version.tryParse(arg->getValue()) || version.getBuild().hasValue()) {
+error(arg->getAsString(args) + ": malformed version");
+return 0;
+  }
+
+  unsigned major = version.getMajor();
+  if (major > UINT16_MAX) {
+error(arg->getAsString(args) + ": component " + Twine(major) +
+  " out of range");
+return 0;
+  }
+
+  unsigned minor = version.getMinor().getValueOr(0);
+  if (minor > UINT8_MAX) {
+error(arg->getAsString(args) + ": component " + Twine(minor) +
+  " out of range");
+return 0;
+  }
+
+  unsigned subminor = version.getSubminor().getValueOr(0);
+  if (subminor > UINT8_MAX) {
+error(arg->getAsString(args) + ": component " + Twine(subminor) +
+  " out of range");
+return 0;
+  }
+
+  return (major << 16) | (minor << 8) | subminor;
+}
+
 bool macho::link(llvm::ArrayRef argsArr, bool canExitEarly,
  raw_ostream &stdoutOS, raw_ostream &stderrOS) {
   lld::stdoutOS = &stdoutOS;
@@ -732,6 +772,10 @@ bool macho::link(llvm::ArrayRef argsArr, 
bool canExitEarly,
 config->searchDylibsFirst =
 (arg && arg->getOption().getID() == OPT_search_dylibs_first);
 
+  config->dylibCompatibilityVersion =
+  parseDylibVersion(args, OPT_compatibility_version);
+  config->dylibCurrentVersion = parseDylibVersion(args, OPT_current_version);
+
   config->saveTemps = args.hasArg(OPT_save_temps);
 
   if (args.hasArg(OPT_v)) {

diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index d1d06879cafa..ca13e3b9 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -290,7 +290,6 @@ def mark_dead_strippable_dylib : Flag<["-"], 
"mark_dead_strippable_dylib">,
 def compatibility_version : Separate<["-"], "compatibility_version">,
  MetaVarName<"">,
  HelpText<"Compatibility  of this library">,
- Flags<[HelpHidden]>,
  Group;
 def dylib_compatibility_version : Separate<["-"], 
"dylib_compatibility_version">,
  MetaVarName<"">,
@@ -301,7 +300,6 @@ def dylib_compatibility_version : Separate<["-"], 
"dylib_compatibility_version">
 def current_version : Separate<["-"], "current_version">,
  MetaVarName<"">,
  HelpText<"Current  of this library">,
- Flags<[HelpHidden]>,
  Group;
 def dylib_current_version : Separate<["-"], "dylib_current_version">,
  MetaVarName<"">,

diff  --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 2d033febb79b..9f6aa0b49692 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -242,7 +242,10 @@ class LCSymtab : public LoadCommand {
 //   * LC_REEXPORT_DYLIB
 class LCDylib : public LoadCommand {
 public:
-  LCDylib(LoadCommandType type, StringRef path) : type(type), path(path) {
+  LCDylib(LoadCommandType type, StringRef path,
+  uint32_t compatibilityVersion = 0, uint32_t currentVersion = 0)
+  : type(type), path(path), compatibilityVersion(compatibilityVersion),
+currentVersion(currentVersion) {
 instanceCount++;
   }
 
@@ -257,6 +260,9 @@ class LCDylib : public LoadCommand {
 c->cmd = type;
 c->cmdsize = getSize();
 c->dylib.name = sizeof(dylib_command);
+c->dylib.timestamp = 0;
+c->dylib.compatibility_version = compatibilityVersion;
+c->dylib.current_version = currentVersion;
 
 memcpy(buf, path.data(), pat

[llvm-branch-commits] [llvm] c9ede6f - Revert "[amdgpu] Default to code object v3"

2020-12-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-14T22:01:26-05:00
New Revision: c9ede6f3367a627baeef78f30d18078af9a4ffca

URL: 
https://github.com/llvm/llvm-project/commit/c9ede6f3367a627baeef78f30d18078af9a4ffca
DIFF: 
https://github.com/llvm/llvm-project/commit/c9ede6f3367a627baeef78f30d18078af9a4ffca.diff

LOG: Revert "[amdgpu] Default to code object v3"

This reverts commit 4b2e7d0215021d0d1df1a6319884b21d33936265.
Breaks check-clang, see https://reviews.llvm.org/D93258#2453600

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/CommonArgs.cpp
llvm/docs/AMDGPUUsage.rst

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 87c786065fa9..67d41c3711f5 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -2811,7 +2811,7 @@ def mexec_model_EQ : Joined<["-"], "mexec-model=">, 
Group;
 
 def mcode_object_version_EQ : Joined<["-"], "mcode-object-version=">, 
Group,
-  HelpText<"Specify code object ABI version. Defaults to 3. (AMDGPU only)">,
+  HelpText<"Specify code object ABI version. Defaults to 4. (AMDGPU only)">,
   MetaVarName<"">, Values<"2,3,4">;
 
 def mcode_object_v3_legacy : Flag<["-"], "mcode-object-v3">, Group,

diff  --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp 
b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 04d0e0771f70..72bedc16846d 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1549,7 +1549,7 @@ unsigned tools::getOrCheckAMDGPUCodeObjectVersion(
 const Driver &D, const llvm::opt::ArgList &Args, bool Diagnose) {
   const unsigned MinCodeObjVer = 2;
   const unsigned MaxCodeObjVer = 4;
-  unsigned CodeObjVer = 3;
+  unsigned CodeObjVer = 4;
 
   // Emit warnings for legacy options even if they are overridden.
   if (Diagnose) {

diff  --git a/llvm/docs/AMDGPUUsage.rst b/llvm/docs/AMDGPUUsage.rst
index 95fb164310cc..e5d081a37500 100644
--- a/llvm/docs/AMDGPUUsage.rst
+++ b/llvm/docs/AMDGPUUsage.rst
@@ -911,12 +911,12 @@ The AMDGPU backend uses the following ELF header:
 
   * ``ELFABIVERSION_AMDGPU_HSA_V3`` is used to specify the version of AMD HSA
 runtime ABI for code object V3. Specify using the Clang option
-``-mcode-object-version=3``. This is the default code object
-version if not specified.
+``-mcode-object-version=3``.
 
   * ``ELFABIVERSION_AMDGPU_HSA_V4`` is used to specify the version of AMD HSA
 runtime ABI for code object V4. Specify using the Clang option
-``-mcode-object-version=4``.
+``-mcode-object-version=4``. This is the default code object
+version if not specified.
 
   * ``ELFABIVERSION_AMDGPU_PAL`` is used to specify the version of AMD PAL
 runtime ABI.
@@ -2871,6 +2871,10 @@ non-AMD key names should be prefixed by "*vendor-name*.".
 Code Object V3 Metadata
 +++
 
+.. warning::
+  Code object V3 is not the default code object version emitted by this version
+  of LLVM.
+
 Code object V3 to V4 metadata is specified by the ``NT_AMDGPU_METADATA`` note
 record (see :ref:`amdgpu-note-records-v3-v4`).
 
@@ -3275,10 +3279,6 @@ same *vendor-name*.
 Code Object V4 Metadata
 +++
 
-.. warning::
-  Code object V4 is not the default code object version emitted by this version
-  of LLVM.
-
 Code object V4 metadata is the same as
 :ref:`amdgpu-amdhsa-code-object-metadata-v3` with the changes and additions
 defined in table :ref:`amdgpu-amdhsa-code-object-metadata-map-table-v3`.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] 7799ef7 - Revert "Lex: Migrate HeaderSearch::LoadedModuleMaps to FileEntryRef"

2020-12-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-14T22:05:08-05:00
New Revision: 7799ef7121aa7d59f4bd95cdf70035de724ead6f

URL: 
https://github.com/llvm/llvm-project/commit/7799ef7121aa7d59f4bd95cdf70035de724ead6f
DIFF: 
https://github.com/llvm/llvm-project/commit/7799ef7121aa7d59f4bd95cdf70035de724ead6f.diff

LOG: Revert "Lex: Migrate HeaderSearch::LoadedModuleMaps to FileEntryRef"

This reverts commit a40db5502b2515a6f2f1676b5d7a655ae0f41179.
and follow-up d636b881bb9214938973098a012fad453082c444

Somewhat speculative, likely broke check-clang on Windows:
https://reviews.llvm.org/D92975#2453482

Added: 


Modified: 
clang-tools-extra/modularize/ModularizeUtilities.cpp
clang/include/clang/Lex/HeaderSearch.h
clang/include/clang/Lex/ModuleMap.h
clang/lib/Frontend/FrontendAction.cpp
clang/lib/Lex/HeaderSearch.cpp
clang/lib/Lex/ModuleMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Removed: 




diff  --git a/clang-tools-extra/modularize/ModularizeUtilities.cpp 
b/clang-tools-extra/modularize/ModularizeUtilities.cpp
index 7470c324bbdb..200370c135df 100644
--- a/clang-tools-extra/modularize/ModularizeUtilities.cpp
+++ b/clang-tools-extra/modularize/ModularizeUtilities.cpp
@@ -258,22 +258,22 @@ std::error_code 
ModularizeUtilities::loadProblemHeaderList(
 std::error_code ModularizeUtilities::loadModuleMap(
 llvm::StringRef InputPath) {
   // Get file entry for module.modulemap file.
-  auto ExpectedModuleMapEntry =
-SourceMgr->getFileManager().getFileRef(InputPath);
+  auto ModuleMapEntryOrErr =
+SourceMgr->getFileManager().getFile(InputPath);
 
   // return error if not found.
-  if (!ExpectedModuleMapEntry) {
+  if (!ModuleMapEntryOrErr) {
 llvm::errs() << "error: File \"" << InputPath << "\" not found.\n";
-return errorToErrorCode(ExpectedModuleMapEntry.takeError());
+return ModuleMapEntryOrErr.getError();
   }
-  FileEntryRef ModuleMapEntry = *ExpectedModuleMapEntry;
+  const FileEntry *ModuleMapEntry = *ModuleMapEntryOrErr;
 
   // Because the module map parser uses a ForwardingDiagnosticConsumer,
   // which doesn't forward the BeginSourceFile call, we do it explicitly here.
   DC.BeginSourceFile(*LangOpts, nullptr);
 
   // Figure out the home directory for the module map file.
-  const DirectoryEntry *Dir = ModuleMapEntry.getDir();
+  const DirectoryEntry *Dir = ModuleMapEntry->getDir();
   StringRef DirName(Dir->getName());
   if (llvm::sys::path::filename(DirName) == "Modules") {
 DirName = llvm::sys::path::parent_path(DirName);

diff  --git a/clang/include/clang/Lex/HeaderSearch.h 
b/clang/include/clang/Lex/HeaderSearch.h
index 8ea81226cf77..93d6ea72270a 100644
--- a/clang/include/clang/Lex/HeaderSearch.h
+++ b/clang/include/clang/Lex/HeaderSearch.h
@@ -239,7 +239,7 @@ class HeaderSearch {
 
   /// Set of module map files we've already loaded, and a flag indicating
   /// whether they were valid or not.
-  llvm::DenseMap LoadedModuleMaps;
+  llvm::DenseMap LoadedModuleMaps;
 
   /// Uniqued set of framework names, which is used to track which
   /// headers were included as framework headers.
@@ -560,8 +560,8 @@ class HeaderSearch {
 
   /// Try to find a module map file in the given directory, returning
   /// \c nullptr if none is found.
-  Optional lookupModuleMapFile(const DirectoryEntry *Dir,
- bool IsFramework);
+  const FileEntry *lookupModuleMapFile(const DirectoryEntry *Dir,
+   bool IsFramework);
 
   /// Determine whether there is a module map that may map the header
   /// with the given file name to a (sub)module.
@@ -603,8 +603,8 @@ class HeaderSearch {
   ///used to resolve paths within the module (this is required when
   ///building the module from preprocessed source).
   /// \returns true if an error occurred, false otherwise.
-  bool loadModuleMapFile(FileEntryRef File, bool IsSystem, FileID ID = 
FileID(),
- unsigned *Offset = nullptr,
+  bool loadModuleMapFile(const FileEntry *File, bool IsSystem,
+ FileID ID = FileID(), unsigned *Offset = nullptr,
  StringRef OriginalModuleMapFile = StringRef());
 
   /// Collect the set of all known, top-level modules.
@@ -794,7 +794,8 @@ class HeaderSearch {
 LMM_InvalidModuleMap
   };
 
-  LoadModuleMapResult loadModuleMapFileImpl(FileEntryRef File, bool IsSystem,
+  LoadModuleMapResult loadModuleMapFileImpl(const FileEntry *File,
+bool IsSystem,
 const DirectoryEntry *Dir,
 FileID ID = FileID(),
 unsigned *Offset = nullptr);

diff  --git a/clang/include/clang/Lex/ModuleMap.h 
b/clang/include/clang/Lex/ModuleMap.h
index 1d7ce5fc2320..6827408f10

[llvm-branch-commits] [llvm] da2551f - Revert "[Debugify] Support checking Machine IR debug info"

2020-12-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-14T22:14:48-05:00
New Revision: da2551f3d191c1f0a32a3c9e3a26d2a236825871

URL: 
https://github.com/llvm/llvm-project/commit/da2551f3d191c1f0a32a3c9e3a26d2a236825871
DIFF: 
https://github.com/llvm/llvm-project/commit/da2551f3d191c1f0a32a3c9e3a26d2a236825871.diff

LOG: Revert "[Debugify] Support checking Machine IR debug info"

This reverts commit c4d2d4337d50bed3cafd564daece1a197005b22b.
Necessary to revert 2a5675f11d3bc803a245c0e.

Added: 


Modified: 
llvm/docs/HowToUpdateDebugInfo.rst
llvm/include/llvm/CodeGen/Passes.h
llvm/include/llvm/CodeGen/TargetPassConfig.h
llvm/include/llvm/InitializePasses.h
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/CodeGen/CodeGen.cpp
llvm/lib/CodeGen/MachineDebugify.cpp
llvm/lib/CodeGen/TargetPassConfig.cpp
llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir
llvm/utils/gn/secondary/llvm/lib/CodeGen/BUILD.gn

Removed: 
llvm/lib/CodeGen/MachineCheckDebugify.cpp
llvm/test/CodeGen/Generic/MIRDebugify/check-line-and-variables-x.mir
llvm/test/CodeGen/Generic/MIRDebugify/check-line-and-variables.ll
llvm/test/CodeGen/Generic/MIRDebugify/check-line-and-variables.mir



diff  --git a/llvm/docs/HowToUpdateDebugInfo.rst 
b/llvm/docs/HowToUpdateDebugInfo.rst
index fff0cdbe59c8..7df2a8a25827 100644
--- a/llvm/docs/HowToUpdateDebugInfo.rst
+++ b/llvm/docs/HowToUpdateDebugInfo.rst
@@ -342,8 +342,8 @@ A variant of the ``debugify`` utility described in
 :ref:`Mutation testing for IR-level transformations` can be used
 for MIR-level transformations as well: much like the IR-level pass,
 ``mir-debugify`` inserts sequentially increasing line locations to each
-``MachineInstr`` in a ``Module``. And the MIR-level ``mir-check-debugify`` is
-similar to IR-level ``check-debugify`` pass.
+``MachineInstr`` in a ``Module`` (although there is no equivalent MIR-level
+``check-debugify`` pass).
 
 For example, here is a snippet before:
 
@@ -403,32 +403,16 @@ and ``-start-after``. For example:
   $ llc -debugify-and-strip-all-safe -run-pass=... 
   $ llc -debugify-and-strip-all-safe -O1 
 
-If you want to check it after each pass in a pipeline, use
-``-debugify-check-and-strip-all-safe``. This can also be combined with
-``-start-before`` and ``-start-after``. For example:
-
-.. code-block:: bash
-
-  $ llc -debugify-check-and-strip-all-safe -run-pass=... 
-  $ llc -debugify-check-and-strip-all-safe -O1 
-
-To check all debug info from a test, use ``mir-check-debugify``, like:
-
-.. code-block:: bash
-
-  $ llc -run-pass=mir-debugify,other-pass,mir-check-debugify
-
 To strip out all debug info from a test, use ``mir-strip-debug``, like:
 
 .. code-block:: bash
 
   $ llc -run-pass=mir-debugify,other-pass,mir-strip-debug
 
-It can be useful to combine ``mir-debugify``, ``mir-check-debugify`` and/or
-``mir-strip-debug`` to identify backend transformations which break in
-the presence of debug info. For example, to run the AArch64 backend tests
-with all normal passes "sandwiched" in between MIRDebugify and
-MIRStripDebugify mutation passes, run:
+It can be useful to combine ``mir-debugify`` and ``mir-strip-debug`` to
+identify backend transformations which break in the presence of debug info.
+For example, to run the AArch64 backend tests with all normal passes
+"sandwiched" in between MIRDebugify and MIRStripDebugify mutation passes, run:
 
 .. code-block:: bash
 

diff  --git a/llvm/include/llvm/CodeGen/Passes.h 
b/llvm/include/llvm/CodeGen/Passes.h
index 676ed2c65eb1..47037bac6270 100644
--- a/llvm/include/llvm/CodeGen/Passes.h
+++ b/llvm/include/llvm/CodeGen/Passes.h
@@ -482,9 +482,6 @@ namespace llvm {
   /// info was generated by another source such as clang.
   ModulePass *createStripDebugMachineModulePass(bool OnlyDebugified);
 
-  /// Creates MIR Check Debug pass. \see MachineCheckDebugify.cpp
-  ModulePass *createCheckDebugMachineModulePass();
-
   /// The pass fixups statepoint machine instruction to replace usage of
   /// caller saved registers with stack slots.
   extern char &FixupStatepointCallerSavedID;

diff  --git a/llvm/include/llvm/CodeGen/TargetPassConfig.h 
b/llvm/include/llvm/CodeGen/TargetPassConfig.h
index 9b42b0756d41..fc5245216941 100644
--- a/llvm/include/llvm/CodeGen/TargetPassConfig.h
+++ b/llvm/include/llvm/CodeGen/TargetPassConfig.h
@@ -313,9 +313,6 @@ class TargetPassConfig : public ImmutablePass {
   /// Add a pass to remove debug info from the MIR.
   void addStripDebugPass();
 
-  /// Add a pass to check synthesized debug info for MIR.
-  void addCheckDebugPass();
-
   /// Add standard passes before a pass that's about to be added. For example,
   /// the DebugifyMachineModulePass if it is enabled.
   void addMachinePrePasses(bool AllowDebugify = true);

diff  --git a/llvm/include/llvm/InitializePasses.h 
b/llvm/include/llvm/InitializePasses.h
index e1b3a8dd3f3a..b8420ade06a7 100644
--- a/llvm/i

[llvm-branch-commits] [llvm] 841f9c9 - Revert "[MachineDebugify] Insert synthetic DBG_VALUE instructions"

2020-12-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-14T22:14:48-05:00
New Revision: 841f9c937f6e593c926a26aedf054436eb807fe6

URL: 
https://github.com/llvm/llvm-project/commit/841f9c937f6e593c926a26aedf054436eb807fe6
DIFF: 
https://github.com/llvm/llvm-project/commit/841f9c937f6e593c926a26aedf054436eb807fe6.diff

LOG: Revert "[MachineDebugify] Insert synthetic DBG_VALUE instructions"

This reverts commit 2a5675f11d3bc803a245c0e2a3b47491c8f8a065.
The tests it adds fail: https://reviews.llvm.org/D78135#2453736

Added: 
llvm/test/CodeGen/Generic/MIRDebugify/locations.mir

Modified: 
llvm/lib/CodeGen/MachineDebugify.cpp
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-phi-insertpt-decrement.mir
llvm/test/DebugInfo/debugify.ll

Removed: 
llvm/test/CodeGen/AArch64/GlobalISel/constant-mir-debugify.mir
llvm/test/CodeGen/AArch64/GlobalISel/phi-mir-debugify.mir
llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir



diff  --git a/llvm/lib/CodeGen/MachineDebugify.cpp 
b/llvm/lib/CodeGen/MachineDebugify.cpp
index bf57ec0e8c28..bc607cabcc68 100644
--- a/llvm/lib/CodeGen/MachineDebugify.cpp
+++ b/llvm/lib/CodeGen/MachineDebugify.cpp
@@ -7,23 +7,16 @@
 
//===--===//
 ///
 /// \file This pass attaches synthetic debug info to everything. It can be used
-/// to create targeted tests for debug info preservation, or test for CodeGen
-/// 
diff erences with vs. without debug info.
+/// to create targeted tests for debug info preservation.
 ///
 /// This isn't intended to have feature parity with Debugify.
 
//===--===//
 
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
-#include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/CodeGen/Passes.h"
-#include "llvm/CodeGen/TargetInstrInfo.h"
-#include "llvm/CodeGen/TargetSubtargetInfo.h"
 #include "llvm/IR/DIBuilder.h"
 #include "llvm/IR/DebugInfo.h"
-#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/Transforms/Utils/Debugify.h"
 
@@ -38,15 +31,13 @@ bool 
applyDebugifyMetadataToMachineFunction(MachineModuleInfo &MMI,
   if (!MaybeMF)
 return false;
   MachineFunction &MF = *MaybeMF;
-  const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
 
   DISubprogram *SP = F.getSubprogram();
   assert(SP && "IR Debugify just created it?");
 
-  Module &M = *F.getParent();
-  LLVMContext &Ctx = M.getContext();
-
+  LLVMContext &Ctx = F.getParent()->getContext();
   unsigned NextLine = SP->getLine();
+
   for (MachineBasicBlock &MBB : MF) {
 for (MachineInstr &MI : MBB) {
   // This will likely emit line numbers beyond the end of the imagined
@@ -57,81 +48,6 @@ bool 
applyDebugifyMetadataToMachineFunction(MachineModuleInfo &MMI,
 }
   }
 
-  // Find local variables defined by debugify. No attempt is made to match up
-  // MIR-level regs to the 'correct' IR-level variables: there isn't a simple
-  // way to do that, and it isn't necessary to find interesting CodeGen bugs.
-  // Instead, simply keep track of one variable per line. Later, we can insert
-  // DBG_VALUE insts that point to these local variables. Emitting DBG_VALUEs
-  // which cover a wide range of lines can help stress the debug info passes:
-  // if we can't do that, fall back to using the local variable which precedes
-  // all the others.
-  Function *DbgValF = M.getFunction("llvm.dbg.value");
-  DbgValueInst *EarliestDVI = nullptr;
-  DenseMap Line2Var;
-  DIExpression *Expr = nullptr;
-  if (DbgValF) {
-for (const Use &U : DbgValF->uses()) {
-  auto *DVI = dyn_cast(U.getUser());
-  if (!DVI || DVI->getFunction() != &F)
-continue;
-  unsigned Line = DVI->getDebugLoc().getLine();
-  assert(Line != 0 && "debugify should not insert line 0 locations");
-  Line2Var[Line] = DVI->getVariable();
-  if (!EarliestDVI || Line < EarliestDVI->getDebugLoc().getLine())
-EarliestDVI = DVI;
-  Expr = DVI->getExpression();
-}
-  }
-  if (Line2Var.empty())
-return true;
-
-  // Now, try to insert a DBG_VALUE instruction after each real instruction.
-  // Do this by introducing debug uses of each register definition. If that is
-  // not possible (e.g. we have a phi or a meta instruction), emit a constant.
-  uint64_t NextImm = 0;
-  const MCInstrDesc &DbgValDesc = TII.get(TargetOpcode::DBG_VALUE);
-  for (MachineBasicBlock &MBB : MF) {
-MachineBasicBlock::iterator FirstNonPHIIt = MBB.getFirstNonPHI();
-for (auto I = MBB.begin(), E = MBB.end(); I != E; ) {
-  MachineInstr &MI = *I;
-  ++I;
-
-  // `I` may point to a DBG_VALUE created in the previous loop iteration.
-  if (MI.isDebugInstr())
-continue;
-
-  // I

[llvm-branch-commits] [llvm] a852ee1 - Reland "[MachineDebugify] Insert synthetic DBG_VALUE instructions"

2020-12-14 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-14T22:34:23-05:00
New Revision: a852ee199c73237d89932019e8a74cf38842f2bd

URL: 
https://github.com/llvm/llvm-project/commit/a852ee199c73237d89932019e8a74cf38842f2bd
DIFF: 
https://github.com/llvm/llvm-project/commit/a852ee199c73237d89932019e8a74cf38842f2bd.diff

LOG: Reland "[MachineDebugify] Insert synthetic DBG_VALUE instructions"

This reverts commit 841f9c937f6e593c926a26aedf054436eb807fe6.
The change landed many months ago; something else broke those tests.

Added: 
llvm/test/CodeGen/AArch64/GlobalISel/constant-mir-debugify.mir
llvm/test/CodeGen/AArch64/GlobalISel/phi-mir-debugify.mir
llvm/test/CodeGen/Generic/MIRDebugify/locations-and-values.mir

Modified: 
llvm/lib/CodeGen/MachineDebugify.cpp
llvm/lib/Transforms/Utils/Debugify.cpp
llvm/test/CodeGen/AArch64/GlobalISel/legalize-phi-insertpt-decrement.mir
llvm/test/DebugInfo/debugify.ll

Removed: 
llvm/test/CodeGen/Generic/MIRDebugify/locations.mir



diff  --git a/llvm/lib/CodeGen/MachineDebugify.cpp 
b/llvm/lib/CodeGen/MachineDebugify.cpp
index bc607cabcc68..bf57ec0e8c28 100644
--- a/llvm/lib/CodeGen/MachineDebugify.cpp
+++ b/llvm/lib/CodeGen/MachineDebugify.cpp
@@ -7,16 +7,23 @@
 
//===--===//
 ///
 /// \file This pass attaches synthetic debug info to everything. It can be used
-/// to create targeted tests for debug info preservation.
+/// to create targeted tests for debug info preservation, or test for CodeGen
+/// 
diff erences with vs. without debug info.
 ///
 /// This isn't intended to have feature parity with Debugify.
 
//===--===//
 
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineModuleInfo.h"
 #include "llvm/CodeGen/Passes.h"
+#include "llvm/CodeGen/TargetInstrInfo.h"
+#include "llvm/CodeGen/TargetSubtargetInfo.h"
 #include "llvm/IR/DIBuilder.h"
 #include "llvm/IR/DebugInfo.h"
+#include "llvm/IR/IntrinsicInst.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/Transforms/Utils/Debugify.h"
 
@@ -31,13 +38,15 @@ bool 
applyDebugifyMetadataToMachineFunction(MachineModuleInfo &MMI,
   if (!MaybeMF)
 return false;
   MachineFunction &MF = *MaybeMF;
+  const TargetInstrInfo &TII = *MF.getSubtarget().getInstrInfo();
 
   DISubprogram *SP = F.getSubprogram();
   assert(SP && "IR Debugify just created it?");
 
-  LLVMContext &Ctx = F.getParent()->getContext();
-  unsigned NextLine = SP->getLine();
+  Module &M = *F.getParent();
+  LLVMContext &Ctx = M.getContext();
 
+  unsigned NextLine = SP->getLine();
   for (MachineBasicBlock &MBB : MF) {
 for (MachineInstr &MI : MBB) {
   // This will likely emit line numbers beyond the end of the imagined
@@ -48,6 +57,81 @@ bool 
applyDebugifyMetadataToMachineFunction(MachineModuleInfo &MMI,
 }
   }
 
+  // Find local variables defined by debugify. No attempt is made to match up
+  // MIR-level regs to the 'correct' IR-level variables: there isn't a simple
+  // way to do that, and it isn't necessary to find interesting CodeGen bugs.
+  // Instead, simply keep track of one variable per line. Later, we can insert
+  // DBG_VALUE insts that point to these local variables. Emitting DBG_VALUEs
+  // which cover a wide range of lines can help stress the debug info passes:
+  // if we can't do that, fall back to using the local variable which precedes
+  // all the others.
+  Function *DbgValF = M.getFunction("llvm.dbg.value");
+  DbgValueInst *EarliestDVI = nullptr;
+  DenseMap Line2Var;
+  DIExpression *Expr = nullptr;
+  if (DbgValF) {
+for (const Use &U : DbgValF->uses()) {
+  auto *DVI = dyn_cast(U.getUser());
+  if (!DVI || DVI->getFunction() != &F)
+continue;
+  unsigned Line = DVI->getDebugLoc().getLine();
+  assert(Line != 0 && "debugify should not insert line 0 locations");
+  Line2Var[Line] = DVI->getVariable();
+  if (!EarliestDVI || Line < EarliestDVI->getDebugLoc().getLine())
+EarliestDVI = DVI;
+  Expr = DVI->getExpression();
+}
+  }
+  if (Line2Var.empty())
+return true;
+
+  // Now, try to insert a DBG_VALUE instruction after each real instruction.
+  // Do this by introducing debug uses of each register definition. If that is
+  // not possible (e.g. we have a phi or a meta instruction), emit a constant.
+  uint64_t NextImm = 0;
+  const MCInstrDesc &DbgValDesc = TII.get(TargetOpcode::DBG_VALUE);
+  for (MachineBasicBlock &MBB : MF) {
+MachineBasicBlock::iterator FirstNonPHIIt = MBB.getFirstNonPHI();
+for (auto I = MBB.begin(), E = MBB.end(); I != E; ) {
+  MachineInstr &MI = *I;
+  ++I;
+
+  // `I` may point to a DBG_VALUE created in the previous loop iteration.
+  if (MI.isDebug

[llvm-branch-commits] [lld] 601f0fb - [lld/mac] Set ordinal on dynamic undefined symbols in symbol table

2020-12-15 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-15T14:39:36-05:00
New Revision: 601f0fb8465b9a8a22015f959261c66ec98878a4

URL: 
https://github.com/llvm/llvm-project/commit/601f0fb8465b9a8a22015f959261c66ec98878a4
DIFF: 
https://github.com/llvm/llvm-project/commit/601f0fb8465b9a8a22015f959261c66ec98878a4.diff

LOG: [lld/mac] Set ordinal on dynamic undefined symbols in symbol table

This lets `nm -m` print "(from libfoo)" in its output, which is more
accessible than dumping the bind table.

See https://reviews.llvm.org/D57190#2455761 for the somewhat
surprising `AltEntry` that appears in symtab.s.

Differential Revision: https://reviews.llvm.org/D93318

Added: 


Modified: 
lld/MachO/SyntheticSections.cpp
lld/test/MachO/dylink.s
lld/test/MachO/symtab.s

Removed: 




diff  --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 808d3594bfad..c2c121005899 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -753,6 +753,10 @@ void SymtabSection::writeTo(uint8_t *buf) const {
 nList->n_value = defined->getVA();
   }
   nList->n_desc |= defined->isWeakDef() ? MachO::N_WEAK_DEF : 0;
+} else if (auto *dysym = dyn_cast(entry.sym)) {
+  uint16_t n_desc = nList->n_desc;
+  MachO::SET_LIBRARY_ORDINAL(n_desc, dysym->file->ordinal);
+  nList->n_desc = n_desc;
 }
 ++nList;
   }

diff  --git a/lld/test/MachO/dylink.s b/lld/test/MachO/dylink.s
index 2a8e19d966d6..a727b7539397 100644
--- a/lld/test/MachO/dylink.s
+++ b/lld/test/MachO/dylink.s
@@ -38,6 +38,12 @@
 # CHECK-DAG: __DATA   __data 0x{{0*}}[[#%x, DATA_ADDR + 8]]
   pointer 8   libhello   _hello_its_me
 # CHECK-DAG: __DATA   __data 0x{{0*}}[[#%x, DATA_ADDR + 16]]   
   pointer -15 libgoodbye _goodbye_world
 
+# RUN: llvm-nm -m %t/dylink | FileCheck --check-prefix=NM %s
+
+# NM-DAG: _goodbye_world (from libgoodbye)
+# NM-DAG: _hello_its_me (from libhello)
+# NM-DAG: _hello_world (from libhello)
+
 # RUN: llvm-objdump --macho --all-headers %t/dylink | FileCheck %s \
 # RUN:   --check-prefix=LOAD --implicit-check-not LC_LOAD_DYLIB
 ## Check that we don't create duplicate LC_LOAD_DYLIBs.

diff  --git a/lld/test/MachO/symtab.s b/lld/test/MachO/symtab.s
index a4dce665acb4..2fe550a330f1 100644
--- a/lld/test/MachO/symtab.s
+++ b/lld/test/MachO/symtab.s
@@ -62,7 +62,7 @@
 # CHECK-NEXT: Type: Undef (0x0)
 # CHECK-NEXT: Section:  (0x0)
 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
-# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: Flags [ (0x100)
 # CHECK-NEXT: ]
 # CHECK-NEXT: Value: 0x0
 # CHECK-NEXT:   }
@@ -71,7 +71,8 @@
 # CHECK-NEXT: Type: Undef (0x0)
 # CHECK-NEXT: Section:  (0x0)
 # CHECK-NEXT: RefType: UndefinedNonLazy (0x0)
-# CHECK-NEXT: Flags [ (0x0)
+# CHECK-NEXT: Flags [ (0x200)
+# CHECK-NEXT:   AltEntry (0x200)
 # CHECK-NEXT: ]
 # CHECK-NEXT: Value: 0x0
 # CHECK-NEXT:   }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 09edd9d - [mac/lld] simplify code using PackedVersion instead of VersionTuple

2020-12-15 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-15T19:23:07-05:00
New Revision: 09edd9df6e1fa8c316de82aac3718cb9adf17f15

URL: 
https://github.com/llvm/llvm-project/commit/09edd9df6e1fa8c316de82aac3718cb9adf17f15
DIFF: 
https://github.com/llvm/llvm-project/commit/09edd9df6e1fa8c316de82aac3718cb9adf17f15.diff

LOG: [mac/lld] simplify code using PackedVersion instead of VersionTuple

PackedVersion already does the correct range checks.

No behavior change.

Differential Revision: https://reviews.llvm.org/D93338

Added: 


Modified: 
lld/MachO/Driver.cpp
lld/test/MachO/dylib-version.s

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 8bac9b7b877f..030cbef53049 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -40,6 +40,7 @@
 #include "llvm/Support/Path.h"
 #include "llvm/Support/TarWriter.h"
 #include "llvm/Support/TargetSelect.h"
+#include "llvm/TextAPI/MachO/PackedVersion.h"
 
 #include 
 
@@ -673,34 +674,13 @@ static uint32_t parseDylibVersion(const opt::ArgList& 
args, unsigned id) {
 return 0;
   }
 
-  llvm::VersionTuple version;
-  if (version.tryParse(arg->getValue()) || version.getBuild().hasValue()) {
+  PackedVersion version;
+  if (!version.parse32(arg->getValue())) {
 error(arg->getAsString(args) + ": malformed version");
 return 0;
   }
 
-  unsigned major = version.getMajor();
-  if (major > UINT16_MAX) {
-error(arg->getAsString(args) + ": component " + Twine(major) +
-  " out of range");
-return 0;
-  }
-
-  unsigned minor = version.getMinor().getValueOr(0);
-  if (minor > UINT8_MAX) {
-error(arg->getAsString(args) + ": component " + Twine(minor) +
-  " out of range");
-return 0;
-  }
-
-  unsigned subminor = version.getSubminor().getValueOr(0);
-  if (subminor > UINT8_MAX) {
-error(arg->getAsString(args) + ": component " + Twine(subminor) +
-  " out of range");
-return 0;
-  }
-
-  return (major << 16) | (minor << 8) | subminor;
+  return version.rawValue();
 }
 
 bool macho::link(llvm::ArrayRef argsArr, bool canExitEarly,

diff  --git a/lld/test/MachO/dylib-version.s b/lld/test/MachO/dylib-version.s
index 41c3c6135d1d..c2376773e34b 100644
--- a/lld/test/MachO/dylib-version.s
+++ b/lld/test/MachO/dylib-version.s
@@ -25,19 +25,19 @@
 # RUN: -compatibility_version 8.1 -current_version 1.2.3 2>&1 | \
 # RUN: FileCheck --check-prefix=BADMAJOR %s
 
-# BADMAJOR: error: -compatibility_version 8.1: component 8 out of range
+# BADMAJOR: error: -compatibility_version 8.1: malformed version
 
 # RUN: not %lld -dylib -o %t/executable %t.o -o /dev/null \
 # RUN: -compatibility_version 8.300 -current_version 1.2.3 2>&1 | \
 # RUN: FileCheck --check-prefix=BADMINOR %s
 
-# BADMINOR: error: -compatibility_version 8.300: component 300 out of range
+# BADMINOR: error: -compatibility_version 8.300: malformed version
 
 # RUN: not %lld -dylib -o %t/executable %t.o -o /dev/null \
 # RUN: -compatibility_version 8.8.300 -current_version 1.2.3 2>&1 | \
 # RUN: FileCheck --check-prefix=BADSUBMINOR %s
 
-# BADSUBMINOR: error: -compatibility_version 8.8.300: component 300 out of 
range
+# BADSUBMINOR: error: -compatibility_version 8.8.300: malformed version
 
 # RUN: %lld -dylib -o %t/executable %t.o -o %t.dylib \
 # RUN: -compatibility_version 1.2.3 -current_version 2.5.6



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ec88746 - [lld/mac] fill in current and compatibility version for LC_LOAD_(WEAK_)DYLIB

2020-12-15 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-15T19:34:59-05:00
New Revision: ec88746a059d9b73cd6d9096c161bdd0cafc8229

URL: 
https://github.com/llvm/llvm-project/commit/ec88746a059d9b73cd6d9096c161bdd0cafc8229
DIFF: 
https://github.com/llvm/llvm-project/commit/ec88746a059d9b73cd6d9096c161bdd0cafc8229.diff

LOG: [lld/mac] fill in current and compatibility version for 
LC_LOAD_(WEAK_)DYLIB

Not sure if anything actually depends on this, but it makes `otool -L`
output look nicer.

Differential Revision: https://reviews.llvm.org/D93332

Added: 


Modified: 
lld/MachO/InputFiles.cpp
lld/MachO/InputFiles.h
lld/MachO/Writer.cpp
lld/test/MachO/dylink.s
lld/test/MachO/stub-link.s

Removed: 




diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 78c3dc9b7a52..3ae3b976afa3 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -537,6 +537,8 @@ DylibFile::DylibFile(MemoryBufferRef mb, DylibFile 
*umbrella)
   // Initialize dylibName.
   if (const load_command *cmd = findCommand(hdr, LC_ID_DYLIB)) {
 auto *c = reinterpret_cast(cmd);
+currentVersion = read32le(&c->dylib.current_version);
+compatibilityVersion = read32le(&c->dylib.compatibility_version);
 dylibName = reinterpret_cast(cmd) + read32le(&c->dylib.name);
   } else {
 error("dylib " + toString(this) + " missing LC_ID_DYLIB load command");
@@ -583,6 +585,8 @@ DylibFile::DylibFile(const InterfaceFile &interface, 
DylibFile *umbrella)
 umbrella = this;
 
   dylibName = saver.save(interface.getInstallName());
+  compatibilityVersion = interface.getCompatibilityVersion().rawValue();
+  currentVersion = interface.getCurrentVersion().rawValue();
   DylibFile *exportingFile = isImplicitlyLinked(dylibName) ? this : umbrella;
   auto addSymbol = [&](const Twine &name) -> void {
 symbols.push_back(symtab->addDylib(saver.save(name), exportingFile,

diff  --git a/lld/MachO/InputFiles.h b/lld/MachO/InputFiles.h
index e52905e75d56..f48fc1f8c232 100644
--- a/lld/MachO/InputFiles.h
+++ b/lld/MachO/InputFiles.h
@@ -132,6 +132,8 @@ class DylibFile : public InputFile {
   static bool classof(const InputFile *f) { return f->kind() == DylibKind; }
 
   StringRef dylibName;
+  uint32_t compatibilityVersion = 0;
+  uint32_t currentVersion = 0;
   uint64_t ordinal = 0; // Ordinal numbering starts from 1, so 0 is a sentinel
   bool reexport = false;
   bool forceWeakImport = false;

diff  --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 9f6aa0b49692..29c8fd6ed1fa 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -467,7 +467,9 @@ void Writer::createLoadCommands() {
   // loaded via LC_LOAD_WEAK_DYLIB.
   LoadCommandType lcType =
   dylibFile->forceWeakImport ? LC_LOAD_WEAK_DYLIB : LC_LOAD_DYLIB;
-  in.header->addLoadCommand(make(lcType, dylibFile->dylibName));
+  in.header->addLoadCommand(make(lcType, dylibFile->dylibName,
+  dylibFile->compatibilityVersion,
+  dylibFile->currentVersion));
   dylibFile->ordinal = dylibOrdinal++;
 
   if (dylibFile->reexport)

diff  --git a/lld/test/MachO/dylink.s b/lld/test/MachO/dylink.s
index a727b7539397..0330a85d5504 100644
--- a/lld/test/MachO/dylink.s
+++ b/lld/test/MachO/dylink.s
@@ -4,8 +4,9 @@
 # RUN:   -o %t/libhello.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin 
%p/Inputs/libgoodbye.s \
 # RUN:   -o %t/libgoodbye.o
-# RUN: %lld -dylib -install_name \
-# RUN:   @executable_path/libhello.dylib %t/libhello.o -o %t/libhello.dylib
+# RUN: %lld -dylib -install_name @executable_path/libhello.dylib \
+# RUN:   -compatibility_version 10 -current_version 11 \
+# RUN:   %t/libhello.o -o %t/libhello.dylib
 # RUN: %lld -dylib -install_name \
 # RUN:   @executable_path/libgoodbye.dylib %t/libgoodbye.o -o 
%t/libgoodbye.dylib
 
@@ -51,12 +52,15 @@
 # RUN: llvm-objdump --macho --all-headers %t/dylink | FileCheck %s \
 # RUN:   --check-prefix=LOAD --implicit-check-not LC_LOAD_DYLIB
 
-# LOAD:  cmd LC_LOAD_DYLIB
-# LOAD-NEXT: cmdsize
-# LOAD-NEXT:name @executable_path/libhello.dylib
-# LOAD:  cmd LC_LOAD_DYLIB
-# LOAD-NEXT: cmdsize
-# LOAD-NEXT:name @executable_path/libgoodbye.dylib
+# LOAD:cmd LC_LOAD_DYLIB
+# LOAD-NEXT:   cmdsize
+# LOAD-NEXT:  name @executable_path/libhello.dylib
+# LOAD-NEXT:time stamp
+# LOAD-NEXT:   current version 11.0.0
+# LOAD-NEXT: compatibility version 10.0.0
+# LOAD:cmd LC_LOAD_DYLIB
+# LOAD-NEXT:   cmdsize
+# LOAD-NEXT:  name @executable_path/libgoodbye.dylib
 
 .section __TEXT,__text
 .globl _main

diff  --git a/lld/test/MachO/stub-link.s b/lld/test/MachO/stub-link.s
index a0ee36d700ec..546415191dad 100644
--- a/lld/test/MachO/stub-link.s
+++ b/lld/te

[llvm-branch-commits] [lld] abc08d5 - [mac/lld] fix amend mishap from ec88746a059

2020-12-15 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-15T19:41:00-05:00
New Revision: abc08d5ec703cc914906b9ad11cd22fc5bdcd1a2

URL: 
https://github.com/llvm/llvm-project/commit/abc08d5ec703cc914906b9ad11cd22fc5bdcd1a2
DIFF: 
https://github.com/llvm/llvm-project/commit/abc08d5ec703cc914906b9ad11cd22fc5bdcd1a2.diff

LOG: [mac/lld] fix amend mishap from ec88746a059

Added: 


Modified: 
lld/test/MachO/stub-link.s

Removed: 




diff  --git a/lld/test/MachO/stub-link.s b/lld/test/MachO/stub-link.s
index 546415191dad..5ca91efaef99 100644
--- a/lld/test/MachO/stub-link.s
+++ b/lld/test/MachO/stub-link.s
@@ -25,7 +25,7 @@
 # LOAD-NEXT:   cmdsize
 # LOAD-NEXT:  name /usr/lib/libSystem.B.dylib
 # LOAD-NEXT:time stamp
-# LOAD-NEXT:   current version 1.1.0
+# LOAD-NEXT:   current version 1.1.1
 # LOAD-NEXT: compatibility version
 
 .section __TEXT,__text



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] f48dae3 - [gn build] (manually) port ddffcdf0a66

2020-12-16 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-16T20:49:56-05:00
New Revision: f48dae310866851aaeba9e1271935b543b413113

URL: 
https://github.com/llvm/llvm-project/commit/f48dae310866851aaeba9e1271935b543b413113
DIFF: 
https://github.com/llvm/llvm-project/commit/f48dae310866851aaeba9e1271935b543b413113.diff

LOG: [gn build] (manually) port ddffcdf0a66

Added: 


Modified: 
llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn

Removed: 




diff  --git 
a/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn 
b/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn
index ad44b01c5d2f..935c2aab2282 100644
--- a/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang-tools-extra/unittests/clang-tidy/BUILD.gn
@@ -20,6 +20,7 @@ unittest("ClangTidyTests") {
 "//clang/lib/Tooling/Core",
 "//clang/lib/Tooling/Transformer",
 "//llvm/lib/Support",
+"//llvm/lib/Testing/Support",
   ]
   include_dirs = [ "//clang-tools-extra/clang-tidy" ]
   sources = [



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 85ffbe5 - [gn build] (manually) merge f4c8b8031800

2020-12-17 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-17T15:09:51-05:00
New Revision: 85ffbe5d6a0d6bf5ad651f415ca01dc3e3c4dc76

URL: 
https://github.com/llvm/llvm-project/commit/85ffbe5d6a0d6bf5ad651f415ca01dc3e3c4dc76
DIFF: 
https://github.com/llvm/llvm-project/commit/85ffbe5d6a0d6bf5ad651f415ca01dc3e3c4dc76.diff

LOG: [gn build] (manually) merge f4c8b8031800

Added: 


Modified: 
llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn

Removed: 




diff  --git 
a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
index 6fe62a0f5a71..bb1c8803d9ca 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
@@ -1,16 +1,15 @@
 import("//llvm/utils/TableGen/tablegen.gni")
 
-tablegen("OMP") {
+tablegen("OMPh") {
   visibility = [ ":public_tablegen" ]
   args = [ "-gen-directive-decl" ]
   output_name = "OMP.h.inc"
+  td_file = "OMP.td"
 }
 
-tablegen("OMPcpp") {
+tablegen("OMP") {
   visibility = [ ":public_tablegen" ]
   args = [ "-gen-directive-gen" ]
-  output_name = "OMP.cpp.inc"
-  td_file = "OMP.td"
 }
 
 # Groups all tablegen() calls that create .inc files that are included in
@@ -20,7 +19,7 @@ tablegen("OMPcpp") {
 group("public_tablegen") {
   public_deps = [
 # Frontend/OpenMP's public headers include OMP.h.inc.
+":OMPh",
 ":OMP",
-":OMPcpp",
   ]
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 7e33fd9 - [gn build] Link with -Wl, --gdb-index when linking with LLD

2020-12-17 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-17T15:39:00-05:00
New Revision: 7e33fd9ce2d8f94bb7195c417426620037804834

URL: 
https://github.com/llvm/llvm-project/commit/7e33fd9ce2d8f94bb7195c417426620037804834
DIFF: 
https://github.com/llvm/llvm-project/commit/7e33fd9ce2d8f94bb7195c417426620037804834.diff

LOG: [gn build] Link with -Wl,--gdb-index when linking with LLD

For full-debug-info (is_debug=true / symbol_level=2 builds), this makes
linking 15% slower, but gdb startup 1500% faster (for lld: link time
3.9s->4.4s, gdb load time >30s->2s).

For link time, I ran

bench.py -o {noindex,index}.txt \
sh -c 'rm out/gn/bin/lld && ninja -C out/gn lld'

and then `ministat noindex.txt index.txt`:

```
x noindex.txt
+ index.txt
N   Min   MaxMedian   AvgStddev
x   5  3.784461 4.0200169 3.8452811 3.8754988   0.089902595
+   5   4.32496 4.6058481 4.3361208 4.41411980.12288267
Difference at 95.0% confidence
0.538621 +/- 0.15702
13.8981% +/- 4.05161%
(Student's t, pooled s = 0.107663)
```

For gdb load time I loaded the crash in PR48392 with

gdb -ex r --args ../out/gn/bin/ld64.lld.darwinnew @response.txt

and just stopped the time until the crash got displayed with a stopwatch
a few times. So the speedup there is less precise, but it's so
pronounced that that's ok (loads ~instantly with the patch, takes a very
long time without it).

Only doing this for LLD because I haven't tried it with other linkers.

Differential Revision: https://reviews.llvm.org/D92844

Added: 


Modified: 
llvm/utils/gn/build/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index 49caf447d019..92d667c16f70 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -77,8 +77,25 @@ config("compiler_defaults") {
   if (host_os != "win") {
 if (symbol_level == 2) {
   cflags += [ "-g" ]
+
+  # For full debug-info -g builds, --gdb-index makes links ~15% slower, and
+  # gdb symbol reading time 1500% faster (lld links in 4.4 instead of 3.9s,
+  # and gdb loads and runs it in 2s instead of in 30s).  It's likely that
+  # people doing symbol_level=2 want to run a debugger (since
+  # symbol_level=2 isn't the default). So this seems like the right
+  # tradeoff.
+  if (host_os != "mac" && use_lld) {
+cflags += [ "-ggnu-pubnames" ]  # PR34820
+ldflags += [ "-Wl,--gdb-index" ]
+  }
 } else if (symbol_level == 1) {
   cflags += [ "-g1" ]
+
+  # For linetable-only -g1 builds, --gdb-index makes links ~8% slower, but
+  # links are 4x faster than -g builds so it's a fairly small absolute 
cost.
+  # On the other hand, gdb startup is well below 1s with and without the
+  # index, and people using -g1 likely don't use a debugger. So don't use
+  # the flag here.
 }
 if (is_optimized) {
   cflags += [ "-O3" ]



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 49c248b - clang-cl: Remove /Zd flag

2020-12-17 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-17T15:39:40-05:00
New Revision: 49c248bd62a3cb2f0e7e3991ee0190943bd2bbec

URL: 
https://github.com/llvm/llvm-project/commit/49c248bd62a3cb2f0e7e3991ee0190943bd2bbec
DIFF: 
https://github.com/llvm/llvm-project/commit/49c248bd62a3cb2f0e7e3991ee0190943bd2bbec.diff

LOG: clang-cl: Remove /Zd flag

cl.exe doesn't understand Zd (in either MSVC 2017 or 2019), so neiter
should we. It used to do the same as `-gline-tables-only` which is
exposed as clang-cl flag as well, so if you want this behavior, use
`gline-tables-only`. That makes it clear that it's a clang-cl-only flag
that won't work with cl.exe.

Motivated by the discussion in D92958.

Differential Revision: https://reviews.llvm.org/D93458

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/MSVC.cpp
clang/test/Driver/cl-options.c

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index ef7903e16f7fa..a3038aa03cded 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -119,6 +119,14 @@ Modified Compiler Flags
   `nonnull` attribute on `this` for configurations that need it to be nullable.
 - ``-gsplit-dwarf`` no longer implies ``-g2``.
 
+Removed Compiler Flags
+-
+
+The following options no longer exist.
+
+- clang-cl's ``/Zd`` flag no longer exist. But ``-gline-tables-only`` still
+  exists and does the same thing.
+
 New Pragmas in Clang
 
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 07f15add28ec6..ca9615e2e7692 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5351,8 +5351,6 @@ def _SLASH_Zc_twoPhase_ : CLFlag<"Zc:twoPhase-">,
   Alias;
 def _SLASH_Z7 : CLFlag<"Z7">,
   HelpText<"Enable CodeView debug information in object files">;
-def _SLASH_Zd : CLFlag<"Zd">,
-  HelpText<"Emit debug line number tables only">;
 def _SLASH_Zi : CLFlag<"Zi">, Alias<_SLASH_Z7>,
   HelpText<"Like /Z7">;
 def _SLASH_Zp : CLJoined<"Zp">,

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 6ec6a551fafee..300ab6e815e23 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6801,10 +6801,9 @@ void Clang::AddClangCLArgs(const ArgList &Args, 
types::ID InputType,
 CmdArgs.push_back(Args.MakeArgString(Twine(LangOptions::SSPStrong)));
   }
 
-  // Emit CodeView if -Z7, -Zd, or -gline-tables-only are present.
-  if (Arg *DebugInfoArg =
-  Args.getLastArg(options::OPT__SLASH_Z7, options::OPT__SLASH_Zd,
-  options::OPT_gline_tables_only)) {
+  // Emit CodeView if -Z7 or -gline-tables-only are present.
+  if (Arg *DebugInfoArg = Args.getLastArg(options::OPT__SLASH_Z7,
+  options::OPT_gline_tables_only)) {
 *EmitCodeView = true;
 if (DebugInfoArg->getOption().matches(options::OPT__SLASH_Z7))
   *DebugInfoKind = codegenoptions::LimitedDebugInfo;

diff  --git a/clang/lib/Driver/ToolChains/MSVC.cpp 
b/clang/lib/Driver/ToolChains/MSVC.cpp
index 1e04cc9f62713..f4b7a57e0bb70 100644
--- a/clang/lib/Driver/ToolChains/MSVC.cpp
+++ b/clang/lib/Driver/ToolChains/MSVC.cpp
@@ -382,8 +382,7 @@ void visualstudio::Linker::ConstructJob(Compilation &C, 
const JobAction &JA,
 
   CmdArgs.push_back("-nologo");
 
-  if (Args.hasArg(options::OPT_g_Group, options::OPT__SLASH_Z7,
-  options::OPT__SLASH_Zd))
+  if (Args.hasArg(options::OPT_g_Group, options::OPT__SLASH_Z7))
 CmdArgs.push_back("-debug");
 
   // Pass on /Brepro if it was passed to the compiler.

diff  --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c
index 43713d955b9bc..db70fca5222c6 100644
--- a/clang/test/Driver/cl-options.c
+++ b/clang/test/Driver/cl-options.c
@@ -538,10 +538,6 @@
 // Z7: "-gcodeview"
 // Z7: "-debug-info-kind=limited"
 
-// RUN: %clang_cl /Zd /c -### -- %s 2>&1 | FileCheck -check-prefix=Z7GMLT %s
-// Z7GMLT: "-gcodeview"
-// Z7GMLT: "-debug-info-kind=line-tables-only"
-
 // RUN: %clang_cl -gline-tables-only /c -### -- %s 2>&1 | FileCheck 
-check-prefix=ZGMLT %s
 // ZGMLT: "-gcodeview"
 // ZGMLT: "-debug-info-kind=line-tables-only"



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] f710bb7 - lld: Replace some lld::outs()s with message()

2020-12-17 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-17T16:19:09-05:00
New Revision: f710bb7063b232be1cffc7a0f0f56606d7bff2ad

URL: 
https://github.com/llvm/llvm-project/commit/f710bb7063b232be1cffc7a0f0f56606d7bff2ad
DIFF: 
https://github.com/llvm/llvm-project/commit/f710bb7063b232be1cffc7a0f0f56606d7bff2ad.diff

LOG: lld: Replace some lld::outs()s with message()

No behavior change.

Added: 


Modified: 
lld/COFF/Driver.cpp
lld/MachO/Driver.cpp
lld/MachO/DriverUtils.cpp

Removed: 




diff  --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 504c00584d9c..08862b062f91 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -1263,7 +1263,7 @@ void LinkerDriver::link(ArrayRef argsArr) {
   // because it doesn't start with "/", but we deliberately chose "--" to
   // avoid conflict with /version and for compatibility with clang-cl.
   if (args.hasArg(OPT_dash_dash_version)) {
-lld::outs() << getLLDVersion() << "\n";
+message(getLLDVersion());
 return;
   }
 

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index db89dd60a20b..4f9c111bd8fb 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -325,7 +325,7 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
 // printArchiveMemberLoad() prints both .a and .o names, so no need to
 // print the .a name here.
 if (config->printEachFile && magic != file_magic::archive)
-  lld::outs() << toString(newFile) << '\n';
+  message(toString(newFile));
 inputFiles.insert(newFile);
   }
   return newFile;

diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 5040f634e181..563ae266735d 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -208,7 +208,7 @@ uint32_t macho::getModTime(StringRef path) {
 
 void macho::printArchiveMemberLoad(StringRef reason, const InputFile *f) {
   if (config->printEachFile)
-lld::outs() << toString(f) << '\n';
+message(toString(f));
   if (config->printWhyLoad)
-lld::outs() << reason << " forced load of " << toString(f) << '\n';
+message(reason + " forced load of " + toString(f));
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 13f439a - [lld/mac] Implement support for private extern symbols

2020-12-21 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-21T21:23:33-05:00
New Revision: 13f439a1872b559d72ee2b5951395310ce4393cc

URL: 
https://github.com/llvm/llvm-project/commit/13f439a1872b559d72ee2b5951395310ce4393cc
DIFF: 
https://github.com/llvm/llvm-project/commit/13f439a1872b559d72ee2b5951395310ce4393cc.diff

LOG: [lld/mac] Implement support for private extern symbols

Private extern symbols are used for things scoped to the linkage unit.
They cause duplicate symbol errors (so they're in the symbol table,
unlike TU-scoped truly local symbols), but they don't make it into the
export trie. They are created e.g. by compiling with
-fvisibility=hidden.

If two weak symbols have differing privateness, the combined symbol is
non-private external. (Example: inline functions and some TUs that
include the header defining it were built with
-fvisibility-inlines-hidden and some weren't).

A weak private external symbol implicitly has its "weak" dropped and
behaves like a regular strong private external symbol: Weak is an export
trie concept, and private symbols are not in the export trie.

If a weak and a strong symbol have different privateness, the strong
symbol wins.

If two common symbols have differing privateness, the larger symbol
wins. If they have the same size, the privateness of the symbol seen
later during the link wins (!) -- this is a bit lame, but it matches
ld64 and this behavior takes 2 lines less to implement than the less
surprising "result is non-private external), so match ld64.
(Example: `int a` in two .c files, both built with -fcommon,
one built with -fvisibility=hidden and one without.)

This also makes `__dyld_private` a true TU-local symbol, matching ld64.
To make this work, make the `const char*` StringRefZ ctor to correctly
set `size` (without this, writing the string table crashed when calling
getName() on the __dyld_private symbol).

Mention in CommonSymbol's comment that common symbols are now disabled
by default in clang.

Mention in -keep_private_externs's HelpText that the flag only has an
effect with `-r` (which we don't implement yet -- so this patch here
doesn't regress any behavior around -r + -keep_private_externs)). ld64
doesn't explicitly document it, but the commit text of
http://reviews.llvm.org/rL216146 does, and ld64's
OutputFile::buildSymbolTable() checks `_options.outputKind() ==
Options::kObjectFile` before calling `_options.keepPrivateExterns()`
(the only reference to that function).

Fixes PR48536.

Differential Revision: https://reviews.llvm.org/D93609

Added: 
lld/test/MachO/private-extern.s
lld/test/MachO/weak-private-extern.s

Modified: 
lld/MachO/Driver.cpp
lld/MachO/InputFiles.cpp
lld/MachO/Options.td
lld/MachO/SymbolTable.cpp
lld/MachO/SymbolTable.h
lld/MachO/Symbols.h
lld/MachO/SyntheticSections.cpp
lld/MachO/SyntheticSections.h
lld/test/MachO/dylink-lazy.s
lld/test/MachO/symtab.s

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 9838e67cd4a2..82ddcf084dc0 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -524,7 +524,7 @@ static void replaceCommonSymbols() {
 
 replaceSymbol(sym, sym->getName(), isec, /*value=*/0,
/*isWeakDef=*/false,
-   /*isExternal=*/true);
+   /*isExternal=*/true, common->privateExtern);
   }
 }
 

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 3a4466dd123a..e2282f1fb2bb 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -280,22 +280,33 @@ void ObjFile::parseRelocations(const section_64 &sec,
 static macho::Symbol *createDefined(const structs::nlist_64 &sym,
 StringRef name, InputSection *isec,
 uint32_t value) {
-  if (sym.n_type & N_EXT)
-// Global defined symbol
-return symtab->addDefined(name, isec, value, sym.n_desc & N_WEAK_DEF);
-  // Local defined symbol
+  // Symbol scope is determined by sym.n_type & (N_EXT | N_PEXT):
+  // N_EXT: Global symbols
+  // N_EXT | N_PEXT: Linkage unit (think: dylib) scoped
+  // N_PEXT: Does not occur in input files in practice,
+  // a private extern must be external.
+  // 0: Translation-unit scoped. These are not in the symbol table.
+
+  if (sym.n_type & (N_EXT | N_PEXT)) {
+assert((sym.n_type & N_EXT) && "invalid input");
+return symtab->addDefined(name, isec, value, sym.n_desc & N_WEAK_DEF,
+  sym.n_type & N_PEXT);
+  }
   return make(name, isec, value, sym.n_desc & N_WEAK_DEF,
-   /*isExternal=*/false);
+   /*isExternal=*/false, /*isPrivateExtern=*/false);
 }
 
 // Absolute symbols are defined symbols that do not have an associated
 // InputSection. They cannot be weak.
 static macho::Symbol *createAbsolute(const structs::nlist_64 &sym,
   

[llvm-branch-commits] [llvm] 853770f - [gn build] (manually) port b8c37153d5393

2020-12-22 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-22T06:35:40-05:00
New Revision: 853770f24130cabc763995bd72419a29670ee3ca

URL: 
https://github.com/llvm/llvm-project/commit/853770f24130cabc763995bd72419a29670ee3ca
DIFF: 
https://github.com/llvm/llvm-project/commit/853770f24130cabc763995bd72419a29670ee3ca.diff

LOG: [gn build] (manually) port b8c37153d5393

Added: 


Modified: 
llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn 
b/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn
index 908dce6a12e5..c07a61fe61e4 100644
--- a/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang-tools-extra/clangd/BUILD.gn
@@ -11,13 +11,15 @@ config("features_config") {
 write_cmake_config("features") {
   input = "Features.inc.in"
   output = "$target_gen_dir/Features.inc"
-  values = []
+  values = [
+"CLANGD_ENABLE_REMOTE=0",
+"CLANGD_MALLOC_TRIM=1",
+  ]
   if (clangd_build_xpc) {
 values += [ "CLANGD_BUILD_XPC=1" ]
   } else {
 values += [ "CLANGD_BUILD_XPC=0" ]
   }
-  values += [ "CLANGD_ENABLE_REMOTE=0" ]
   public_configs = [ ":features_config" ]
 }
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 00065d5 - Revert "-fstack-clash-protection: Return an actual error when used on unsupported OS"

2020-12-22 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-22T06:51:19-05:00
New Revision: 00065d5cbd02b0f3fccb34881b58bcd0852b3970

URL: 
https://github.com/llvm/llvm-project/commit/00065d5cbd02b0f3fccb34881b58bcd0852b3970
DIFF: 
https://github.com/llvm/llvm-project/commit/00065d5cbd02b0f3fccb34881b58bcd0852b3970.diff

LOG: Revert "-fstack-clash-protection: Return an actual error when used on 
unsupported OS"

This reverts commit 4d59c8fdb955ea0d668b854f467e12bce05a8857.
Breaks tens of thousands of tests, and had pending review comments, see
comments on https://reviews.llvm.org/D92245 (and e.g.
http://lab.llvm.org:8011/#/builders/109/builds/5236 for failures).

Added: 


Modified: 
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/lib/Driver/ToolChains/Clang.cpp
llvm/test/CodeGen/X86/stack-clash-large.ll

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td 
b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 736950b0abb1..e92a4bf1dac5 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -273,8 +273,6 @@ def err_drv_unsupported_embed_bitcode
 : Error<"%0 is not supported with -fembed-bitcode">;
 def err_drv_bitcode_unsupported_on_toolchain : Error<
   "-fembed-bitcode is not supported on versions of iOS prior to 6.0">;
-def err_drv_stack_clash_protection_unsupported_on_toolchain : Error<
-  "-fstack-clash-protection is not supported on %0">;
 
 def err_drv_invalid_malign_branch_EQ : Error<
   "invalid argument '%0' to -malign-branch=; each element must be one of: %1">;

diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index c04b350dae7d..300ab6e815e2 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3067,15 +3067,12 @@ static void RenderSSPOptions(const Driver &D, const 
ToolChain &TC,
   }
 }
 
-static void RenderSCPOptions(const Driver &D, const ToolChain &TC,
- const ArgList &Args, ArgStringList &CmdArgs) {
+static void RenderSCPOptions(const ToolChain &TC, const ArgList &Args,
+ ArgStringList &CmdArgs) {
   const llvm::Triple &EffectiveTriple = TC.getEffectiveTriple();
 
-  if (EffectiveTriple.isOSWindows()) {
-D.Diag(diag::err_drv_stack_clash_protection_unsupported_on_toolchain)
-<< EffectiveTriple.getOSName();
+  if (!EffectiveTriple.isOSLinux())
 return;
-  }
 
   if (!EffectiveTriple.isX86() && !EffectiveTriple.isSystemZ() &&
   !EffectiveTriple.isPPC64())
@@ -5553,7 +5550,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
 CmdArgs.push_back(Args.MakeArgString("-mspeculative-load-hardening"));
 
   RenderSSPOptions(D, TC, Args, CmdArgs, KernelOrKext);
-  RenderSCPOptions(D, TC, Args, CmdArgs);
+  RenderSCPOptions(TC, Args, CmdArgs);
   RenderTrivialAutoVarInitOptions(D, TC, Args, CmdArgs);
 
   // Translate -mstackrealign

diff  --git a/llvm/test/CodeGen/X86/stack-clash-large.ll 
b/llvm/test/CodeGen/X86/stack-clash-large.ll
index 7deae310f617..dd53cd8f6964 100644
--- a/llvm/test/CodeGen/X86/stack-clash-large.ll
+++ b/llvm/test/CodeGen/X86/stack-clash-large.ll
@@ -1,7 +1,5 @@
 ; RUN: llc -mtriple=x86_64-linux-android < %s | FileCheck 
-check-prefix=CHECK-X86-64 %s 
 ; RUN: llc -mtriple=i686-linux-android < %s | FileCheck 
-check-prefix=CHECK-X86-32 %s 
-; RUN: llc -mtriple=x86_64-unknown-freebsd < %s | FileCheck 
-check-prefix=CHECK-X86-64 %s
-; RUN: llc -mtriple=x86_64-pc-linux-gnu < %s | FileCheck 
-check-prefix=CHECK-X86-64 %s
 
 define i32 @foo() local_unnamed_addr #0 {
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 57ffbe0 - glld/mac] Don't add names of unreferenced symbols to string table

2020-12-22 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-22T15:52:33-05:00
New Revision: 57ffbe020af6469b7c2fdb599f2f7e5e5d0322f0

URL: 
https://github.com/llvm/llvm-project/commit/57ffbe020af6469b7c2fdb599f2f7e5e5d0322f0
DIFF: 
https://github.com/llvm/llvm-project/commit/57ffbe020af6469b7c2fdb599f2f7e5e5d0322f0.diff

LOG: glld/mac] Don't add names of unreferenced symbols to string table

Before this, a hello world program would contain many many unnecessary
entries in its string table.

No behavior change, just makes the string table in the output smaller
and more like ld64's.

Differential Revision: https://reviews.llvm.org/D93711

Added: 


Modified: 
lld/MachO/SyntheticSections.cpp
lld/test/MachO/symtab.s

Removed: 




diff  --git a/lld/MachO/SyntheticSections.cpp b/lld/MachO/SyntheticSections.cpp
index 8b2ebd36e1ae..2ed1f2eb34fb 100644
--- a/lld/MachO/SyntheticSections.cpp
+++ b/lld/MachO/SyntheticSections.cpp
@@ -694,6 +694,11 @@ void SymtabSection::emitStabs() {
 }
 
 void SymtabSection::finalizeContents() {
+  auto addSymbol = [&](std::vector &symbols, Symbol *sym) {
+uint32_t strx = stringTableSection.addString(sym->getName());
+symbols.push_back({sym, strx});
+  };
+
   // Local symbols aren't in the SymbolTable, so we walk the list of object
   // files to gather them.
   for (InputFile *file : inputFiles) {
@@ -702,10 +707,8 @@ void SymtabSection::finalizeContents() {
 // TODO: when we implement -dead_strip, we should filter out symbols
 // that belong to dead sections.
 if (auto *defined = dyn_cast(sym)) {
-  if (!defined->isExternal()) {
-uint32_t strx = stringTableSection.addString(sym->getName());
-localSymbols.push_back({sym, strx});
-  }
+  if (!defined->isExternal())
+addSymbol(localSymbols, sym);
 }
   }
 }
@@ -713,19 +716,16 @@ void SymtabSection::finalizeContents() {
 
   // __dyld_private is a local symbol too. It's linker-created and doesn't
   // exist in any object file.
-  if (Defined* dyldPrivate = in.stubHelper->dyldPrivate) {
-uint32_t strx = stringTableSection.addString(dyldPrivate->getName());
-localSymbols.push_back({dyldPrivate, strx});
-  }
+  if (Defined* dyldPrivate = in.stubHelper->dyldPrivate)
+addSymbol(localSymbols, dyldPrivate);
 
   for (Symbol *sym : symtab->getSymbols()) {
-uint32_t strx = stringTableSection.addString(sym->getName());
 if (auto *defined = dyn_cast(sym)) {
   assert(defined->isExternal());
-  externalSymbols.push_back({sym, strx});
+  addSymbol(externalSymbols, sym);
 } else if (auto *dysym = dyn_cast(sym)) {
   if (dysym->isReferenced())
-undefinedSymbols.push_back({sym, strx});
+addSymbol(undefinedSymbols, sym);
 }
   }
 

diff  --git a/lld/test/MachO/symtab.s b/lld/test/MachO/symtab.s
index d18986c9d91c..fa784a34e16a 100644
--- a/lld/test/MachO/symtab.s
+++ b/lld/test/MachO/symtab.s
@@ -86,17 +86,19 @@
 # CHECK-NEXT:   iundefsym: 5
 # CHECK-NEXT:   nundefsym: 2
 
-## Verify that the first entry in the StringTable is a space.
+## Verify that the first entry in the StringTable is a space, and that
+## unreferenced symbols aren't emitted.
 # RUN: obj2yaml %t/test | FileCheck %s --check-prefix=YAML
 # YAML:  StringTable:
 # YAML-NEXT: ' '
+# YAML-NOT: _unreferenced
 
 #--- libfoo.s
 .globl _dynamic
 _dynamic:
 
 #--- test.s
-.globl _main, _external, _external_weak
+.globl _main, _external, _external_weak, _unreferenced
 
 .data
 _external:



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 77fb45e - [lld/mac] Add --version flag

2020-12-22 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-22T22:06:39-05:00
New Revision: 77fb45e59e49d25fbc57854b62599ae24aa2c4c9

URL: 
https://github.com/llvm/llvm-project/commit/77fb45e59e49d25fbc57854b62599ae24aa2c4c9
DIFF: 
https://github.com/llvm/llvm-project/commit/77fb45e59e49d25fbc57854b62599ae24aa2c4c9.diff

LOG: [lld/mac] Add --version flag

It's an extension to ld64, but all the other ports have it, and
someone asked for it in PR43721.

While here, change the COFF help text to match the other ports.

Differential Revision: https://reviews.llvm.org/D93491

Added: 


Modified: 
lld/COFF/Options.td
lld/MachO/Driver.cpp
lld/MachO/Options.td
lld/test/MachO/driver.test

Removed: 




diff  --git a/lld/COFF/Options.td b/lld/COFF/Options.td
index 2b8e65587ad7..5447c8312128 100644
--- a/lld/COFF/Options.td
+++ b/lld/COFF/Options.td
@@ -240,7 +240,7 @@ def lto_obj_path : P<
 "lto-obj-path",
 "output native object for merged LTO unit to this path">;
 def dash_dash_version : Flag<["--"], "version">,
-  HelpText<"Print version information">;
+  HelpText<"Display the version number and exit">;
 def threads
 : P<"threads", "Number of threads. '1' disables multi-threading. By "
"default all available hardware threads are used">;

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 82ddcf084dc0..edc9fe001ab5 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -690,10 +690,15 @@ bool macho::link(llvm::ArrayRef argsArr, 
bool canExitEarly,
   if (args.hasArg(OPT_help_hidden)) {
 parser.printHelp(argsArr[0], /*showHidden=*/true);
 return true;
-  } else if (args.hasArg(OPT_help)) {
+  }
+  if (args.hasArg(OPT_help)) {
 parser.printHelp(argsArr[0], /*showHidden=*/false);
 return true;
   }
+  if (args.hasArg(OPT_version)) {
+message(getLLDVersion());
+return true;
+  }
 
   if (const char *path = getReproduceOption(args)) {
 // Note that --reproduce is a debug option so you can ignore it

diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 52a351836a15..8e88c74efc0e 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -18,6 +18,8 @@ def reproduce: Separate<["--"], "reproduce">;
 def reproduce_eq: Joined<["--"], "reproduce=">,
 Alias(reproduce)>,
 HelpText<"Write tar file containing inputs and command to reproduce link">;
+def version: Flag<["--"], "version">,
+HelpText<"Display the version number and exit">;
 
 
 // This is a complete Options.td compiled from Apple's ld(1) manpage
@@ -508,7 +510,7 @@ def bitcode_symbol_map : Separate<["-"], 
"bitcode_symbol_map">,
 def grp_rare : OptionGroup<"rare">, HelpText<"RARELY USED">;
 
 def v : Flag<["-"], "v">,
- HelpText<"Print the linker version">,
+ HelpText<"Print the linker version and search paths and exit">,
  Group;
 def version_details : Flag<["-"], "version_details">,
  HelpText<"Print the linker version in JSON form">,

diff  --git a/lld/test/MachO/driver.test b/lld/test/MachO/driver.test
index 229ec3ef6963..417c71eac561 100644
--- a/lld/test/MachO/driver.test
+++ b/lld/test/MachO/driver.test
@@ -1,5 +1,7 @@
-# RUN: not %lld ---help 2>&1 | FileCheck -check-prefix=SPELLHELP %s
+# RUN: %lld --version | FileCheck -check-prefix=VERSION %s
+VERSION: {{LLD [0-9]+\.[0-9]+}}
 
+# RUN: not %lld ---help 2>&1 | FileCheck -check-prefix=SPELLHELP %s
 SPELLHELP: error: unknown argument '---help', did you mean '--help'
 # FIXME: This should say "no input files" instead
 SPELLHELP: error: undefined symbol: _main



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 1876a29 - Revert more changes that landed on top of 741978d727

2020-12-23 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-23T14:20:21-05:00
New Revision: 1876a2914fe0bedf50f7be6a305f5bf35493e496

URL: 
https://github.com/llvm/llvm-project/commit/1876a2914fe0bedf50f7be6a305f5bf35493e496
DIFF: 
https://github.com/llvm/llvm-project/commit/1876a2914fe0bedf50f7be6a305f5bf35493e496.diff

LOG: Revert more changes that landed on top of 741978d727

This should've been in 7ad666798f12456d9 but wasn't.

Squashes these twoc commits:
Revert "[clang][cli] Let denormalizer decide how to render the option based on 
the option class"
This reverts commit 70410a264949101ced3ce3458f37dd4cc2f5af85.

Revert "[clang][cli] Implement `getAllArgValues` marshalling"
This reverts commit 63a24816f561a5d8e28ca7054892bd8602618be4.

Added: 


Modified: 
clang/include/clang/Driver/Options.td
clang/lib/Frontend/CompilerInvocation.cpp
clang/unittests/Frontend/CompilerInvocationTest.cpp
llvm/include/llvm/Option/OptParser.td

Removed: 




diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 7f63a5577262..af209eb9089d 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1839,8 +1839,7 @@ def fsystem_module : Flag<["-"], "fsystem-module">, 
Flags<[CC1Option]>,
   MarshallingInfoFlag<"FrontendOpts.IsSystemModule">;
 def fmodule_map_file : Joined<["-"], "fmodule-map-file=">,
   Group, Flags<[NoXarchOption,CC1Option]>, MetaVarName<"">,
-  HelpText<"Load this module map file">,
-  MarshallingInfoStringVector<"FrontendOpts.ModuleMapFiles">;
+  HelpText<"Load this module map file">;
 def fmodule_file : Joined<["-"], "fmodule-file=">,
   Group, Flags<[NoXarchOption,CC1Option]>, 
MetaVarName<"[=]">,
   HelpText<"Specify the mapping of module name to precompiled module file, or 
load a module file if name is omitted.">;
@@ -4625,7 +4624,7 @@ def arcmt_action_EQ : Joined<["-"], "arcmt-action=">, 
Flags<[CC1Option, NoDriver
   NormalizedValuesScope<"FrontendOptions">,
   NormalizedValues<["ARCMT_Check", "ARCMT_Modify", "ARCMT_Migrate"]>,
   MarshallingInfoString<"FrontendOpts.ARCMTAction", "ARCMT_None">,
-  AutoNormalizeEnum;
+  AutoNormalizeEnumJoined;
 
 def opt_record_file : Separate<["-"], "opt-record-file">,
   HelpText<"File name to use for YAML optimization record output">;

diff  --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index a7a5a73eebdd..06d8d2e27c9b 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -152,8 +152,8 @@ static Optional 
normalizeSimpleNegativeFlag(OptSpecifier Opt, unsigned,
 /// argument.
 static void denormalizeSimpleFlag(SmallVectorImpl &Args,
   const char *Spelling,
-  CompilerInvocation::StringAllocator,
-  Option::OptionClass, unsigned, /*T*/...) {
+  CompilerInvocation::StringAllocator, 
unsigned,
+  /*T*/...) {
   Args.push_back(Spelling);
 }
 
@@ -193,41 +193,12 @@ static auto makeBooleanOptionNormalizer(bool Value, bool 
OtherValue,
 
 static auto makeBooleanOptionDenormalizer(bool Value) {
   return [Value](SmallVectorImpl &Args, const char *Spelling,
- CompilerInvocation::StringAllocator, Option::OptionClass,
- unsigned, bool KeyPath) {
+ CompilerInvocation::StringAllocator, unsigned, bool KeyPath) {
 if (KeyPath == Value)
   Args.push_back(Spelling);
   };
 }
 
-static void denormalizeStringImpl(SmallVectorImpl &Args,
-  const char *Spelling,
-  CompilerInvocation::StringAllocator SA,
-  Option::OptionClass OptClass, unsigned,
-  Twine Value) {
-  switch (OptClass) {
-  case Option::SeparateClass:
-  case Option::JoinedOrSeparateClass:
-Args.push_back(Spelling);
-Args.push_back(SA(Value));
-break;
-  case Option::JoinedClass:
-Args.push_back(SA(Twine(Spelling) + Value));
-break;
-  default:
-llvm_unreachable("Cannot denormalize an option with option class "
- "incompatible with string denormalization.");
-  }
-}
-
-template 
-static void
-denormalizeString(SmallVectorImpl &Args, const char *Spelling,
-  CompilerInvocation::StringAllocator SA,
-  Option::OptionClass OptClass, unsigned TableIndex, T Value) {
-  denormalizeStringImpl(Args, Spelling, SA, OptClass, TableIndex, 
Twine(Value));
-}
-
 static Optional
 findValueTableByName(const SimpleEnumValueTable &Table, StringRef Name) {
   for (int I = 0, E = Table.Size; I != E; ++I)
@@ -269,13 +240,12 @@ static llvm::Optional 
normalizeSimpleEnum(OptSpecifier Opt,
 static void denormalizeSimpleEnumImpl(SmallVectorImpl &Args,

[llvm-branch-commits] [clang] 4c37453 - clang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF too

2020-12-23 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-23T14:27:09-05:00
New Revision: 4c37453a04f942dd676af1eda5d0760d4ffe8927

URL: 
https://github.com/llvm/llvm-project/commit/4c37453a04f942dd676af1eda5d0760d4ffe8927
DIFF: 
https://github.com/llvm/llvm-project/commit/4c37453a04f942dd676af1eda5d0760d4ffe8927.diff

LOG: clang: Build and run FrontendTests with CLANG_ENABLE_STATIC_ANALYZER=OFF 
too

They seem to pass fine with the analyzer off, and with this I would've
noticed my last check-clang break locally.

Added: 


Modified: 
clang/unittests/CMakeLists.txt
llvm/utils/gn/secondary/clang/unittests/BUILD.gn

Removed: 




diff  --git a/clang/unittests/CMakeLists.txt b/clang/unittests/CMakeLists.txt
index 4c222e24599f..bb635dfff991 100644
--- a/clang/unittests/CMakeLists.txt
+++ b/clang/unittests/CMakeLists.txt
@@ -24,13 +24,13 @@ add_subdirectory(Driver)
 if(CLANG_ENABLE_STATIC_ANALYZER)
   add_subdirectory(Analysis)
   add_subdirectory(StaticAnalyzer)
-  add_subdirectory(Frontend)
 endif()
 add_subdirectory(ASTMatchers)
 add_subdirectory(AST)
 add_subdirectory(CrossTU)
 add_subdirectory(Tooling)
 add_subdirectory(Format)
+add_subdirectory(Frontend)
 add_subdirectory(Rewrite)
 add_subdirectory(Sema)
 add_subdirectory(CodeGen)

diff  --git a/llvm/utils/gn/secondary/clang/unittests/BUILD.gn 
b/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
index d1382919b5e2..23f5d2dfac85 100644
--- a/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/unittests/BUILD.gn
@@ -10,6 +10,7 @@ group("unittests") {
 "CrossTU:CrossTUTests",
 "Driver:ClangDriverTests",
 "Format:FormatTests",
+"Frontend:FrontendTests",
 "Index:IndexTests",
 "Lex:LexTests",
 "Rename:ClangRenameTests",
@@ -22,7 +23,6 @@ group("unittests") {
   if (clang_enable_static_analyzer) {
 deps += [
   "Analysis:ClangAnalysisTests",
-  "Frontend:FrontendTests",
   "StaticAnalyzer:StaticAnalysisTests",
 ]
   }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 6a9d05a - [gn build] sort of merge 37ac559fccd4

2020-11-22 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-22T16:07:35-05:00
New Revision: 6a9d05a0a2e9c52799df60409a86fdb1b7ee6b9c

URL: 
https://github.com/llvm/llvm-project/commit/6a9d05a0a2e9c52799df60409a86fdb1b7ee6b9c
DIFF: 
https://github.com/llvm/llvm-project/commit/6a9d05a0a2e9c52799df60409a86fdb1b7ee6b9c.diff

LOG: [gn build] sort of merge 37ac559fccd4

It'd be nicer if there was a group target that forwarded either to
//clang-tools-extra/clangd/index/remote or
//clangd/index/remote/unimplemented based on if remote index is enabled,
but for now it's never enabled in the gn build.

Added: 


Modified: 
llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn 
b/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn
index 870f1072956e..856e46eaf6eb 100644
--- a/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang-tools-extra/clangd/tool/BUILD.gn
@@ -6,6 +6,7 @@ executable("clangd") {
 "//clang-tools-extra/clang-tidy",
 "//clang-tools-extra/clangd",
 "//clang-tools-extra/clangd:features",
+"//clang-tools-extra/clangd/index/remote/unimplemented",
 "//clang-tools-extra/clangd/refactor/tweaks",
 "//clang/lib/AST",
 "//clang/lib/Basic",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 191117c - [gn build] (manually) port ed424b428

2020-11-22 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-22T16:19:59-05:00
New Revision: 191117cec5cdffb46fc3b889bd0627b77b798864

URL: 
https://github.com/llvm/llvm-project/commit/191117cec5cdffb46fc3b889bd0627b77b798864
DIFF: 
https://github.com/llvm/llvm-project/commit/191117cec5cdffb46fc3b889bd0627b77b798864.diff

LOG: [gn build] (manually) port ed424b428

Added: 


Modified: 
llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/BUILD.gn

llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/unimplemented/BUILD.gn

Removed: 




diff  --git 
a/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/BUILD.gn 
b/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/BUILD.gn
index 6bb246d894ee..522bec5f5bfe 100644
--- a/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/BUILD.gn
@@ -1,7 +1,6 @@
 source_set("remote") {
   configs += [ "//llvm/utils/gn/build:clang_code" ]
   deps = [
-"//clang-tools-extra/clangd",
 "//clang-tools-extra/clangd/support",
 "//llvm/lib/Support",
   ]

diff  --git 
a/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/unimplemented/BUILD.gn
 
b/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/unimplemented/BUILD.gn
index 708e0f54a086..b4efca109fdc 100644
--- 
a/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/unimplemented/BUILD.gn
+++ 
b/llvm/utils/gn/secondary/clang-tools-extra/clangd/index/remote/unimplemented/BUILD.gn
@@ -1,7 +1,6 @@
 source_set("unimplemented") {
   configs += [ "//llvm/utils/gn/build:clang_code" ]
   deps = [
-"//clang-tools-extra/clangd",
 "//clang-tools-extra/clangd/support",
 "//llvm/lib/Support",
   ]



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] e0e334a - [mac/arm] make clang/test/Driver/clang_f_opts.c pass consistently

2020-11-23 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-23T12:56:52-05:00
New Revision: e0e334a9c1ace7dd9339ca6cb5866ff7b7885e11

URL: 
https://github.com/llvm/llvm-project/commit/e0e334a9c1ace7dd9339ca6cb5866ff7b7885e11
DIFF: 
https://github.com/llvm/llvm-project/commit/e0e334a9c1ace7dd9339ca6cb5866ff7b7885e11.diff

LOG: [mac/arm] make clang/test/Driver/clang_f_opts.c pass consistently

Part of PR46644, see comment 7/8.

Added: 


Modified: 
clang/test/Driver/clang_f_opts.c

Removed: 




diff  --git a/clang/test/Driver/clang_f_opts.c 
b/clang/test/Driver/clang_f_opts.c
index 27380413b7fe..123ad7e2aa99 100644
--- a/clang/test/Driver/clang_f_opts.c
+++ b/clang/test/Driver/clang_f_opts.c
@@ -541,6 +541,12 @@
 // CHECK-NO-RECORD-GCC-SWITCHES-NOT: "-record-command-line"
 // CHECK-RECORD-GCC-SWITCHES-ERROR: error: unsupported option 
'-frecord-command-line' for target
 // Test when clang is in a path containing a space.
+// The initial `rm` is a workaround for https://openradar.appspot.com/FB8914243
+// (Scenario: Run tests once, `clang` gets copied and run at new location and 
signature
+// is cached at the new clang's inode, then clang is changed, tests run again, 
old signature
+// is still cached with old clang's inode, so it won't execute this time. 
Removing the dir
+// first guarantees a new inode without old cache entries.)
+// RUN: rm -rf "%t.r/with spaces"
 // RUN: mkdir -p "%t.r/with spaces"
 // RUN: cp %clang "%t.r/with spaces/clang"
 // RUN: "%t.r/with spaces/clang" -### -S -target x86_64-unknown-linux 
-frecord-gcc-switches %s 2>&1 | FileCheck 
-check-prefix=CHECK-RECORD-GCC-SWITCHES-ESCAPED %s



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 47eb5ce - [mac/arm] fix clang/test/Driver/darwin-ld-dedup.c

2020-11-23 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-23T13:32:29-05:00
New Revision: 47eb5ce19ab10bcfe00af04e6a6e39613e2cb3c9

URL: 
https://github.com/llvm/llvm-project/commit/47eb5ce19ab10bcfe00af04e6a6e39613e2cb3c9
DIFF: 
https://github.com/llvm/llvm-project/commit/47eb5ce19ab10bcfe00af04e6a6e39613e2cb3c9.diff

LOG: [mac/arm] fix clang/test/Driver/darwin-ld-dedup.c

The test needs an object file, which it currenty gets with
`-target x86_64-apple-darwin10`.  Rather than adding `REQUIRES: X86`, create
the object file via yaml2obj. This way, the test runs and passes even if the
host arch isn't x86 and only the host arch is built.

Part of PR46644.

Added: 
clang/test/Driver/Inputs/empty-x86_64-apple-darwin.yaml

Modified: 
clang/test/CMakeLists.txt
clang/test/Driver/darwin-ld-dedup.c
clang/test/lit.cfg.py
llvm/utils/gn/secondary/clang/test/BUILD.gn

Removed: 




diff  --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 1eb434e192db..4e9a1840fec3 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -124,6 +124,7 @@ if( NOT CLANG_BUILT_STANDALONE )
 llvm-readobj
 llvm-symbolizer
 opt
+yaml2obj
 )
 
   if(TARGET llvm-lto)

diff  --git a/clang/test/Driver/Inputs/empty-x86_64-apple-darwin.yaml 
b/clang/test/Driver/Inputs/empty-x86_64-apple-darwin.yaml
new file mode 100644
index ..c4561050b8b6
--- /dev/null
+++ b/clang/test/Driver/Inputs/empty-x86_64-apple-darwin.yaml
@@ -0,0 +1,44 @@
+# Created by `clang -target x86_64-apple-darwin10 -c -x c /dev/null -o - | 
obj2yaml`.
+--- !mach-o
+FileHeader:
+  magic:   0xFEEDFACF
+  cputype: 0x107
+  cpusubtype:  0x3
+  filetype:0x1
+  ncmds:   2
+  sizeofcmds:  176
+  flags:   0x2000
+  reserved:0x0
+LoadCommands:
+  - cmd: LC_SEGMENT_64
+cmdsize: 152
+segname: ''
+vmaddr:  0
+vmsize:  0
+fileoff: 208
+filesize:0
+maxprot: 7
+initprot:7
+nsects:  1
+flags:   0
+Sections:
+  - sectname:__text
+segname: __TEXT
+addr:0x0
+size:0
+offset:  0xD0
+align:   0
+reloff:  0x0
+nreloc:  0
+flags:   0x8000
+reserved1:   0x0
+reserved2:   0x0
+reserved3:   0x0
+content: ''
+  - cmd: LC_BUILD_VERSION
+cmdsize: 24
+platform:1
+minos:   720896
+sdk: 720896
+ntools:  0
+...

diff  --git a/clang/test/Driver/darwin-ld-dedup.c 
b/clang/test/Driver/darwin-ld-dedup.c
index a06ca7bebe57..1d866f40291a 100644
--- a/clang/test/Driver/darwin-ld-dedup.c
+++ b/clang/test/Driver/darwin-ld-dedup.c
@@ -29,7 +29,7 @@
 // Do *not* add -no_deduplicate when no -O option is specified and this is 
just a link
 // (since we can't imply -O0)
 // RUN: rm -f %t.o %t.bin
-// RUN: %clang -target x86_64-apple-darwin10 -c -o %t.o %s
+// RUN: yaml2obj %S/Inputs/empty-x86_64-apple-darwin.yaml -o %t.o
 // RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \
 // RUN:   -o %t.bin 2>&1 | FileCheck -check-prefix=LINK_DEDUP %s
 // RUN: %clang -target x86_64-apple-darwin10 %t.o -### -mlinker-version=262 \

diff  --git a/clang/test/lit.cfg.py b/clang/test/lit.cfg.py
index 1a6e73ed9783..863ab444fb02 100644
--- a/clang/test/lit.cfg.py
+++ b/clang/test/lit.cfg.py
@@ -64,7 +64,7 @@
 
 tools = [
 'apinotes-test', 'c-index-test', 'clang-
diff ', 'clang-format',
-'clang-tblgen', 'opt', 'llvm-ifs',
+'clang-tblgen', 'opt', 'llvm-ifs', 'yaml2obj',
 ToolSubst('%clang_extdef_map', command=FindTool(
 'clang-extdef-mapping'), unresolved='ignore'),
 ]

diff  --git a/llvm/utils/gn/secondary/clang/test/BUILD.gn 
b/llvm/utils/gn/secondary/clang/test/BUILD.gn
index 9219d2d7bfad..8f436ac10586 100644
--- a/llvm/utils/gn/secondary/clang/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/test/BUILD.gn
@@ -168,6 +168,7 @@ group("test") {
 "//llvm/utils/count",
 "//llvm/utils/llvm-lit",
 "//llvm/utils/not",
+"//llvm/tools/yaml2obj",
   ]
   if (clang_enable_arcmt) {
 deps += [



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 9194aa8 - [gn build] modify hotfix in 17df195f705cef76a9 to work with all enabled targets

2020-11-24 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-23T21:28:54-05:00
New Revision: 9194aa88676fbf6d215efbe461abe9ac18bc0ffc

URL: 
https://github.com/llvm/llvm-project/commit/9194aa88676fbf6d215efbe461abe9ac18bc0ffc
DIFF: 
https://github.com/llvm/llvm-project/commit/9194aa88676fbf6d215efbe461abe9ac18bc0ffc.diff

LOG: [gn build] modify hotfix in 17df195f705cef76a9 to work with all enabled 
targets

llvm-config output with the gn build is just good enough to make
tests pass, but llvm-config wants all .a files it knows about to
actually exist. So let it know about fewer .a files that don't
exist if not all targets are enabled.

Added: 


Modified: 
llvm/utils/gn/build/write_library_dependencies.py

Removed: 




diff  --git a/llvm/utils/gn/build/write_library_dependencies.py 
b/llvm/utils/gn/build/write_library_dependencies.py
index 6d5349942881..4ab6c6eb1b7c 100644
--- a/llvm/utils/gn/build/write_library_dependencies.py
+++ b/llvm/utils/gn/build/write_library_dependencies.py
@@ -22,8 +22,8 @@
 const char *RequiredLibraries[84];
   } AvailableComponents[84] = {
   { "aggressiveinstcombine", "LLVMAggressiveInstCombine", true, {"analysis", 
"core", "support", "transformutils"} },
-{ "all", nullptr, true, {"demangle", "support", "tablegen", "core", 
"fuzzmutate", "filecheck", "interfacestub", "irreader", "codegen", 
"selectiondag", "asmprinter", "mirparser", "globalisel", "binaryformat", 
"bitreader", "bitwriter", "bitstreamreader", "dwarflinker", "extensions", 
"frontendopenmp", "transformutils", "instrumentation", "aggressiveinstcombine", 
"instcombine", "scalaropts", "ipo", "vectorize", "hellonew", "objcarcopts", 
"coroutines", "cfguard", "linker", "analysis", "lto", "mc", "mcparser", 
"mcdisassembler", "mca", "object", "objectyaml", "option", "remarks", 
"debuginfodwarf", "debuginfogsym", "debuginfomsf", "debuginfocodeview", 
"debuginfopdb", "symbolize", "executionengine", "interpreter", "jitlink", 
"mcjit", "orcjit", "orcshared", "orctargetprocess", "runtimedyld", "target", 
"x86codegen", "x86asmparser", "x86disassembler", "x86desc", "x86info", 
"webassemblycodegen", "webassemblyasmparser", "webassemblydisassembler", 
"webassemblydesc", "webassemblyinfo", "asmparser", "lineeditor", "profiledata", 
"coverage", "passes", "textapi", "dlltooldriver", "libdriver", "xray", 
"windowsmanifest"} },
-{ "all-targets", nullptr, true, {"x86", "webassembly"} },
+{ "all", nullptr, true, {"demangle", "support", "tablegen", "core", 
"fuzzmutate", "filecheck", "interfacestub", "irreader", "codegen", 
"selectiondag", "asmprinter", "mirparser", "globalisel", "binaryformat", 
"bitreader", "bitwriter", "bitstreamreader", "dwarflinker", "extensions", 
"frontendopenmp", "transformutils", "instrumentation", "aggressiveinstcombine", 
"instcombine", "scalaropts", "ipo", "vectorize", "hellonew", "objcarcopts", 
"coroutines", "cfguard", "linker", "analysis", "lto", "mc", "mcparser", 
"mcdisassembler", "mca", "object", "objectyaml", "option", "remarks", 
"debuginfodwarf", "debuginfogsym", "debuginfomsf", "debuginfocodeview", 
"debuginfopdb", "symbolize", "executionengine", "interpreter", "jitlink", 
"mcjit", "orcjit", "orcshared", "orctargetprocess", "runtimedyld", "target", 
"asmparser", "lineeditor", "profiledata", "coverage", "passes", "textapi", 
"dlltooldriver", "libdriver", "xray", "windowsmanifest"} },
+{ "all-targets", nullptr, true, {} },
 { "analysis", "LLVMAnalysis", true, {"binaryformat", "core", "object", 
"profiledata", "support"} },
 { "asmparser", "LLVMAsmParser", true, {"binaryformat", "core", "support"} },
 { "asmprinter", "LLVMAsmPrinter", true, {"analysis", "binaryformat", 
"codegen", "core", "debuginfocodeview", "debuginfodwarf", "debuginfomsf", "mc", 
"mcparser", "remarks", "support", "target"} },
@@ -69,8 +69,8 @@
 { "mcjit", "LLVMMCJIT", true, {"core", "executionengine", "object", 
"runtimedyld", "support", "target"} },
 { "mcparser", "LLVMMCParser", true, {"mc", "support"} },
 { "mirparser", "LLVMMIRParser", true, {"asmparser", "binaryformat", "codegen", 
"core", "mc", "support", "target"} },
-{ "native", nullptr, true, {"x86"} },
-{ "nativecodegen", nullptr, true, {"x86codegen"} },
+{ "native", nullptr, true, {} },
+{ "nativecodegen", nullptr, true, {} },
 { "objcarcopts", "LLVMObjCARCOpts", true, {"analysis", "core", "support", 
"transformutils"} },
 { "object", "LLVMObject", true, {"bitreader", "core", "mc", "binaryformat", 
"mcparser", "support", "textapi"} },
 { "objectyaml", "LLVMObjectYAML", true, {"binaryformat", "object", "support", 
"debuginfocodeview", "mc"} },
@@ -91,19 +91,7 @@
 { "textapi", "LLVMTextAPI", true, {"support", "binaryformat"} },
 { "transformutils", "LLVMTransformUtils", true, {"analysis", "core", 
"support"} },
 { "vectorize", "LLVMVectorize", true, {"analysis", "core", "support", 
"transformutils"} },
-{ "webassembly", nullptr, true, {"webassemblycodegen", "webassemblyasmparser", 
"webassemblydisassembler"

[llvm-branch-commits] [clang] a9eaf84 - Try to fix tests after e16c0a9a68971 with CLANG_DEFAULT_LINKER=lld

2020-11-24 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-24T22:34:12-05:00
New Revision: a9eaf8435d9204f5d71a08cfd7c574e92d434871

URL: 
https://github.com/llvm/llvm-project/commit/a9eaf8435d9204f5d71a08cfd7c574e92d434871
DIFF: 
https://github.com/llvm/llvm-project/commit/a9eaf8435d9204f5d71a08cfd7c574e92d434871.diff

LOG: Try to fix tests after e16c0a9a68971 with CLANG_DEFAULT_LINKER=lld

Tests that pass -mlinker-version=old version and that then don't
expect new flags to be passed need to explicitly request the system
linker now.

Added: 


Modified: 
clang/test/Driver/darwin-ld-platform-version-ios.c
clang/test/Driver/darwin-ld-platform-version-macos.c
clang/test/Driver/darwin-ld-platform-version-tvos.c
clang/test/Driver/darwin-ld-platform-version-watchos.c
clang/test/Driver/darwin-ld.c

Removed: 




diff  --git a/clang/test/Driver/darwin-ld-platform-version-ios.c 
b/clang/test/Driver/darwin-ld-platform-version-ios.c
index 28e9dceb84413..d03e46b5776de 100644
--- a/clang/test/Driver/darwin-ld-platform-version-ios.c
+++ b/clang/test/Driver/darwin-ld-platform-version-ios.c
@@ -1,14 +1,14 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-ios12.3 \
+// RUN: %clang -target arm64-apple-ios12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
-// RUN: %clang -target arm64-apple-ios12.3 \
+// RUN: %clang -target arm64-apple-ios12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
-// RUN: %clang -target arm64-apple-ios12.3 \
+// RUN: %clang -target arm64-apple-ios12.3 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=520 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-NEW %s
@@ -16,7 +16,7 @@
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-NEW  %s
-// RUN: %clang -target x86_64-apple-ios13-simulator \
+// RUN: %clang -target x86_64-apple-ios13-simulator -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=520 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=SIMUL %s

diff  --git a/clang/test/Driver/darwin-ld-platform-version-macos.c 
b/clang/test/Driver/darwin-ld-platform-version-macos.c
index 97df44d3bb0fd..1954deea7b93d 100644
--- a/clang/test/Driver/darwin-ld-platform-version-macos.c
+++ b/clang/test/Driver/darwin-ld-platform-version-macos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target x86_64-apple-macos10.13 \
+// RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-NEW %s
-// RUN: %clang -target x86_64-apple-macos10.13 \
+// RUN: %clang -target x86_64-apple-macos10.13 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -17,7 +17,7 @@
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-NEW %s
 
-// RUN: %clang -target arm64-apple-macos10.13 \
+// RUN: %clang -target arm64-apple-macos10.13 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=ARM64_OLD %s
@@ -25,15 +25,15 @@
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=400 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
 // RUN:   | FileCheck --check-prefix=ARM64_NEW %s
-// RUN: %clang -target arm64-apple-macos10.13 \
+// RUN: %clang -target arm64-apple-macos10.13 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=520 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=ARM64_NEW %s
-// RUN: %clang -target arm64-apple-darwin19 \
+// RUN: %clang -target arm64-apple-darwin19 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=520 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=ARM64_NEW %s
-// RUN: %clang -target arm64-apple-macos11.1 \
+// RUN: %clang -target arm64-apple-macos11.1 -fuse-ld= \
 // RUN:   -isysroot %S/Inputs/MacOSX10.14.sdk -mlinker-version=520 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=ARM64_NEW_1 %s

diff  --git a/clang/test/Driver/darwin-ld-platform-version-tvos.c 
b/clang/test/Driver/darwin-ld-platform-version-tvos.c
index f11fde349fa7f..beaa46b32f6f2 100644
--- a/clang/test/Driver/darwin-ld-platform-version-tvos.c
+++ b/clang/test/Driver/d

[llvm-branch-commits] [llvm] 9595a7f - [gn build] Download prebuilt mac-arm64 binary now that it exists

2020-11-25 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-25T12:08:48-05:00
New Revision: 9595a7ff55b6f3bf316ae182390fc74da65dda51

URL: 
https://github.com/llvm/llvm-project/commit/9595a7ff55b6f3bf316ae182390fc74da65dda51
DIFF: 
https://github.com/llvm/llvm-project/commit/9595a7ff55b6f3bf316ae182390fc74da65dda51.diff

LOG: [gn build] Download prebuilt mac-arm64 binary now that it exists

Sadly requires an ugly workaround for an ugly bug, but still nicer than
building locally.

Added: 


Modified: 
llvm/utils/gn/get.py

Removed: 




diff  --git a/llvm/utils/gn/get.py b/llvm/utils/gn/get.py
index f778ab931bba..bb185c187783 100755
--- a/llvm/utils/gn/get.py
+++ b/llvm/utils/gn/get.py
@@ -47,21 +47,15 @@ def main():
 if not platform:
 print('no prebuilt binary for', sys.platform)
 return 1
-if platform == 'mac-arm64':
-print('no prebuilt mac-arm64 binaries yet. build it yourself with:')
-print('  rm -rf /tmp/gn &&')
-print('  pushd /tmp && git clone https://gn.googlesource.com/gn &&')
-print('  cd gn && build/gen.py && ninja -C out gn && popd &&')
-print('  mkdir -p llvm/utils/gn/bin/mac-arm64 &&')
-print('  cp /tmp/gn/out/gn llvm/utils/gn/bin/mac-arm64')
-return 1
-
 dirname = os.path.join(os.path.dirname(__file__), 'bin', platform)
 if not os.path.exists(dirname):
 os.makedirs(dirname)
 
 url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/%s/+/latest'
 gn = 'gn' + ('.exe' if sys.platform == 'win32' else '')
+if platform == 'mac-arm64': # For https://openradar.appspot.com/FB8914243
+try: os.remove(os.path.join(dirname, gn))
+except OSError: pass
 download_and_unpack(url % platform, dirname, gn)
 set_executable_bit(os.path.join(dirname, gn))
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] da0aaed - [gn build] (manually) port b534beabeed3ba

2020-11-25 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-25T20:19:46-05:00
New Revision: da0aaedcd0cd7053fa38d56aca26fd035a7fe75c

URL: 
https://github.com/llvm/llvm-project/commit/da0aaedcd0cd7053fa38d56aca26fd035a7fe75c
DIFF: 
https://github.com/llvm/llvm-project/commit/da0aaedcd0cd7053fa38d56aca26fd035a7fe75c.diff

LOG: [gn build] (manually) port b534beabeed3ba

Added: 


Modified: 
lld/COFF/InputFiles.h
llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn

Removed: 




diff  --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h
index f657d8f0a808..3fa6819157a9 100644
--- a/lld/COFF/InputFiles.h
+++ b/lld/COFF/InputFiles.h
@@ -358,7 +358,7 @@ class ImportFile : public InputFile {
   const coff_import_header *hdr;
   Chunk *location = nullptr;
 
-  // We want to eliminate dllimported symbols if no one actually refers them.
+  // We want to eliminate dllimported symbols if no one actually refers to 
them.
   // These "Live" bits are used to keep track of which import library members
   // are actually in use.
   //

diff  --git a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn 
b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
index e7b532f57dab..0292479ecd66 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
@@ -197,7 +197,6 @@ static_library("builtins") {
 sources += [
   "comparetf2.c",
   "extenddftf2.c",
-  "extendhftf2.c",
   "extendsftf2.c",
   "fixtfdi.c",
   "fixtfsi.c",
@@ -213,7 +212,6 @@ static_library("builtins") {
   "floatuntitf.c",
   "multc3.c",
   "trunctfdf2.c",
-  "trunctfhf2.c",
   "trunctfsf2.c",
 ]
   }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 48d1017 - [gn build] sync script: handle multiple source lists if only deleting

2020-11-25 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-25T20:57:55-05:00
New Revision: 48d10172453511b549dfb3b46c717c60dc9786f1

URL: 
https://github.com/llvm/llvm-project/commit/48d10172453511b549dfb3b46c717c60dc9786f1
DIFF: 
https://github.com/llvm/llvm-project/commit/48d10172453511b549dfb3b46c717c60dc9786f1.diff

LOG: [gn build] sync script: handle multiple source lists if only deleting

With this, changes like b534beabeed3ba can be merged automatically.

Added: 


Modified: 
llvm/utils/gn/build/sync_source_lists_from_cmake.py

Removed: 




diff  --git a/llvm/utils/gn/build/sync_source_lists_from_cmake.py 
b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
index ae65b50b1b55..bb57d49179ea 100755
--- a/llvm/utils/gn/build/sync_source_lists_from_cmake.py
+++ b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
@@ -34,15 +34,16 @@ def patch_gn_file(gn_file, add, remove):
 tokloc = gn_contents.find(srcs_tok, tokloc + 1)
 
 if tokloc == -1: raise ValueError(gn_file + ': Failed to find source list')
-if gn_contents.find(srcs_tok, tokloc + 1) != -1:
-raise ValueError(gn_file + ': Multiple source lists')
-if gn_contents.find('# NOSORT', 0, tokloc) != -1:
-raise ValueError(gn_file + ': Found # NOSORT, needs manual merge')
-
-tokloc += len(srcs_tok)
-for a in add:
-gn_contents = (gn_contents[:tokloc] + ('"%s",' % a) +
-   gn_contents[tokloc:])
+if add:
+if gn_contents.find(srcs_tok, tokloc + 1) != -1:
+raise ValueError(gn_file + ': Multiple source lists')
+if gn_contents.find('# NOSORT', 0, tokloc) != -1:
+raise ValueError(gn_file + ': Found # NOSORT, needs manual merge')
+
+tokloc += len(srcs_tok)
+for a in add:
+gn_contents = (gn_contents[:tokloc] + ('"%s",' % a) +
+   gn_contents[tokloc:])
 for r in remove:
 gn_contents = gn_contents.replace('"%s",' % r, '')
 with open(gn_file, 'w') as f:



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 12c2646 - [gn build] sync script: only compute tokloc when adding files

2020-11-25 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-25T21:05:13-05:00
New Revision: 12c2646feb10c3aa14f590bcf9f5a3f9fc7b41b7

URL: 
https://github.com/llvm/llvm-project/commit/12c2646feb10c3aa14f590bcf9f5a3f9fc7b41b7
DIFF: 
https://github.com/llvm/llvm-project/commit/12c2646feb10c3aa14f590bcf9f5a3f9fc7b41b7.diff

LOG: [gn build] sync script: only compute tokloc when adding files

No behavior change, but maybe a bit clearer.

Added: 


Modified: 
llvm/utils/gn/build/sync_source_lists_from_cmake.py

Removed: 




diff  --git a/llvm/utils/gn/build/sync_source_lists_from_cmake.py 
b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
index bb57d49179ea..5c96fd7263f4 100755
--- a/llvm/utils/gn/build/sync_source_lists_from_cmake.py
+++ b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
@@ -26,20 +26,17 @@
 def patch_gn_file(gn_file, add, remove):
 with open(gn_file) as f:
 gn_contents = f.read()
-
-srcs_tok = 'sources = ['
-tokloc = gn_contents.find(srcs_tok)
-while tokloc != -1 and tokloc + len(srcs_tok) < len(gn_contents) and \
-gn_contents[tokloc + len(srcs_tok)] == ']':
-tokloc = gn_contents.find(srcs_tok, tokloc + 1)
-
-if tokloc == -1: raise ValueError(gn_file + ': Failed to find source list')
 if add:
+srcs_tok = 'sources = ['
+tokloc = gn_contents.find(srcs_tok)
+while tokloc != -1 and tokloc + len(srcs_tok) < len(gn_contents) and \
+gn_contents[tokloc + len(srcs_tok)] == ']':
+tokloc = gn_contents.find(srcs_tok, tokloc + 1)
+if tokloc == -1: raise ValueError(gn_file + ': No source list')
 if gn_contents.find(srcs_tok, tokloc + 1) != -1:
 raise ValueError(gn_file + ': Multiple source lists')
 if gn_contents.find('# NOSORT', 0, tokloc) != -1:
 raise ValueError(gn_file + ': Found # NOSORT, needs manual merge')
-
 tokloc += len(srcs_tok)
 for a in add:
 gn_contents = (gn_contents[:tokloc] + ('"%s",' % a) +



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 43afba0 - [gn build] sync script: try to make a loop clearer

2020-11-25 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-25T21:16:22-05:00
New Revision: 43afba0677d4630ee6a35308a4b227144b8f1d42

URL: 
https://github.com/llvm/llvm-project/commit/43afba0677d4630ee6a35308a4b227144b8f1d42
DIFF: 
https://github.com/llvm/llvm-project/commit/43afba0677d4630ee6a35308a4b227144b8f1d42.diff

LOG: [gn build] sync script: try to make a loop clearer

We want to find 'sources = [', but only if it's not the prefix
of 'sources = []' -- we're looking for a non-empty list.

No behavior change.

Added: 


Modified: 
llvm/utils/gn/build/sync_source_lists_from_cmake.py

Removed: 




diff  --git a/llvm/utils/gn/build/sync_source_lists_from_cmake.py 
b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
index 5c96fd7263f4..912cf37c7e54 100755
--- a/llvm/utils/gn/build/sync_source_lists_from_cmake.py
+++ b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
@@ -29,8 +29,7 @@ def patch_gn_file(gn_file, add, remove):
 if add:
 srcs_tok = 'sources = ['
 tokloc = gn_contents.find(srcs_tok)
-while tokloc != -1 and tokloc + len(srcs_tok) < len(gn_contents) and \
-gn_contents[tokloc + len(srcs_tok)] == ']':
+while gn_contents[tokloc:].startswith('sources = []'):
 tokloc = gn_contents.find(srcs_tok, tokloc + 1)
 if tokloc == -1: raise ValueError(gn_file + ': No source list')
 if gn_contents.find(srcs_tok, tokloc + 1) != -1:



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] a0994cb - lld-link: Let LLD_REPRODUCE control /reproduce:, like in ld.lld

2020-11-27 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-27T13:33:55-05:00
New Revision: a0994cbe2799bf4ec5bc6d72b4fb1e0fe638972f

URL: 
https://github.com/llvm/llvm-project/commit/a0994cbe2799bf4ec5bc6d72b4fb1e0fe638972f
DIFF: 
https://github.com/llvm/llvm-project/commit/a0994cbe2799bf4ec5bc6d72b4fb1e0fe638972f.diff

LOG: lld-link: Let LLD_REPRODUCE control /reproduce:, like in ld.lld

Also sync help texts for the option between elf and coff ports.

Decisions:
- Do this even if /lldignoreenv is passed. /reproduce: does not affect
  the main output, and this makes the env var more convenient to use.
  (On the other hand, it's now possible to set this env var and forget
  about it, and all future builds in the same shell will be much slower.
  That's true for ld.lld, but posix shells have an easy way to set an
  env var for a single command; in cmd.exe this is not possible without
  contortions. Then again, lld-link runs in posix shells too.)

Original patch rebased across D68378 and D68381.

Differential Revision: https://reviews.llvm.org/D67707

Added: 


Modified: 
lld/COFF/Driver.cpp
lld/COFF/Options.td
lld/ELF/Options.td
lld/test/COFF/linkrepro.test

Removed: 




diff  --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index d52abd100375..35b253ded3ec 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -1188,6 +1188,11 @@ Optional getReproduceFile(const 
opt::InputArgList &args) {
 return std::string(path);
   }
 
+  // This is intentionally not guarded by OPT_lldignoreenv since writing
+  // a repro tar file doesn't affect the main output.
+  if (auto *path = getenv("LLD_REPRODUCE"))
+return std::string(path);
+
   return None;
 }
 

diff  --git a/lld/COFF/Options.td b/lld/COFF/Options.td
index a694c671f9cd..2b8e65587ad7 100644
--- a/lld/COFF/Options.td
+++ b/lld/COFF/Options.td
@@ -58,8 +58,9 @@ def implib  : P<"implib", "Import library name">;
 def lib : F<"lib">,
 HelpText<"Act like lib.exe; must be first argument if present">;
 def libpath : P<"libpath", "Additional library search path">;
-def linkrepro : P<"linkrepro",
-"Dump linker invocation and input files for debugging">;
+def linkrepro : Joined<["/", "-", "/?", "-?"], "linkrepro:">,
+MetaVarName<"directory">,
+HelpText<"Write repro.tar containing inputs and command to reproduce 
link">;
 def lldignoreenv : F<"lldignoreenv">,
 HelpText<"Ignore environment variables like %LIB%">;
 def lldltocache : P<"lldltocache",
@@ -135,8 +136,9 @@ def noentry : F<"noentry">,
 def profile : F<"profile">;
 def repro : F<"Brepro">,
 HelpText<"Use a hash of the executable as the PE header timestamp">;
-def reproduce : P<"reproduce",
-"Dump linker invocation and input files for debugging">;
+def reproduce : Joined<["/", "-", "/?", "-?"], "reproduce:">,
+MetaVarName<"filename">,
+HelpText<"Write tar file containing inputs and command to reproduce link">;
 def swaprun : P<"swaprun",
   "Comma-separated list of 'cd' or 'net'">;
 def swaprun_cd : F<"swaprun:cd">, Alias, AliasArgs<["cd"]>,
@@ -200,7 +202,7 @@ def help_q : Flag<["/??", "-??", "/?", "-?"], "">, 
Alias;
 defm auto_import : B_priv<"auto-import">;
 defm runtime_pseudo_reloc : B_priv<"runtime-pseudo-reloc">;
 def end_lib : F<"end-lib">,
-  HelpText<"Ends group of objects treated as if they were in a library">;
+  HelpText<"End group of objects treated as if they were in a library">;
 def exclude_all_symbols : F<"exclude-all-symbols">;
 def export_all_symbols : F<"export-all-symbols">;
 defm demangle : B<"demangle",
@@ -218,7 +220,7 @@ def pdb_source_path : P<"pdbsourcepath",
 def rsp_quoting : Joined<["--"], "rsp-quoting=">,
   HelpText<"Quoting style for response files, 'windows' (default) or 'posix'">;
 def start_lib : F<"start-lib">,
-  HelpText<"Starts group of objects treated as if they were in a library">;
+  HelpText<"Start group of objects treated as if they were in a library">;
 def thinlto_emit_imports_files :
 F<"thinlto-emit-imports-files">,
 HelpText<"Emit .imports files with -thinlto-index-only">;

diff  --git a/lld/ELF/Options.td b/lld/ELF/Options.td
index db1c5d969842..f81f13d4d445 100644
--- a/lld/ELF/Options.td
+++ b/lld/ELF/Options.td
@@ -340,7 +340,9 @@ def push_state: F<"push-state">,
 def print_map: F<"print-map">,
   HelpText<"Print a link map to the standard output">;
 
-defm reproduce: Eq<"reproduce", "Write a tar file containing input files and 
command line options to reproduce link">;
+defm reproduce:
+  Eq<"reproduce",
+ "Write tar file containing inputs and command to reproduce link">;
 
 defm rosegment: BB<"rosegment",
   "Put read-only non-executable sections in their own segment (default)",

diff  --git a/lld/test/COFF/linkrepro.test b/lld/test/COFF/linkrepro.test
index 9a1db6e26369..29208fd6652a 100644
--- a/lld/test/COFF/linkrepro.test
+++ b/lld/test/COFF/linkrepro.test
@@ -1,7 +1,7 @@
 # REQUIRES: x86, shell
 
 # RUN: rm -rf 

[llvm-branch-commits] [lld] d20abb1 - [mac/lld] Add support for response files

2020-11-30 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-30T08:23:58-05:00
New Revision: d20abb1ec3b6ff90cc4221e6a5865ae22fa2f5e9

URL: 
https://github.com/llvm/llvm-project/commit/d20abb1ec3b6ff90cc4221e6a5865ae22fa2f5e9
DIFF: 
https://github.com/llvm/llvm-project/commit/d20abb1ec3b6ff90cc4221e6a5865ae22fa2f5e9.diff

LOG: [mac/lld] Add support for response files

ld64 learned about them in Xcode 12, so we should too.

Differential Revision: https://reviews.llvm.org/D92149

Added: 
lld/test/MachO/responsefile.test

Modified: 
lld/MachO/DriverUtils.cpp

Removed: 




diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 0322c20fcb69..d17a8215f6a3 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -14,6 +14,7 @@
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
+#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Path.h"
 #include "llvm/TextAPI/MachO/TextAPIReader.h"
 
@@ -68,6 +69,9 @@ opt::InputArgList MachOOptTable::parse(ArrayRef 
argv) {
   unsigned missingCount;
   SmallVector vec(argv.data(), argv.data() + argv.size());
 
+  // Expand response files (arguments in the form of @)
+  // and then parse the argument again.
+  cl::ExpandResponseFiles(saver, cl::TokenizeGNUCommandLine, vec);
   opt::InputArgList args = ParseArgs(vec, missingIndex, missingCount);
 
   if (missingCount)

diff  --git a/lld/test/MachO/responsefile.test 
b/lld/test/MachO/responsefile.test
new file mode 100644
index ..1db3ae93e720
--- /dev/null
+++ b/lld/test/MachO/responsefile.test
@@ -0,0 +1,4 @@
+# RUN: echo --help > %t.rsp
+
+# RUN: %lld @%t.rsp | FileCheck %s
+CHECK: OVERVIEW: LLVM Linker



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 83e60f5 - [lld/mac] Add --reproduce option

2020-11-30 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-30T08:40:21-05:00
New Revision: 83e60f5a554d2f531b17875e835eab0cbb487211

URL: 
https://github.com/llvm/llvm-project/commit/83e60f5a554d2f531b17875e835eab0cbb487211
DIFF: 
https://github.com/llvm/llvm-project/commit/83e60f5a554d2f531b17875e835eab0cbb487211.diff

LOG: [lld/mac] Add --reproduce option

This adds support for ld.lld's --reproduce / lld-link's /reproduce:
flag to the MachO port. This flag can be added to a link command
to make the link write a tar file containing all inputs to the link
and a response file containing the link command. This can be used
to reproduce the link on another machine, which is useful for sharing
bug report inputs or performance test loads.

Since the linker is usually called through the clang driver and
adding linker flags can be a bit cumbersome, setting the env var
`LLD_REPRODUCE=foo.tar` triggers the feature as well.

The file response.txt in the archive can be used with
`ld64.lld.darwinnew $(cat response.txt)` as long as the contents are
smaller than the command-line limit, or with `ld64.lld.darwinnew
@response.txt` once D92149 is in.

The support in this patch is sufficient to create a tar file for
Chromium's base_unittests that can link after unpacking on a different
machine.

Differential Revision: https://reviews.llvm.org/D92274

Added: 
lld/test/MachO/reproduce.s

Modified: 
lld/Common/Reproduce.cpp
lld/ELF/DriverUtils.cpp
lld/MachO/Driver.cpp
lld/MachO/Driver.h
lld/MachO/DriverUtils.cpp
lld/MachO/InputFiles.cpp
lld/MachO/InputFiles.h
lld/MachO/Options.td

Removed: 




diff  --git a/lld/Common/Reproduce.cpp b/lld/Common/Reproduce.cpp
index 00309f58b93f..017f53df05a4 100644
--- a/lld/Common/Reproduce.cpp
+++ b/lld/Common/Reproduce.cpp
@@ -54,7 +54,12 @@ std::string lld::toString(const opt::Arg &arg) {
   std::string k = std::string(arg.getSpelling());
   if (arg.getNumValues() == 0)
 return k;
-  std::string v = quote(arg.getValue());
+  std::string v;
+  for (size_t i = 0; i < arg.getNumValues(); ++i) {
+if (i > 0)
+  v.push_back(' ');
+v += quote(arg.getValue(i));
+  }
   if (arg.getOption().getRenderStyle() == opt::Option::RenderJoinedStyle)
 return k + v;
   return k + " " + v;

diff  --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index 8ce9853c57af..2efd92a3df76 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -184,7 +184,7 @@ std::string elf::createResponseFile(const opt::InputArgList 
&args) {
   // fail because the archive we are creating doesn't contain empty
   // directories for the output path (-o doesn't create directories).
   // Strip directories to prevent the issue.
-  os << "-o " << quote(sys::path::filename(arg->getValue())) << "\n";
+  os << "-o " << quote(path::filename(arg->getValue())) << "\n";
   break;
 case OPT_dynamic_list:
 case OPT_library_path:

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 0f5da218e80d..3de92f510b30 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -37,6 +37,7 @@
 #include "llvm/Support/Host.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/TarWriter.h"
 #include "llvm/Support/TargetSelect.h"
 
 #include 
@@ -548,6 +549,12 @@ static void warnIfUnimplementedOption(const opt::Option 
&opt) {
   }
 }
 
+static const char *getReproduceOption(opt::InputArgList &args) {
+  if (auto *arg = args.getLastArg(OPT_reproduce))
+return arg->getValue();
+  return getenv("LLD_REPRODUCE");
+}
+
 bool macho::link(llvm::ArrayRef argsArr, bool canExitEarly,
  raw_ostream &stdoutOS, raw_ostream &stderrOS) {
   lld::stdoutOS = &stdoutOS;
@@ -569,6 +576,20 @@ bool macho::link(llvm::ArrayRef argsArr, 
bool canExitEarly,
 return true;
   }
 
+  if (const char *path = getReproduceOption(args)) {
+// Note that --reproduce is a debug option so you can ignore it
+// if you are trying to understand the whole picture of the code.
+Expected> errOrWriter =
+TarWriter::create(path, path::stem(path));
+if (errOrWriter) {
+  tar = std::move(*errOrWriter);
+  tar->append("response.txt", createResponseFile(args));
+  tar->append("version.txt", getLLDVersion() + "\n");
+} else {
+  error("--reproduce: " + toString(errOrWriter.takeError()));
+}
+  }
+
   config = make();
   symtab = make();
   target = createTargetInfo(args);

diff  --git a/lld/MachO/Driver.h b/lld/MachO/Driver.h
index 9db628c86de2..c06d2f9d1b3d 100644
--- a/lld/MachO/Driver.h
+++ b/lld/MachO/Driver.h
@@ -35,6 +35,8 @@ enum {
 #undef OPTION
 };
 
+std::string createResponseFile(const llvm::opt::InputArgList &args);
+
 // Check for both libfoo.dylib and libfoo.tbd (in that order).
 llvm::Optional resolveDylibPath(llvm::StringRef path);
 

diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp

[llvm-branch-commits] [lld] c0e4020 - [lld-macho] Implement -fatal_warnings

2020-11-30 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-30T09:29:21-05:00
New Revision: c0e4020c927134b1dfe4181f54147af95f482558

URL: 
https://github.com/llvm/llvm-project/commit/c0e4020c927134b1dfe4181f54147af95f482558
DIFF: 
https://github.com/llvm/llvm-project/commit/c0e4020c927134b1dfe4181f54147af95f482558.diff

LOG: [lld-macho] Implement -fatal_warnings

Differential Revision: https://reviews.llvm.org/D91894

Added: 
lld/test/MachO/fatal-warnings.s

Modified: 
lld/MachO/DriverUtils.cpp
lld/MachO/Options.td

Removed: 




diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 90f1dd323f02..ec57c6898129 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -76,6 +76,10 @@ opt::InputArgList MachOOptTable::parse(ArrayRef argv) {
   cl::ExpandResponseFiles(saver, cl::TokenizeGNUCommandLine, vec);
   opt::InputArgList args = ParseArgs(vec, missingIndex, missingCount);
 
+  // Handle -fatal_warnings early since it converts missing argument warnings
+  // to errors.
+  errorHandler().fatalWarnings = args.hasArg(OPT_fatal_warnings);
+
   if (missingCount)
 error(Twine(args.getArgString(missingIndex)) + ": missing argument");
 

diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index f36820b22b17..ed3d00452bd3 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -610,8 +610,7 @@ def no_application_extension : Flag<["-"], 
"no_application_extension">,
  Flags<[HelpHidden]>,
  Group;
 def fatal_warnings : Flag<["-"], "fatal_warnings">,
- HelpText<"Escalate warnings as errors">,
- Flags<[HelpHidden]>,
+ HelpText<"Treat warnings as errors">,
  Group;
 def no_eh_labels : Flag<["-"], "no_eh_labels">,
  HelpText<"In -r mode, suppress .eh labels in the __eh_frame section">,

diff  --git a/lld/test/MachO/fatal-warnings.s b/lld/test/MachO/fatal-warnings.s
new file mode 100644
index ..4ab5589cde08
--- /dev/null
+++ b/lld/test/MachO/fatal-warnings.s
@@ -0,0 +1,13 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t1.o
+
+# RUN: %lld %t1.o -o /dev/null -single_module 2>&1 \
+# RUN: | FileCheck -check-prefix=WARNING %s
+# RUN: not %lld %t1.o -fatal_warnings -o /dev/null -single_module 2>&1 \
+# RUN: | FileCheck -check-prefix=ERROR %s
+
+# ERROR: error: Option `-single_module' is deprecated
+# WARNING: warning: Option `-single_module' is deprecated
+
+.globl _main
+_main:



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] ebac710 - [lld-macho] Don't warn on non-existent system libraries

2020-11-30 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-30T16:07:20-05:00
New Revision: ebac7100090a914e6a4dd0fdf2a5a196423cbaec

URL: 
https://github.com/llvm/llvm-project/commit/ebac7100090a914e6a4dd0fdf2a5a196423cbaec
DIFF: 
https://github.com/llvm/llvm-project/commit/ebac7100090a914e6a4dd0fdf2a5a196423cbaec.diff

LOG: [lld-macho] Don't warn on non-existent system libraries

Now, new mach-o lld no longer warns if the isysroot has just
usr/lib and System/Library/Frameworks but is missing usr/local/lib
and System/Frameworks.

This matches ld64 and old mach-o lld and fixes a regression from D85992.

It also fixes the only test failure in `check-lld` when running it
on an M1 Mac.

Differential Revision: https://reviews.llvm.org/D91891

Added: 


Modified: 
lld/MachO/Driver.cpp
lld/test/MachO/syslibroot.test

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 3de92f510b30..58a41c2b3af1 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -178,7 +178,7 @@ getSearchPaths(unsigned optionCode, opt::InputArgList &args,
 for (auto root : roots) {
   SmallString<261> buffer(root);
   path::append(buffer, path);
-  if (warnIfNotDirectory(optionLetter, buffer))
+  if (fs::is_directory(buffer))
 paths.push_back(saver.save(buffer.str()));
 }
   }

diff  --git a/lld/test/MachO/syslibroot.test b/lld/test/MachO/syslibroot.test
index b09156eb0d1b..ade8652820b1 100644
--- a/lld/test/MachO/syslibroot.test
+++ b/lld/test/MachO/syslibroot.test
@@ -6,8 +6,9 @@ CHECK-NONEXISTENT-SYSLIBROOT: Library search paths:
 CHECK-NONEXISTENT-SYSLIBROOT-NEXT: Framework search paths:
 
 RUN: mkdir -p %t/usr/lib
-RUN: lld -flavor darwinnew -v -syslibroot %t | FileCheck %s -check-prefix 
CHECK-SYSLIBROOT -DROOT=%t
+RUN: lld -flavor darwinnew -v -syslibroot %t 2>&1 | FileCheck %s -check-prefix 
CHECK-SYSLIBROOT -DROOT=%t
 
+CHECK-SYSLIBROOT-NOT: directory not found{{.*}}usr/local/lib
 CHECK-SYSLIBROOT: Library search paths:
 CHECK-SYSLIBROOT-NEXT: [[ROOT]]/usr/lib
 
@@ -22,14 +23,6 @@ RUN: lld -flavor darwinnew -v -syslibroot %t -L 
%t/Library/libxml2-development |
 CHECK-PATH-WITHOUT-REROOT:  Library search paths:
 CHECK-PATH-WITHOUT-REROOT-NEXT: [[PATH]]
 
-# NOTE: the match here is fuzzy because the default search paths exist on Linux
-# and macOS, but not on Windows (that is we ignore `/var/empty`).  This allows
-# us to run the test uniformly on all the platforms.
-RUN: lld -flavor darwinnew -v -syslibroot /var/empty -syslibroot / 2>&1 | 
FileCheck %s -check-prefix CHECK-SYSLIBROOT-IGNORED
-
-CHECK-SYSLIBROOT-IGNORED: /usr/lib
-CHECK-SYSLIBROOT-IGNORED: /usr/local/lib
-
 RUN: mkdir -p %t.2/usr/lib
 RUN: lld -flavor darwinnew -v -syslibroot %t -syslibroot %t.2 | FileCheck %s 
-check-prefix CHECK-SYSLIBROOT-MATRIX -DROOT=%t
 
@@ -37,19 +30,18 @@ CHECK-SYSLIBROOT-MATRIX: Library search paths:
 CHECK-SYSLIBROOT-MATRIX: [[ROOT]]/usr/lib
 CHECK-SYSLIBROOT-MATRIX: [[ROOT]].2/usr/lib
 
+RUN: lld -flavor darwinnew -v -syslibroot %t -syslibroot %t.2 -syslibroot / | 
FileCheck %s -check-prefix CHECK-SYSLIBROOT-IGNORED -DROOT=%t
+
+CHECK-SYSLIBROOT-IGNORED: Library search paths:
+CHECK-SYSLIBROOT-IGNORED-NOT: [[ROOT]]/usr/lib
+CHECK-SYSLIBROOT-IGNORED-NOT: [[ROOT]].2/usr/lib
+
 RUN: mkdir -p %t/System/Library/Frameworks
 RUN: lld -flavor darwinnew -v -syslibroot %t | FileCheck %s -check-prefix 
CHECK-SYSLIBROOT-FRAMEWORK -DROOT=%t
 
 CHECK-SYSLIBROOT-FRAMEWORK: Framework search paths:
 CHECK-SYSLIBROOT-FRAMEWORK: [[ROOT]]/System/Library/Frameworks
 
-# NOTE: the match here is fuzzy because the default search paths exist on Linux
-# and macOS, but not on Windows (that is we ignore `/var/empty`).  This allows
-# us to run the test uniformly on all the platforms.
-RUN: lld -flavor darwinnew -v -syslibroot /var/empty -syslibroot / 2>&1 | 
FileCheck %s -check-prefix CHECK-SYSLIBROOT-FRAMEWORK-IGNORED
-
-CHECK-SYSLIBROOT-FRAMEWORK-IGNORED: /System/Library/Framework
-
 RUN: mkdir -p %t/Library/Frameworks
 RUN: mkdir -p %t.2/Library/Frameworks
 RUN: lld -flavor darwinnew -v -syslibroot %t -syslibroot %t.2 -F 
/Library/Frameworks | FileCheck %s -check-prefix 
CHECK-SYSLIBROOT-FRAMEWORK-MATRIX -DROOT=%t
@@ -57,3 +49,9 @@ RUN: lld -flavor darwinnew -v -syslibroot %t -syslibroot %t.2 
-F /Library/Framew
 CHECK-SYSLIBROOT-FRAMEWORK-MATRIX: Framework search paths:
 CHECK-SYSLIBROOT-FRAMEWORK-MATRIX: [[ROOT]]/Library/Frameworks
 CHECK-SYSLIBROOT-FRAMEWORK-MATRIX: [[ROOT]].2/Library/Frameworks
+
+RUN: lld -flavor darwinnew -v -syslibroot %t -syslibroot %t.2 -syslibroot / -F 
/Library/Frameworks | FileCheck %s -check-prefix 
CHECK-SYSLIBROOT-FRAMEWORK-IGNORED -DROOT=%t
+
+CHECK-SYSLIBROOT-FRAMEWORK-IGNORED: Framework search paths:
+CHECK-SYSLIBROOT-FRAMEWORK-IGNORED-NOT: [[ROOT]]/Library/Frameworks
+CHECK-SYSLIBROOT-FRAMEWORK-IGNORED-NOT: [[ROOT]].2/Library/Frameworks




[llvm-branch-commits] [lld] 78c04fe - [lld/mac] Don't warn on -bundle and -execute flags

2020-11-30 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-30T16:07:58-05:00
New Revision: 78c04fe99ec0013c53cd5d16554329116c85

URL: 
https://github.com/llvm/llvm-project/commit/78c04fe99ec0013c53cd5d16554329116c85
DIFF: 
https://github.com/llvm/llvm-project/commit/78c04fe99ec0013c53cd5d16554329116c85.diff

LOG: [lld/mac] Don't warn on -bundle and -execute flags

They've been implemented since D87856 but since they still were
HelpHidden, the driver still warned claiming they were implemented.
Remove HelpHidden.

Use -fatal_warnings to test that the flags now don't warn. The
test depends on D91894 and D91891 to pass.

Differential Revision: https://reviews.llvm.org/D91971

Added: 


Modified: 
lld/MachO/Options.td
lld/test/MachO/load-commands.s

Removed: 




diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index ed3d00452bd3..de7cbf7faf3e 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -34,14 +34,12 @@ def grp_kind : OptionGroup<"kind">, HelpText<"OUTPUT KIND">;
 
 def execute : Flag<["-"], "execute">,
  HelpText<"Produce a main executable (default)">,
- Flags<[HelpHidden]>,
  Group;
 def dylib : Flag<["-"], "dylib">,
  HelpText<"Produce a shared library">,
  Group;
 def bundle : Flag<["-"], "bundle">,
  HelpText<"Produce a bundle">,
- Flags<[HelpHidden]>,
  Group;
 def r : Flag<["-"], "r">,
  HelpText<"Merge multiple object files into one, retaining relocations">,

diff  --git a/lld/test/MachO/load-commands.s b/lld/test/MachO/load-commands.s
index ec37d98408ef..abeefc4043e1 100644
--- a/lld/test/MachO/load-commands.s
+++ b/lld/test/MachO/load-commands.s
@@ -2,8 +2,9 @@
 # RUN: rm -rf %t && mkdir -p %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o
 # RUN: %lld -o %t/executable %t/test.o
-# RUN: %lld -bundle -o %t/bundle %t/test.o
-# RUN: %lld -dylib -o %t/dylib %t/test.o
+# RUN: %lld -fatal_warnings -execute -o %t/explicit-executable %t/test.o
+# RUN: %lld -fatal_warnings -bundle -o %t/bundle %t/test.o
+# RUN: %lld -fatal_warnings -dylib -o %t/dylib %t/test.o
 
 ## These load commands should be in every final output binary.
 # COMMON-DAG: cmd LC_DYLD_INFO_ONLY
@@ -15,6 +16,8 @@
 ## executable. Also check that it has the right filetype.
 # RUN: llvm-objdump --macho --all-headers %t/executable | FileCheck %s 
--check-prefix=COMMON
 # RUN: llvm-objdump --macho --all-headers %t/executable | FileCheck %s 
--check-prefix=EXEC
+# RUN: llvm-objdump --macho --all-headers %t/explicit-executable | FileCheck 
%s --check-prefix=COMMON
+# RUN: llvm-objdump --macho --all-headers %t/explicit-executable | FileCheck 
%s --check-prefix=EXEC
 # EXEC:  magiccputype cpusubtype  capsfiletype
 # EXEC-NEXT: MH_MAGIC_64  X86_64 ALL  {{.*}}  EXECUTE
 # EXEC-DAG:  cmd LC_MAIN



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 61da501 - clang/test: Remove platform-linker feature

2020-11-30 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-11-30T20:00:46-05:00
New Revision: 61da501b6a1bf845c3da9a7e761a3c6a3b6cf21a

URL: 
https://github.com/llvm/llvm-project/commit/61da501b6a1bf845c3da9a7e761a3c6a3b6cf21a
DIFF: 
https://github.com/llvm/llvm-project/commit/61da501b6a1bf845c3da9a7e761a3c6a3b6cf21a.diff

LOG: clang/test: Remove platform-linker feature

By explicitly requesting the system linker with `-fuse-ld=`, the
tests are able to CHECK for the system linker even with
CLANG_DEFAULT_LINKER=lld.

Alternative to D74704.

Differential Revision: https://reviews.llvm.org/D92291

Added: 


Modified: 
clang/test/Driver/riscv32-toolchain-extra.c
clang/test/Driver/riscv32-toolchain.c
clang/test/Driver/riscv64-toolchain-extra.c
clang/test/Driver/riscv64-toolchain.c
clang/test/lit.site.cfg.py.in
llvm/utils/gn/secondary/clang/test/BUILD.gn

Removed: 




diff  --git a/clang/test/Driver/riscv32-toolchain-extra.c 
b/clang/test/Driver/riscv32-toolchain-extra.c
index 64ff6a913e24..59e2560b09c7 100644
--- a/clang/test/Driver/riscv32-toolchain-extra.c
+++ b/clang/test/Driver/riscv32-toolchain-extra.c
@@ -11,7 +11,6 @@
 // The test below checks that the driver correctly finds the linker and
 // runtime if and only if they exist.
 //
-// REQUIRES: platform-linker
 // RUN: rm -rf %T/testroot-riscv32-baremetal-nogcc
 // RUN: mkdir -p %T/testroot-riscv32-baremetal-nogcc/bin
 // RUN: ln -s %clang %T/testroot-riscv32-baremetal-nogcc/bin/clang
@@ -19,11 +18,11 @@
 // RUN: ln -s %S/Inputs/basic_riscv32_nogcc_tree/riscv32-unknown-elf 
%T/testroot-riscv32-baremetal-nogcc/riscv32-unknown-elf
 // RUN: %T/testroot-riscv32-baremetal-nogcc/bin/clang %s -### 
-no-canonical-prefixes \
 // RUN:--gcc-toolchain=%T/testroot-riscv32-baremetal-nogcc/invalid \
-// RUN:-target riscv32-unknown-elf --rtlib=platform 2>&1 \
+// RUN:-target riscv32-unknown-elf --rtlib=platform -fuse-ld= 2>&1 \
 // RUN:| FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32-NOGCC %s
 
 // RUN: %T/testroot-riscv32-baremetal-nogcc/bin/clang %s -### 
-no-canonical-prefixes \
-// RUN:-target riscv32-unknown-elf --rtlib=platform 2>&1 \
+// RUN:-target riscv32-unknown-elf --rtlib=platform -fuse-ld= 2>&1 \
 // RUN:| FileCheck -check-prefix=C-RV32-BAREMETAL-ILP32-NOGCC %s
 
 // C-RV32-BAREMETAL-ILP32-NOGCC: "-internal-isystem" 
"{{.*}}Output/testroot-riscv32-baremetal-nogcc/bin/../riscv32-unknown-elf/include"

diff  --git a/clang/test/Driver/riscv32-toolchain.c 
b/clang/test/Driver/riscv32-toolchain.c
index 59865af311ab..a5852f5f3997 100644
--- a/clang/test/Driver/riscv32-toolchain.c
+++ b/clang/test/Driver/riscv32-toolchain.c
@@ -1,5 +1,4 @@
 // A basic clang -cc1 command-line, and simple environment check.
-// REQUIRES: platform-linker
 
 // RUN: %clang %s -### -no-canonical-prefixes -target riscv32 \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
@@ -15,7 +14,7 @@
 // In the below tests, --rtlib=platform is used so that the driver ignores
 // the configure-time CLANG_DEFAULT_RTLIB option when choosing the runtime lib
 
-// RUN: %clang %s -### -no-canonical-prefixes \
+// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld= \
 // RUN:   -target riscv32-unknown-elf --rtlib=platform \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree \
 // RUN:   --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \
@@ -30,7 +29,7 @@
 // C-RV32-BAREMETAL-ILP32: "--start-group" "-lc" "-lgloss" "--end-group" 
"-lgcc"
 // C-RV32-BAREMETAL-ILP32: 
"{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|}}crtend.o"
 
-// RUN: %clang %s -### -no-canonical-prefixes \
+// RUN: %clang %s -### -no-canonical-prefixes -fuse-ld= \
 // RUN:   -target riscv32-unknown-elf --rtlib=platform \
 // RUN:   --sysroot= \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \
@@ -44,7 +43,7 @@
 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: "--start-group" "-lc" "-lgloss" 
"--end-group" "-lgcc"
 // C-RV32-BAREMETAL-NOSYSROOT-ILP32: 
"{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|}}crtend.o"
 
-// RUN: %clangxx %s -### -no-canonical-prefixes \
+// RUN: %clangxx %s -### -no-canonical-prefixes -fuse-ld= \
 // RUN:   -target riscv32-unknown-elf -stdlib=libstdc++ --rtlib=platform \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree \
 // RUN:   --sysroot=%S/Inputs/basic_riscv32_tree/riscv32-unknown-elf 2>&1 \
@@ -60,7 +59,7 @@
 // CXX-RV32-BAREMETAL-ILP32: "-lstdc++" "--start-group" "-lc" "-lgloss" 
"--end-group" "-lgcc"
 // CXX-RV32-BAREMETAL-ILP32: 
"{{.*}}/Inputs/basic_riscv32_tree/lib/gcc/riscv32-unknown-elf/8.0.1{{/|}}crtend.o"
 
-// RUN: %clangxx %s -### -no-canonical-prefixes \
+// RUN: %clangxx %s -### -no-canonical-prefixes -fuse-ld= \
 // RUN:   -target riscv32-unknown-elf -stdlib=libstdc++ --rtlib=platform \
 // RUN:   --sysroot= \
 // RUN:   --gcc-toolchain=%S/Inputs/basic_riscv32_tree 2>&1 \

diff  --g

[llvm-branch-commits] [lld] 4431c21 - lld/ELF: Make three rarely-used flags work with --reproduce

2020-12-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-01T09:20:29-05:00
New Revision: 4431c212a0a08c2b6552e6a476a15b142d7c6bb9

URL: 
https://github.com/llvm/llvm-project/commit/4431c212a0a08c2b6552e6a476a15b142d7c6bb9
DIFF: 
https://github.com/llvm/llvm-project/commit/4431c212a0a08c2b6552e6a476a15b142d7c6bb9.diff

LOG: lld/ELF: Make three rarely-used flags work with --reproduce

All three use readFile() for their argument so their argument file is
already copied to the tar, but we weren't rewriting the argument to
point to the path used in the tar file.

No test because the change is trivial (several other flags in
createResponseFile() also aren't tested, likely for the same reason.)

Differential Revision: https://reviews.llvm.org/D92356

Added: 


Modified: 
lld/ELF/DriverUtils.cpp

Removed: 




diff  --git a/lld/ELF/DriverUtils.cpp b/lld/ELF/DriverUtils.cpp
index 2efd92a3df76..fd649808c060 100644
--- a/lld/ELF/DriverUtils.cpp
+++ b/lld/ELF/DriverUtils.cpp
@@ -186,8 +186,11 @@ std::string elf::createResponseFile(const 
opt::InputArgList &args) {
   // Strip directories to prevent the issue.
   os << "-o " << quote(path::filename(arg->getValue())) << "\n";
   break;
+case OPT_call_graph_ordering_file:
 case OPT_dynamic_list:
+case OPT_just_symbols:
 case OPT_library_path:
+case OPT_retain_symbols_file:
 case OPT_rpath:
 case OPT_script:
 case OPT_symbol_ordering_file:



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] b99e2b8 - clang/darwin: Use response files with ld64.lld.darwinnew

2020-12-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-01T12:07:56-05:00
New Revision: b99e2b8b14f4ba50f9eb80bd5a2c1824099a7f96

URL: 
https://github.com/llvm/llvm-project/commit/b99e2b8b14f4ba50f9eb80bd5a2c1824099a7f96
DIFF: 
https://github.com/llvm/llvm-project/commit/b99e2b8b14f4ba50f9eb80bd5a2c1824099a7f96.diff

LOG: clang/darwin: Use response files with ld64.lld.darwinnew

The new MachO lld just grew support for response files in D92149, so let
the clang driver use it.

Differential Revision: https://reviews.llvm.org/D92399

Added: 


Modified: 
clang/lib/Driver/ToolChains/Darwin.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index db3d57a48098..f1846a573914 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -697,8 +697,10 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
 }
   }
 
-  ResponseFileSupport ResponseSupport = ResponseFileSupport::AtFileUTF8();
-  if (Version[0] < 607) {
+  ResponseFileSupport ResponseSupport;
+  if (Version[0] >= 607 || LinkerIsLLDDarwinNew) {
+ResponseSupport = ResponseFileSupport::AtFileUTF8();
+  } else {
 // For older versions of the linker, use the legacy filelist method 
instead.
 ResponseSupport = {ResponseFileSupport::RF_FileList, llvm::sys::WEM_UTF8,
"-filelist"};



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] ba4e45a - [gn build] (manually) port 8fee2ee9a68

2020-12-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-01T18:02:27-05:00
New Revision: ba4e45a0aa6596e156b27a620281d7befc5297fc

URL: 
https://github.com/llvm/llvm-project/commit/ba4e45a0aa6596e156b27a620281d7befc5297fc
DIFF: 
https://github.com/llvm/llvm-project/commit/ba4e45a0aa6596e156b27a620281d7befc5297fc.diff

LOG: [gn build] (manually) port 8fee2ee9a68

Added: 


Modified: 
llvm/utils/gn/secondary/llvm/tools/llvm-ml/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/llvm/tools/llvm-ml/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/tools/llvm-ml/BUILD.gn
index 5a8aed018390..01c909025905 100644
--- a/llvm/utils/gn/secondary/llvm/tools/llvm-ml/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/tools/llvm-ml/BUILD.gn
@@ -1,5 +1,13 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("Opts") {
+  visibility = [ ":llvm-ml" ]
+  args = [ "-gen-opt-parser-defs" ]
+}
+
 executable("llvm-ml") {
   deps = [
+":Opts",
 "//llvm/lib/MC",
 "//llvm/lib/MC/MCParser",
 "//llvm/lib/Support",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 07ab597 - [lld/mac] Fix issues around thin archives

2020-12-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-01T18:48:29-05:00
New Revision: 07ab597bb0356ceae0195e4d66205e7eb2d07b7e

URL: 
https://github.com/llvm/llvm-project/commit/07ab597bb0356ceae0195e4d66205e7eb2d07b7e
DIFF: 
https://github.com/llvm/llvm-project/commit/07ab597bb0356ceae0195e4d66205e7eb2d07b7e.diff

LOG: [lld/mac] Fix issues around thin archives

- most importantly, fix a use-after-free when using thin archives,
  by putting the archive unique_ptr to the arena allocator. This
  ports D65565 to MachO

- correctly demangle symbol namess from archives in diagnostics

- add a test for thin archives -- it finds this UaF, but only when
  running it under asan (it also finds the demangling fix)

- make forceLoadArchive() use addFile() with a bool to have the archive
  loading code in fewer places. no behavior change; matches COFF port a
  bit better

Differential Revision: https://reviews.llvm.org/D92360

Added: 
lld/test/MachO/thin-archive.s

Modified: 
lld/MachO/Driver.cpp
lld/MachO/InputFiles.cpp
lld/MachO/Symbols.cpp
lld/MachO/Symbols.h

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 295f2c412a7f..a02be0c9a67c 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -225,10 +225,12 @@ static std::vector 
getArchiveMembers(MemoryBufferRef mb) {
   std::unique_ptr file =
   CHECK(Archive::create(mb),
 mb.getBufferIdentifier() + ": failed to parse archive");
+  Archive *archive = file.get();
+  make>(std::move(file)); // take ownership
 
   std::vector v;
   Error err = Error::success();
-  for (const Archive::Child &c : file->children(err)) {
+  for (const Archive::Child &c : archive->children(err)) {
 MemoryBufferRef mbref =
 CHECK(c.getMemoryBufferRef(),
   mb.getBufferIdentifier() +
@@ -246,17 +248,7 @@ static std::vector 
getArchiveMembers(MemoryBufferRef mb) {
   return v;
 }
 
-static void forceLoadArchive(StringRef path) {
-  if (Optional buffer = readFile(path)) {
-for (const ArchiveMember &member : getArchiveMembers(*buffer)) {
-  auto file = make(member.mbref, member.modTime);
-  file->archiveName = buffer->getBufferIdentifier();
-  inputFiles.push_back(file);
-}
-  }
-}
-
-static InputFile *addFile(StringRef path) {
+static InputFile *addFile(StringRef path, bool forceLoadArchive) {
   Optional buffer = readFile(path);
   if (!buffer)
 return nullptr;
@@ -271,8 +263,14 @@ static InputFile *addFile(StringRef path) {
 if (!file->isEmpty() && !file->hasSymbolTable())
   error(path + ": archive has no index; run ranlib to add one");
 
-if (config->allLoad) {
-  forceLoadArchive(path);
+if (config->allLoad || forceLoadArchive) {
+  if (Optional buffer = readFile(path)) {
+for (const ArchiveMember &member : getArchiveMembers(*buffer)) {
+  auto file = make(member.mbref, member.modTime);
+  file->archiveName = buffer->getBufferIdentifier();
+  inputFiles.push_back(file);
+}
+  }
 } else if (config->forceLoadObjC) {
   for (const object::Archive::Symbol &sym : file->symbols())
 if (sym.getName().startswith(objc::klass))
@@ -320,7 +318,7 @@ static void addFileList(StringRef path) {
 return;
   MemoryBufferRef mbref = *buffer;
   for (StringRef path : args::getLines(mbref))
-addFile(path);
+addFile(path, false);
 }
 
 static std::array archNames{"arm","arm64", "i386",
@@ -671,10 +669,11 @@ bool macho::link(llvm::ArrayRef argsArr, 
bool canExitEarly,
 // TODO: are any of these better handled via filtered() or getLastArg()?
 switch (opt.getID()) {
 case OPT_INPUT:
-  addFile(arg->getValue());
+  addFile(arg->getValue(), false);
   break;
 case OPT_weak_library: {
-  auto *dylibFile = dyn_cast_or_null(addFile(arg->getValue()));
+  auto *dylibFile =
+  dyn_cast_or_null(addFile(arg->getValue(), false));
   if (dylibFile)
 dylibFile->forceWeakImport = true;
   break;
@@ -683,13 +682,13 @@ bool macho::link(llvm::ArrayRef argsArr, 
bool canExitEarly,
   addFileList(arg->getValue());
   break;
 case OPT_force_load:
-  forceLoadArchive(arg->getValue());
+  addFile(arg->getValue(), true);
   break;
 case OPT_l:
 case OPT_weak_l: {
   StringRef name = arg->getValue();
   if (Optional path = findLibrary(name)) {
-auto *dylibFile = dyn_cast_or_null(addFile(*path));
+auto *dylibFile = dyn_cast_or_null(addFile(*path, false));
 if (opt.getID() == OPT_weak_l && dylibFile)
   dylibFile->forceWeakImport = true;
 break;
@@ -701,7 +700,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool 
canExitEarly,
 case OPT_weak_framework: {
   StringRef name = arg->getValue();
   if (Optional path = findFramework(name)) {
-auto *dylibFile = dyn_cast_or_null(addFile(*path));
+auto *dy

[llvm-branch-commits] [lld] 126f58e - fix typos to cycle bots

2020-12-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-01T20:27:33-05:00
New Revision: 126f58e83816588eae891fe46f02584bf65bef37

URL: 
https://github.com/llvm/llvm-project/commit/126f58e83816588eae891fe46f02584bf65bef37
DIFF: 
https://github.com/llvm/llvm-project/commit/126f58e83816588eae891fe46f02584bf65bef37.diff

LOG: fix typos to cycle bots

Added: 


Modified: 
lld/MachO/SyntheticSections.h
lld/MachO/UnwindInfoSection.cpp

Removed: 




diff  --git a/lld/MachO/SyntheticSections.h b/lld/MachO/SyntheticSections.h
index 0f3775b11b47..9384df6481f0 100644
--- a/lld/MachO/SyntheticSections.h
+++ b/lld/MachO/SyntheticSections.h
@@ -455,7 +455,7 @@ class SymtabSection : public LinkEditSection {
 
 // The indirect symbol table is a list of 32-bit integers that serve as indices
 // into the (actual) symbol table. The indirect symbol table is a
-// concatentation of several sub-arrays of indices, each sub-array belonging to
+// concatenation of several sub-arrays of indices, each sub-array belonging to
 // a separate section. The starting offset of each sub-array is stored in the
 // reserved1 header field of the respective section.
 //

diff  --git a/lld/MachO/UnwindInfoSection.cpp b/lld/MachO/UnwindInfoSection.cpp
index ac19ec1586b7..ed6cf050f576 100644
--- a/lld/MachO/UnwindInfoSection.cpp
+++ b/lld/MachO/UnwindInfoSection.cpp
@@ -194,7 +194,7 @@ void UnwindInfoSection::finalize() {
cuPtrVector.size() * sizeof(uint32_t);
 }
 
-// All inputs are relocated and output adddresses are known, so write!
+// All inputs are relocated and output addresses are known, so write!
 
 void UnwindInfoSection::writeTo(uint8_t *buf) const {
   // section header



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] facdede - [mac/lld] fix typo in 07ab597bb0356c that broke test on Windows

2020-12-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-01T20:36:49-05:00
New Revision: facdededcab02f86d707df5e5ddd7e8f467e1bd1

URL: 
https://github.com/llvm/llvm-project/commit/facdededcab02f86d707df5e5ddd7e8f467e1bd1
DIFF: 
https://github.com/llvm/llvm-project/commit/facdededcab02f86d707df5e5ddd7e8f467e1bd1.diff

LOG: [mac/lld] fix typo in 07ab597bb0356c that broke test on Windows

Added: 


Modified: 
lld/test/MachO/thin-archive.s

Removed: 




diff  --git a/lld/test/MachO/thin-archive.s b/lld/test/MachO/thin-archive.s
index f12506eecab4..6872a4d6a934 100644
--- a/lld/test/MachO/thin-archive.s
+++ b/lld/test/MachO/thin-archive.s
@@ -12,7 +12,7 @@
 # RUN: llvm-nm %t/out
 # RUN: %lld %t/main.o %t/lib_thin.a -o %t/out
 # RUN: llvm-nm %t/out
-# RUN: %lld /%t/main.o -force_load %t/lib_thin.a -o %t/out
+# RUN: %lld %t/main.o -force_load %t/lib_thin.a -o %t/out
 # RUN: llvm-nm %t/out
 
 # RUN: rm %t/lib.o



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] b2f00f2 - [mac/lld] Include archive name in diagnostics

2020-12-01 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-01T23:00:25-05:00
New Revision: b2f00f24a3c4983a977ff3d975962e7f9dfb887e

URL: 
https://github.com/llvm/llvm-project/commit/b2f00f24a3c4983a977ff3d975962e7f9dfb887e
DIFF: 
https://github.com/llvm/llvm-project/commit/b2f00f24a3c4983a977ff3d975962e7f9dfb887e.diff

LOG: [mac/lld] Include archive name in diagnostics

Also, for .o files, include full path as given on link command line.

Before:
lld: error: undefined symbol [...], referenced from sandbox_logging.o

After:
lld: error: undefined symbol [...], referenced from 
libseatbelt.a(sandbox_logging.o)

Move archiveName up to InputFile so we can consistently use toString()
to print InputFiles in diags, and pass it to the ObjFile ctor. This
matches the ELF and COFF ports.

Differential Revision: https://reviews.llvm.org/D92437

Added: 


Modified: 
lld/ELF/InputFiles.h
lld/MachO/Driver.cpp
lld/MachO/InputFiles.cpp
lld/MachO/InputFiles.h
lld/MachO/LTO.cpp
lld/MachO/Writer.cpp
lld/test/MachO/invalid/undefined-symbol.s

Removed: 




diff  --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h
index b1c83ddf384f..e8fc68900db1 100644
--- a/lld/ELF/InputFiles.h
+++ b/lld/ELF/InputFiles.h
@@ -95,9 +95,8 @@ class InputFile {
   // Get filename to use for linker script processing.
   StringRef getNameForScript() const;
 
-  // Filename of .a which contained this file. If this file was
-  // not in an archive file, it is the empty string. We use this
-  // string for creating error messages.
+  // If not empty, this stores the name of the archive containing this file.
+  // We use this string for creating error messages.
   std::string archiveName;
 
   // If this is an architecture-specific file, the following members

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index a02be0c9a67c..c3b8224750ab 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -266,9 +266,8 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
 if (config->allLoad || forceLoadArchive) {
   if (Optional buffer = readFile(path)) {
 for (const ArchiveMember &member : getArchiveMembers(*buffer)) {
-  auto file = make(member.mbref, member.modTime);
-  file->archiveName = buffer->getBufferIdentifier();
-  inputFiles.push_back(file);
+  inputFiles.push_back(
+  make(member.mbref, member.modTime, path));
 }
   }
 } else if (config->forceLoadObjC) {
@@ -280,17 +279,21 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
   // we already found that it contains an ObjC symbol. We should also
   // consider creating a LazyObjFile class in order to avoid double-loading
   // these files here and below (as part of the ArchiveFile).
-  if (Optional buffer = readFile(path))
-for (const ArchiveMember &member : getArchiveMembers(*buffer))
-  if (hasObjCSection(member.mbref))
-inputFiles.push_back(make(member.mbref, member.modTime));
+  if (Optional buffer = readFile(path)) {
+for (const ArchiveMember &member : getArchiveMembers(*buffer)) {
+  if (hasObjCSection(member.mbref)) {
+inputFiles.push_back(
+make(member.mbref, member.modTime, path));
+  }
+}
+  }
 }
 
 newFile = make(std::move(file));
 break;
   }
   case file_magic::macho_object:
-newFile = make(mbref, getModTime(path));
+newFile = make(mbref, getModTime(path), "");
 break;
   case file_magic::macho_dynamically_linked_shared_lib:
   case file_magic::macho_dynamically_linked_shared_lib_stub:
@@ -737,7 +740,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool 
canExitEarly,
 parseOrderFile(orderFile);
 
   if (config->outputType == MH_EXECUTE && isa(config->entry)) {
-error("undefined symbol: " + config->entry->getName());
+error("undefined symbol: " + toString(*config->entry));
 return false;
   }
 

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index cfb30cfc35f5..3a87a42ded08 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -74,6 +74,17 @@ using namespace llvm::sys;
 using namespace lld;
 using namespace lld::macho;
 
+// Returns "", "foo.a(bar.o)", or "baz.o".
+std::string lld::toString(const InputFile *f) {
+  if (!f)
+return "";
+  if (f->archiveName.empty())
+return std::string(f->getName());
+  return (path::filename(f->archiveName) + "(" + path::filename(f->getName()) +
+  ")")
+  .str();
+}
+
 std::vector macho::inputFiles;
 std::unique_ptr macho::tar;
 int InputFile::idCount = 0;
@@ -365,8 +376,10 @@ OpaqueFile::OpaqueFile(MemoryBufferRef mb, StringRef 
segName,
   subsections.push_back({{0, isec}});
 }
 
-ObjFile::ObjFile(MemoryBufferRef mb, uint32_t modTime)
+ObjFile::ObjFile(MemoryBufferRef mb, uint32_t modTime, StringRef archiveName)
 : InputF

[llvm-branch-commits] [lld] ca63439 - [mac/lld] Make --reproduce work with thin archives

2020-12-02 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-02T09:48:31-05:00
New Revision: ca634393fc797f766a68e8537e20a1bf0ec8ca94

URL: 
https://github.com/llvm/llvm-project/commit/ca634393fc797f766a68e8537e20a1bf0ec8ca94
DIFF: 
https://github.com/llvm/llvm-project/commit/ca634393fc797f766a68e8537e20a1bf0ec8ca94.diff

LOG: [mac/lld] Make --reproduce work with thin archives

See http://reviews.llvm.org/rL268229 and
http://reviews.llvm.org/rL313832 which did the same for the ELF port.

Differential Revision: https://reviews.llvm.org/D92456

Added: 
lld/test/MachO/reproduce-thin-archives.s

Modified: 
lld/MachO/Driver.cpp
lld/MachO/InputFiles.cpp

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index c3b8224750ab..426101f4f9e1 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -24,6 +24,7 @@
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/LLVM.h"
 #include "lld/Common/Memory.h"
+#include "lld/Common/Reproduce.h"
 #include "lld/Common/Version.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/StringExtras.h"
@@ -230,11 +231,17 @@ static std::vector 
getArchiveMembers(MemoryBufferRef mb) {
 
   std::vector v;
   Error err = Error::success();
+
+  // Thin archives refer to .o files, so --reproduces needs the .o files too.
+  bool addToTar = archive->isThin() && tar;
+
   for (const Archive::Child &c : archive->children(err)) {
 MemoryBufferRef mbref =
 CHECK(c.getMemoryBufferRef(),
   mb.getBufferIdentifier() +
   ": could not get the buffer for a child of the archive");
+if (addToTar)
+  tar->append(relativeToRoot(check(c.getFullName())), mbref.getBuffer());
 uint32_t modTime = toTimeT(
 CHECK(c.getLastModified(), mb.getBufferIdentifier() +
": could not get the modification "

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 3a87a42ded08..4fd9873bcbd3 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -610,6 +610,9 @@ void ArchiveFile::fetch(const object::Archive::Symbol &sym) 
{
 ": could not get the buffer for the member defining symbol " +
 toMachOString(sym));
 
+  if (tar && c.getParent()->isThin())
+tar->append(relativeToRoot(CHECK(c.getFullName(), this)), mb.getBuffer());
+
   uint32_t modTime = toTimeT(
   CHECK(c.getLastModified(), toString(this) +
  ": could not get the modification time "

diff  --git a/lld/test/MachO/reproduce-thin-archives.s 
b/lld/test/MachO/reproduce-thin-archives.s
new file mode 100644
index ..9dee3f400e06
--- /dev/null
+++ b/lld/test/MachO/reproduce-thin-archives.s
@@ -0,0 +1,20 @@
+# REQUIRES: x86
+
+# RUN: rm -rf %t.dir
+# RUN: mkdir -p %t.dir
+# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos %s -o %t.dir/foo.o
+# RUN: cd %t.dir
+# RUN: llvm-ar rcsT foo.a foo.o
+
+# RUN: %lld foo.a -o /dev/null --reproduce repro.tar
+# RUN: tar tf repro.tar | FileCheck -DPATH='repro/%:t.dir' %s
+
+# RUN: %lld -all_load foo.a -o /dev/null --reproduce repro2.tar
+# RUN: tar tf repro2.tar | FileCheck -DPATH='repro2/%:t.dir' %s
+
+# CHECK-DAG: [[PATH]]/foo.a
+# CHECK-DAG: [[PATH]]/foo.o
+
+.globl _main
+_main:
+  nop



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 542d3b6 - [mac/lld] Implement -why_load

2020-12-02 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-02T18:33:12-05:00
New Revision: 542d3b609dbe99a30759942271398890fc7770dc

URL: 
https://github.com/llvm/llvm-project/commit/542d3b609dbe99a30759942271398890fc7770dc
DIFF: 
https://github.com/llvm/llvm-project/commit/542d3b609dbe99a30759942271398890fc7770dc.diff

LOG: [mac/lld] Implement -why_load

This is useful for debugging why lld loads .o files it shouldn't load.
It's also useful for users of lld -- I've used ld64's version of this a
few times.

Differential Revision: https://reviews.llvm.org/D92496

Added: 
lld/test/MachO/why-load.s

Modified: 
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Driver.h
lld/MachO/DriverUtils.cpp
lld/MachO/InputFiles.cpp
lld/MachO/Options.td

Removed: 




diff  --git a/lld/MachO/Config.h b/lld/MachO/Config.h
index 82c017063d44..bc22680db58f 100644
--- a/lld/MachO/Config.h
+++ b/lld/MachO/Config.h
@@ -38,6 +38,7 @@ struct Configuration {
   bool staticLink = false;
   bool isPic = false;
   bool headerPadMaxInstallNames = false;
+  bool printWhyLoad = false;
   bool searchDylibsFirst = false;
   bool saveTemps = false;
   uint32_t headerPad;

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 426101f4f9e1..9822ecdd9f2a 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -275,6 +275,8 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
 for (const ArchiveMember &member : getArchiveMembers(*buffer)) {
   inputFiles.push_back(
   make(member.mbref, member.modTime, path));
+  printWhyLoad((forceLoadArchive ? "-force_load" : "-all_load"),
+   inputFiles.back());
 }
   }
 } else if (config->forceLoadObjC) {
@@ -291,6 +293,7 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
   if (hasObjCSection(member.mbref)) {
 inputFiles.push_back(
 make(member.mbref, member.modTime, path));
+printWhyLoad("-ObjC", inputFiles.back());
   }
 }
   }
@@ -637,6 +640,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool 
canExitEarly,
   config->headerPad = args::getHex(args, OPT_headerpad, /*Default=*/32);
   config->headerPadMaxInstallNames =
   args.hasArg(OPT_headerpad_max_install_names);
+  config->printWhyLoad = args.hasArg(OPT_why_load);
   config->outputType = getOutputType(args);
   config->runtimePaths = args::getStrings(args, OPT_rpath);
   config->allLoad = args.hasArg(OPT_all_load);

diff  --git a/lld/MachO/Driver.h b/lld/MachO/Driver.h
index d5625fd3873e..db7c54c59966 100644
--- a/lld/MachO/Driver.h
+++ b/lld/MachO/Driver.h
@@ -19,6 +19,7 @@ namespace lld {
 namespace macho {
 
 class DylibFile;
+class InputFile;
 
 class MachOOptTable : public llvm::opt::OptTable {
 public:
@@ -45,6 +46,8 @@ llvm::Optional 
makeDylibFromTAPI(llvm::MemoryBufferRef mbref,
 
 uint32_t getModTime(llvm::StringRef path);
 
+void printWhyLoad(StringRef reason, const InputFile *);
+
 } // namespace macho
 } // namespace lld
 

diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 77f76b522d7e..9c09ff682286 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "Driver.h"
+#include "Config.h"
 #include "InputFiles.h"
 
 #include "lld/Common/Args.h"
@@ -185,3 +186,10 @@ uint32_t macho::getModTime(StringRef path) {
   warn("failed to get modification time of " + path);
   return 0;
 }
+
+void macho::printWhyLoad(StringRef reason, const InputFile *f) {
+  if (!config->printWhyLoad)
+return;
+  lld::outs() << reason << " forced load of " << toString(f)
+  << '\n';
+}

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 4fd9873bcbd3..a24d045096c6 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -621,6 +621,10 @@ void ArchiveFile::fetch(const object::Archive::Symbol 
&sym) {
 
   auto file = make(mb, modTime, getName());
 
+  // ld64 doesn't demangle sym here even with -demangle. Match that, so
+  // intentionally no call to toMachOString() here.
+  printWhyLoad(sym.getName(), file);
+
   symbols.insert(symbols.end(), file->symbols.begin(), file->symbols.end());
   subsections.insert(subsections.end(), file->subsections.begin(),
  file->subsections.end());

diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 399928e8d9ae..5b38fc650e9f 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -426,8 +426,7 @@ def commons : Separate<["-"], "commons">,
 def grp_introspect : OptionGroup<"introspect">, HelpText<"INTROSPECTING THE 
LINKER">;
 
 def why_load : Flag<["-"], "why_load">,
- HelpText<"Log the symbol that compels loading of each object file from a 
static library">,
- Flags<[HelpHidden]>,
+ HelpText<"Log why each

[llvm-branch-commits] [lld] ea0029f - Revert "[mac/lld] Implement -why_load"

2020-12-02 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-02T18:57:46-05:00
New Revision: ea0029f55da9e34a58bcc79d0af76a940f2330a6

URL: 
https://github.com/llvm/llvm-project/commit/ea0029f55da9e34a58bcc79d0af76a940f2330a6
DIFF: 
https://github.com/llvm/llvm-project/commit/ea0029f55da9e34a58bcc79d0af76a940f2330a6.diff

LOG: Revert "[mac/lld] Implement -why_load"

This reverts commit 542d3b609dbe99a30759942271398890fc7770dc.
Seems to break check-lld. Reverting while I take a look.

Added: 


Modified: 
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Driver.h
lld/MachO/DriverUtils.cpp
lld/MachO/InputFiles.cpp
lld/MachO/Options.td

Removed: 
lld/test/MachO/why-load.s



diff  --git a/lld/MachO/Config.h b/lld/MachO/Config.h
index bc22680db58f..82c017063d44 100644
--- a/lld/MachO/Config.h
+++ b/lld/MachO/Config.h
@@ -38,7 +38,6 @@ struct Configuration {
   bool staticLink = false;
   bool isPic = false;
   bool headerPadMaxInstallNames = false;
-  bool printWhyLoad = false;
   bool searchDylibsFirst = false;
   bool saveTemps = false;
   uint32_t headerPad;

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 9822ecdd9f2a..426101f4f9e1 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -275,8 +275,6 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
 for (const ArchiveMember &member : getArchiveMembers(*buffer)) {
   inputFiles.push_back(
   make(member.mbref, member.modTime, path));
-  printWhyLoad((forceLoadArchive ? "-force_load" : "-all_load"),
-   inputFiles.back());
 }
   }
 } else if (config->forceLoadObjC) {
@@ -293,7 +291,6 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
   if (hasObjCSection(member.mbref)) {
 inputFiles.push_back(
 make(member.mbref, member.modTime, path));
-printWhyLoad("-ObjC", inputFiles.back());
   }
 }
   }
@@ -640,7 +637,6 @@ bool macho::link(llvm::ArrayRef argsArr, bool 
canExitEarly,
   config->headerPad = args::getHex(args, OPT_headerpad, /*Default=*/32);
   config->headerPadMaxInstallNames =
   args.hasArg(OPT_headerpad_max_install_names);
-  config->printWhyLoad = args.hasArg(OPT_why_load);
   config->outputType = getOutputType(args);
   config->runtimePaths = args::getStrings(args, OPT_rpath);
   config->allLoad = args.hasArg(OPT_all_load);

diff  --git a/lld/MachO/Driver.h b/lld/MachO/Driver.h
index db7c54c59966..d5625fd3873e 100644
--- a/lld/MachO/Driver.h
+++ b/lld/MachO/Driver.h
@@ -19,7 +19,6 @@ namespace lld {
 namespace macho {
 
 class DylibFile;
-class InputFile;
 
 class MachOOptTable : public llvm::opt::OptTable {
 public:
@@ -46,8 +45,6 @@ llvm::Optional 
makeDylibFromTAPI(llvm::MemoryBufferRef mbref,
 
 uint32_t getModTime(llvm::StringRef path);
 
-void printWhyLoad(StringRef reason, const InputFile *);
-
 } // namespace macho
 } // namespace lld
 

diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 9c09ff682286..77f76b522d7e 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -7,7 +7,6 @@
 
//===--===//
 
 #include "Driver.h"
-#include "Config.h"
 #include "InputFiles.h"
 
 #include "lld/Common/Args.h"
@@ -186,10 +185,3 @@ uint32_t macho::getModTime(StringRef path) {
   warn("failed to get modification time of " + path);
   return 0;
 }
-
-void macho::printWhyLoad(StringRef reason, const InputFile *f) {
-  if (!config->printWhyLoad)
-return;
-  lld::outs() << reason << " forced load of " << toString(f)
-  << '\n';
-}

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index a24d045096c6..4fd9873bcbd3 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -621,10 +621,6 @@ void ArchiveFile::fetch(const object::Archive::Symbol 
&sym) {
 
   auto file = make(mb, modTime, getName());
 
-  // ld64 doesn't demangle sym here even with -demangle. Match that, so
-  // intentionally no call to toMachOString() here.
-  printWhyLoad(sym.getName(), file);
-
   symbols.insert(symbols.end(), file->symbols.begin(), file->symbols.end());
   subsections.insert(subsections.end(), file->subsections.begin(),
  file->subsections.end());

diff  --git a/lld/MachO/Options.td b/lld/MachO/Options.td
index 5b38fc650e9f..399928e8d9ae 100644
--- a/lld/MachO/Options.td
+++ b/lld/MachO/Options.td
@@ -426,7 +426,8 @@ def commons : Separate<["-"], "commons">,
 def grp_introspect : OptionGroup<"introspect">, HelpText<"INTROSPECTING THE 
LINKER">;
 
 def why_load : Flag<["-"], "why_load">,
- HelpText<"Log why each object file is loaded from a static library">,
+ HelpText<"Log the symbol that compels loading of each object file from a 
static library">,
+ Flags<[HelpHidden]>,
  Group;
 def whyload : Flag<[

[llvm-branch-commits] [lld] 3422f3c - Reland "[mac/lld] Implement -why_load".

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T08:35:12-05:00
New Revision: 3422f3cc6e5c8b4657297b5b7b898e5bfb60bbf5

URL: 
https://github.com/llvm/llvm-project/commit/3422f3cc6e5c8b4657297b5b7b898e5bfb60bbf5
DIFF: 
https://github.com/llvm/llvm-project/commit/3422f3cc6e5c8b4657297b5b7b898e5bfb60bbf5.diff

LOG: Reland "[mac/lld] Implement -why_load".

The problem was that `sym` became replaced in the call
to make and referring to it afer that read memory that now
stored a different kind of symbol (a Defined instead of a LazySymbol).
Since this happens only once per archive, just copy the symbol to the
stack before make and read the copy instead.

Originally reviewed at https://reviews.llvm.org/D92496

Added: 
lld/test/MachO/why-load.s

Modified: 
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Driver.h
lld/MachO/DriverUtils.cpp
lld/MachO/InputFiles.cpp
lld/MachO/Options.td

Removed: 




diff  --git a/lld/MachO/Config.h b/lld/MachO/Config.h
index 82c017063d44..bc22680db58f 100644
--- a/lld/MachO/Config.h
+++ b/lld/MachO/Config.h
@@ -38,6 +38,7 @@ struct Configuration {
   bool staticLink = false;
   bool isPic = false;
   bool headerPadMaxInstallNames = false;
+  bool printWhyLoad = false;
   bool searchDylibsFirst = false;
   bool saveTemps = false;
   uint32_t headerPad;

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 426101f4f9e1..9822ecdd9f2a 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -275,6 +275,8 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
 for (const ArchiveMember &member : getArchiveMembers(*buffer)) {
   inputFiles.push_back(
   make(member.mbref, member.modTime, path));
+  printWhyLoad((forceLoadArchive ? "-force_load" : "-all_load"),
+   inputFiles.back());
 }
   }
 } else if (config->forceLoadObjC) {
@@ -291,6 +293,7 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
   if (hasObjCSection(member.mbref)) {
 inputFiles.push_back(
 make(member.mbref, member.modTime, path));
+printWhyLoad("-ObjC", inputFiles.back());
   }
 }
   }
@@ -637,6 +640,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool 
canExitEarly,
   config->headerPad = args::getHex(args, OPT_headerpad, /*Default=*/32);
   config->headerPadMaxInstallNames =
   args.hasArg(OPT_headerpad_max_install_names);
+  config->printWhyLoad = args.hasArg(OPT_why_load);
   config->outputType = getOutputType(args);
   config->runtimePaths = args::getStrings(args, OPT_rpath);
   config->allLoad = args.hasArg(OPT_all_load);

diff  --git a/lld/MachO/Driver.h b/lld/MachO/Driver.h
index d5625fd3873e..db7c54c59966 100644
--- a/lld/MachO/Driver.h
+++ b/lld/MachO/Driver.h
@@ -19,6 +19,7 @@ namespace lld {
 namespace macho {
 
 class DylibFile;
+class InputFile;
 
 class MachOOptTable : public llvm::opt::OptTable {
 public:
@@ -45,6 +46,8 @@ llvm::Optional 
makeDylibFromTAPI(llvm::MemoryBufferRef mbref,
 
 uint32_t getModTime(llvm::StringRef path);
 
+void printWhyLoad(StringRef reason, const InputFile *);
+
 } // namespace macho
 } // namespace lld
 

diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 77f76b522d7e..9c09ff682286 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -7,6 +7,7 @@
 
//===--===//
 
 #include "Driver.h"
+#include "Config.h"
 #include "InputFiles.h"
 
 #include "lld/Common/Args.h"
@@ -185,3 +186,10 @@ uint32_t macho::getModTime(StringRef path) {
   warn("failed to get modification time of " + path);
   return 0;
 }
+
+void macho::printWhyLoad(StringRef reason, const InputFile *f) {
+  if (!config->printWhyLoad)
+return;
+  lld::outs() << reason << " forced load of " << toString(f)
+  << '\n';
+}

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 4fd9873bcbd3..7d601c120017 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -619,8 +619,17 @@ void ArchiveFile::fetch(const object::Archive::Symbol 
&sym) {
  "for the member defining symbol " +
  toMachOString(sym)));
 
+  // `sym` is owned by a LazySym, which will be replace<>() by make
+  // and become invalid after that call. Copy it to the stack so we can refer
+  // to it later.
+  const object::Archive::Symbol sym_copy = sym;
+
   auto file = make(mb, modTime, getName());
 
+  // ld64 doesn't demangle sym here even with -demangle. Match that, so
+  // intentionally no call to toMachOString() here.
+  printWhyLoad(sym_copy.getName(), file);
+
   symbols.insert(symbols.end(), file->symbols.begin(), file->symbols.end());
   subsections.insert(subsections.end(), file->subsections.begin(),
  file->subsec

[llvm-branch-commits] [clang] 68f2ff5 - clang/darwin: Don't use response files with ld64

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T09:00:10-05:00
New Revision: 68f2ff59d114a5511e197472d2d4f23fea7ff0f5

URL: 
https://github.com/llvm/llvm-project/commit/68f2ff59d114a5511e197472d2d4f23fea7ff0f5
DIFF: 
https://github.com/llvm/llvm-project/commit/68f2ff59d114a5511e197472d2d4f23fea7ff0f5.diff

LOG: clang/darwin: Don't use response files with ld64

This morally reverts D82777 -- turns out that ld64 crashes with many
response files, so we must stop passing them to it until the crash is
fixed.

Differential Revision: https://reviews.llvm.org/D92357

Added: 


Modified: 
clang/lib/Driver/ToolChains/Darwin.cpp

Removed: 




diff  --git a/clang/lib/Driver/ToolChains/Darwin.cpp 
b/clang/lib/Driver/ToolChains/Darwin.cpp
index f1846a573914..9f8560356405 100644
--- a/clang/lib/Driver/ToolChains/Darwin.cpp
+++ b/clang/lib/Driver/ToolChains/Darwin.cpp
@@ -698,7 +698,10 @@ void darwin::Linker::ConstructJob(Compilation &C, const 
JobAction &JA,
   }
 
   ResponseFileSupport ResponseSupport;
-  if (Version[0] >= 607 || LinkerIsLLDDarwinNew) {
+  if (LinkerIsLLDDarwinNew) {
+// Xcode12's ld64 added support for @response files, but it's crashy:
+// https://openradar.appspot.com/radar?id=4933317065441280
+// FIXME: Pass this for ld64 once it no longer crashes.
 ResponseSupport = ResponseFileSupport::AtFileUTF8();
   } else {
 // For older versions of the linker, use the legacy filelist method 
instead.



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 0cbf61b - [mac/arm] Fix rtti codegen tests when running on an arm mac

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T09:11:03-05:00
New Revision: 0cbf61be8be546257854d1a2e5d6c675f5838a63

URL: 
https://github.com/llvm/llvm-project/commit/0cbf61be8be546257854d1a2e5d6c675f5838a63
DIFF: 
https://github.com/llvm/llvm-project/commit/0cbf61be8be546257854d1a2e5d6c675f5838a63.diff

LOG: [mac/arm] Fix rtti codegen tests when running on an arm mac

shouldRTTIBeUnique() returns false for iOS64CXXABI, which causes
RTTI objects to be emitted hidden. Update two tests that didn't
expect this to happen for the default triple.

Also rename iOS64CXXABI to AppleARM64CXXABI, since it's used for
arm64-apple-macos triples too.

Part of PR46644.

Differential Revision: https://reviews.llvm.org/D91904

Added: 


Modified: 
clang/include/clang/Basic/TargetCXXABI.h
clang/lib/AST/ASTContext.cpp
clang/lib/Basic/Targets/AArch64.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/ItaniumCXXABI.cpp
clang/test/CodeGenCXX/weak-extern-typeinfo.cpp
clang/test/SemaCXX/typeid-ref.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/TargetCXXABI.h 
b/clang/include/clang/Basic/TargetCXXABI.h
index 30145ac69138..2d267f43f92b 100644
--- a/clang/include/clang/Basic/TargetCXXABI.h
+++ b/clang/include/clang/Basic/TargetCXXABI.h
@@ -62,17 +62,17 @@ class TargetCXXABI {
 ///   - constructor/destructor signatures.
 iOS,
 
-/// The iOS 64-bit ABI is follows ARM's published 64-bit ABI more
-/// closely, but we don't guarantee to follow it perfectly.
+/// The iOS 64-bit and macOS 64-bit ARM ABI follows ARM's published 64-bit
+/// ABI more closely, but we don't guarantee to follow it perfectly.
 ///
 /// It is documented here:
 ///http://infocenter.arm.com
 ///  /help/topic/com.arm.doc.ihi0059a/IHI0059A_cppabi64.pdf
-iOS64,
+AppleARM64,
 
 /// WatchOS is a modernisation of the iOS ABI, which roughly means it's
-/// the iOS64 ABI ported to 32-bits. The primary 
diff erence from iOS64 is
-/// that RTTI objects must still be unique at the moment.
+/// the AppleARM64 ABI ported to 32-bits. The primary 
diff erence from
+/// AppleARM64 is that RTTI objects must still be unique at the moment.
 WatchOS,
 
 /// The generic AArch64 ABI is also a modified version of the Itanium ABI,
@@ -98,7 +98,7 @@ class TargetCXXABI {
 ///   - guard variables are 32-bit on wasm32, as in ARM;
 ///   - unused bits of guard variables are reserved, as in ARM;
 ///   - inline functions are never key functions, as in ARM;
-///   - C++11 POD rules are used for tail padding, as in iOS64.
+///   - C++11 POD rules are used for tail padding, as in AppleARM64.
 ///
 /// TODO: At present the WebAssembly ABI is not considered stable, so none
 /// of these details is necessarily final yet.
@@ -147,12 +147,12 @@ class TargetCXXABI {
   /// Does this ABI generally fall into the Itanium family of ABIs?
   bool isItaniumFamily() const {
 switch (getKind()) {
+case AppleARM64:
 case Fuchsia:
 case GenericAArch64:
 case GenericItanium:
 case GenericARM:
 case iOS:
-case iOS64:
 case WatchOS:
 case GenericMIPS:
 case WebAssembly:
@@ -168,12 +168,12 @@ class TargetCXXABI {
   /// Is this ABI an MSVC-compatible ABI?
   bool isMicrosoft() const {
 switch (getKind()) {
+case AppleARM64:
 case Fuchsia:
 case GenericAArch64:
 case GenericItanium:
 case GenericARM:
 case iOS:
-case iOS64:
 case WatchOS:
 case GenericMIPS:
 case WebAssembly:
@@ -200,6 +200,7 @@ class TargetCXXABI {
 case WebAssembly:
   // WebAssembly doesn't require any special alignment for member 
functions.
   return false;
+case AppleARM64:
 case Fuchsia:
 case GenericARM:
 case GenericAArch64:
@@ -209,7 +210,6 @@ class TargetCXXABI {
   //   special alignment and could therefore also return false.
 case GenericItanium:
 case iOS:
-case iOS64:
 case WatchOS:
 case Microsoft:
 case XL:
@@ -277,9 +277,9 @@ class TargetCXXABI {
   /// done on a generic Itanium platform.
   bool canKeyFunctionBeInline() const {
 switch (getKind()) {
+case AppleARM64:
 case Fuchsia:
 case GenericARM:
-case iOS64:
 case WebAssembly:
 case WatchOS:
   return false;
@@ -330,10 +330,10 @@ class TargetCXXABI {
 case XL:
   return UseTailPaddingUnlessPOD03;
 
-// iOS on ARM64 and WebAssembly use the C++11 POD rules.  They do not honor
+// AppleARM64 and WebAssembly use the C++11 POD rules.  They do not honor
 // the Itanium exception about classes with over-large bitfields.
+case AppleARM64:
 case Fuchsia:
-case iOS64:
 case WebAssembly:
 case WatchOS:
   return UseTailPaddingUnlessPOD11;

diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 67ee

[llvm-branch-commits] [clang] c00516d - Try to fix tests on Windows after 0cbf61be8be

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T10:55:05-05:00
New Revision: c00516d52054e31179ce921a35a3815032feed0f

URL: 
https://github.com/llvm/llvm-project/commit/c00516d52054e31179ce921a35a3815032feed0f
DIFF: 
https://github.com/llvm/llvm-project/commit/c00516d52054e31179ce921a35a3815032feed0f.diff

LOG: Try to fix tests on Windows after 0cbf61be8be

Added: 


Modified: 
clang/test/CodeGenCXX/weak-extern-typeinfo.cpp
clang/test/SemaCXX/typeid-ref.cpp

Removed: 




diff  --git a/clang/test/CodeGenCXX/weak-extern-typeinfo.cpp 
b/clang/test/CodeGenCXX/weak-extern-typeinfo.cpp
index 7f93c7297227..db94aed9c8c8 100644
--- a/clang/test/CodeGenCXX/weak-extern-typeinfo.cpp
+++ b/clang/test/CodeGenCXX/weak-extern-typeinfo.cpp
@@ -31,17 +31,17 @@ class V2 : public virtual V1 {
 void V1::foo() { }
 void V2::foo() { }
 
-// CHECK: @_ZTS1A = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTI1A = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTS1B = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTI1B = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTS1C = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTS2T1 = linkonce_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTI2T1 = linkonce_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTS1T = linkonce_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTI1T = linkonce_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTI1C = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTS2V1 = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTI2V1 = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTS2V2 = weak_odr {{(dso_local|hidden )?}}constant
-// CHECK: @_ZTI2V2 = weak_odr {{(dso_local|hidden )?}}constant
+// CHECK: @_ZTS1A = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTI1A = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTS1B = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTI1B = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTS1C = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTS2T1 = linkonce_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTI2T1 = linkonce_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTS1T = linkonce_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTI1T = linkonce_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTI1C = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTS2V1 = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTI2V1 = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTS2V2 = weak_odr {{(dso_local |hidden )?}}constant
+// CHECK: @_ZTI2V2 = weak_odr {{(dso_local |hidden )?}}constant

diff  --git a/clang/test/SemaCXX/typeid-ref.cpp 
b/clang/test/SemaCXX/typeid-ref.cpp
index 5a917df8ecf9..f788b04077ec 100644
--- a/clang/test/SemaCXX/typeid-ref.cpp
+++ b/clang/test/SemaCXX/typeid-ref.cpp
@@ -6,7 +6,7 @@ namespace std {
 struct X { };
 
 void f() {
-  // CHECK: @_ZTS1X = linkonce_odr {{(dso_local|hidden )?}}constant
-  // CHECK: @_ZTI1X = linkonce_odr {{(dso_local|hidden )?}}constant
+  // CHECK: @_ZTS1X = linkonce_odr {{(dso_local |hidden )?}}constant
+  // CHECK: @_ZTI1X = linkonce_odr {{(dso_local |hidden )?}}constant
   (void)typeid(X&);
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 498693a - [gn build] (manually) port 65049d16100af

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T13:43:19-05:00
New Revision: 498693a7b5de6702e1ee16e451c62e8d4427f152

URL: 
https://github.com/llvm/llvm-project/commit/498693a7b5de6702e1ee16e451c62e8d4427f152
DIFF: 
https://github.com/llvm/llvm-project/commit/498693a7b5de6702e1ee16e451c62e8d4427f152.diff

LOG: [gn build] (manually) port 65049d16100af

Added: 
llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn
llvm/utils/gn/secondary/llvm/lib/Frontend/OpenACC/BUILD.gn

Modified: 


Removed: 




diff  --git 
a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn
new file mode 100644
index ..91799ecd298f
--- /dev/null
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn
@@ -0,0 +1,21 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("ACC") {
+  visibility = [ ":acc_gen" ]
+  args = [ "-gen-directive-decl" ]
+  output_name = "ACC.h.inc"
+}
+
+tablegen("ACC.cpp") {
+  visibility = [ ":acc_gen" ]
+  args = [ "-gen-directive-gen" ]
+  output_name = "ACC.cpp.inc"
+  td_file = "ACC.td"
+}
+
+group("acc_gen") {
+  deps = [
+":ACC",
+":ACC.cpp",
+  ]
+}

diff  --git a/llvm/utils/gn/secondary/llvm/lib/Frontend/OpenACC/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/lib/Frontend/OpenACC/BUILD.gn
new file mode 100644
index ..51b8c269c281
--- /dev/null
+++ b/llvm/utils/gn/secondary/llvm/lib/Frontend/OpenACC/BUILD.gn
@@ -0,0 +1,18 @@
+import("//llvm/utils/TableGen/tablegen.gni")
+
+tablegen("ACCImpl") {
+  visibility = [ ":OpenACC" ]
+  args = [ "-gen-directive-impl" ]
+  td_file = "//llvm/include/llvm/Frontend/OpenACC/ACC.td"
+  output_name = "ACC.cpp"
+}
+
+static_library("OpenACC") {
+  output_name = "LLVMFrontendOpenACC"
+  deps = [
+":ACCImpl",
+"//llvm/lib/Support",
+  ]
+  public_deps = [ "//llvm/include/llvm/Frontend/OpenACC:acc_gen" ]
+  sources = get_target_outputs(":ACCImpl")
+}



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] df8a792 - [gn build] (semi-manually) port cc8df90b037

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T13:43:19-05:00
New Revision: df8a79258fe75eea4ee5de6c972c08ec97aaead6

URL: 
https://github.com/llvm/llvm-project/commit/df8a79258fe75eea4ee5de6c972c08ec97aaead6
DIFF: 
https://github.com/llvm/llvm-project/commit/df8a79258fe75eea4ee5de6c972c08ec97aaead6.diff

LOG: [gn build] (semi-manually) port cc8df90b037

Added: 


Modified: 
llvm/utils/gn/secondary/llvm/unittests/Frontend/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/llvm/unittests/Frontend/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/unittests/Frontend/BUILD.gn
index c4500d8ddcb8..0a5031f23e72 100644
--- a/llvm/utils/gn/secondary/llvm/unittests/Frontend/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/unittests/Frontend/BUILD.gn
@@ -3,6 +3,7 @@ import("//llvm/utils/unittest/unittest.gni")
 unittest("LLVMFrontendTests") {
   deps = [
 "//llvm/lib/Analysis",
+"//llvm/lib/Frontend/OpenACC",
 "//llvm/lib/Frontend/OpenMP",
 "//llvm/lib/IR",
 "//llvm/lib/Passes",
@@ -10,6 +11,7 @@ unittest("LLVMFrontendTests") {
 "//llvm/lib/Testing/Support",
   ]
   sources = [
+"OpenACCTest.cpp",
 "OpenMPContextTest.cpp",
 "OpenMPIRBuilderTest.cpp",
 "OpenMPParsingTest.cpp",



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 7cb0a37 - [mac/lld] Implement -t

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T16:02:38-05:00
New Revision: 7cb0a373d1d7daa2cb72a8f19eeff44ccfb9d395

URL: 
https://github.com/llvm/llvm-project/commit/7cb0a373d1d7daa2cb72a8f19eeff44ccfb9d395
DIFF: 
https://github.com/llvm/llvm-project/commit/7cb0a373d1d7daa2cb72a8f19eeff44ccfb9d395.diff

LOG: [mac/lld] Implement -t

Goes well with `-why_load` to get an idea of load order.

Differential Revision: https://reviews.llvm.org/D92583

Added: 
lld/test/MachO/t.s

Modified: 
lld/MachO/Config.h
lld/MachO/Driver.cpp
lld/MachO/Driver.h
lld/MachO/DriverUtils.cpp
lld/MachO/InputFiles.cpp
lld/MachO/Options.td

Removed: 




diff  --git a/lld/MachO/Config.h b/lld/MachO/Config.h
index bc22680db58f..c13010717bfd 100644
--- a/lld/MachO/Config.h
+++ b/lld/MachO/Config.h
@@ -38,6 +38,7 @@ struct Configuration {
   bool staticLink = false;
   bool isPic = false;
   bool headerPadMaxInstallNames = false;
+  bool printEachFile = false;
   bool printWhyLoad = false;
   bool searchDylibsFirst = false;
   bool saveTemps = false;

diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index 9822ecdd9f2a..ffd274b33a88 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -262,7 +262,8 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
   MemoryBufferRef mbref = *buffer;
   InputFile *newFile = nullptr;
 
-  switch (identify_magic(mbref.getBuffer())) {
+  auto magic = identify_magic(mbref.getBuffer());
+  switch (magic) {
   case file_magic::archive: {
 std::unique_ptr file = CHECK(
 object::Archive::create(mbref), path + ": failed to parse archive");
@@ -275,8 +276,9 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
 for (const ArchiveMember &member : getArchiveMembers(*buffer)) {
   inputFiles.push_back(
   make(member.mbref, member.modTime, path));
-  printWhyLoad((forceLoadArchive ? "-force_load" : "-all_load"),
-   inputFiles.back());
+  printArchiveMemberLoad(
+  (forceLoadArchive ? "-force_load" : "-all_load"),
+  inputFiles.back());
 }
   }
 } else if (config->forceLoadObjC) {
@@ -293,7 +295,7 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
   if (hasObjCSection(member.mbref)) {
 inputFiles.push_back(
 make(member.mbref, member.modTime, path));
-printWhyLoad("-ObjC", inputFiles.back());
+printArchiveMemberLoad("-ObjC", inputFiles.back());
   }
 }
   }
@@ -320,8 +322,13 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
   default:
 error(path + ": unhandled file type");
   }
-  if (newFile)
+  if (newFile) {
+// printArchiveMemberLoad() prints both .a and .o names, so no need to
+// print the .a name here.
+if (config->printEachFile && magic != file_magic::archive)
+  lld::outs() << toString(newFile) << '\n';
 inputFiles.push_back(newFile);
+  }
   return newFile;
 }
 
@@ -640,6 +647,7 @@ bool macho::link(llvm::ArrayRef argsArr, bool 
canExitEarly,
   config->headerPad = args::getHex(args, OPT_headerpad, /*Default=*/32);
   config->headerPadMaxInstallNames =
   args.hasArg(OPT_headerpad_max_install_names);
+  config->printEachFile = args.hasArg(OPT_t);
   config->printWhyLoad = args.hasArg(OPT_why_load);
   config->outputType = getOutputType(args);
   config->runtimePaths = args::getStrings(args, OPT_rpath);

diff  --git a/lld/MachO/Driver.h b/lld/MachO/Driver.h
index db7c54c59966..d371ee531433 100644
--- a/lld/MachO/Driver.h
+++ b/lld/MachO/Driver.h
@@ -46,7 +46,7 @@ llvm::Optional 
makeDylibFromTAPI(llvm::MemoryBufferRef mbref,
 
 uint32_t getModTime(llvm::StringRef path);
 
-void printWhyLoad(StringRef reason, const InputFile *);
+void printArchiveMemberLoad(StringRef reason, const InputFile *);
 
 } // namespace macho
 } // namespace lld

diff  --git a/lld/MachO/DriverUtils.cpp b/lld/MachO/DriverUtils.cpp
index 9c09ff682286..9f06901d3847 100644
--- a/lld/MachO/DriverUtils.cpp
+++ b/lld/MachO/DriverUtils.cpp
@@ -187,9 +187,9 @@ uint32_t macho::getModTime(StringRef path) {
   return 0;
 }
 
-void macho::printWhyLoad(StringRef reason, const InputFile *f) {
-  if (!config->printWhyLoad)
-return;
-  lld::outs() << reason << " forced load of " << toString(f)
-  << '\n';
+void macho::printArchiveMemberLoad(StringRef reason, const InputFile *f) {
+  if (config->printEachFile)
+lld::outs() << toString(f) << '\n';
+  if (config->printWhyLoad)
+lld::outs() << reason << " forced load of " << toString(f) << '\n';
 }

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 7d601c120017..0c577bfd0785 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -628,7 +628,7 @@ void ArchiveFile::fetch(const object::Archive::Symbol &sym) 
{
 
   // ld64 does

[llvm-branch-commits] [lld] caa99e3 - try to fix t.s on Windows after 7cb0a373d1

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T16:42:08-05:00
New Revision: caa99e3f0a48d9d4a904c34acf210f57a13071c1

URL: 
https://github.com/llvm/llvm-project/commit/caa99e3f0a48d9d4a904c34acf210f57a13071c1
DIFF: 
https://github.com/llvm/llvm-project/commit/caa99e3f0a48d9d4a904c34acf210f57a13071c1.diff

LOG: try to fix t.s on Windows after 7cb0a373d1

Added: 


Modified: 
lld/test/MachO/t.s

Removed: 




diff  --git a/lld/test/MachO/t.s b/lld/test/MachO/t.s
index 64e6f5972cf2..95b312bf51f5 100644
--- a/lld/test/MachO/t.s
+++ b/lld/test/MachO/t.s
@@ -12,7 +12,7 @@
 
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos -o %t/main.o %t/main.s
 
-# RUN: %lld %t/main.o %t/baz.o %t/bar.a %t/libfoo.dylib -lSystem -o /dev/null 
-t | FileCheck -DPATH='%:t' %s
+# RUN: %lld %t/main.o %t/baz.o %t/bar.a %t/libfoo.dylib -lSystem -o /dev/null 
-t | FileCheck -DPATH='%t' %s
 
 # CHECK-DAG: bar.a(bar.o)
 # CHECK-DAG: [[PATH]]/main.o



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 32b7d0f - try more to fix t.s on Windows after 7cb0a373d1

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T18:06:34-05:00
New Revision: 32b7d0f5e160d7687ff6dfcf4c554914cffa3d97

URL: 
https://github.com/llvm/llvm-project/commit/32b7d0f5e160d7687ff6dfcf4c554914cffa3d97
DIFF: 
https://github.com/llvm/llvm-project/commit/32b7d0f5e160d7687ff6dfcf4c554914cffa3d97.diff

LOG: try more to fix t.s on Windows after 7cb0a373d1

Added: 


Modified: 
lld/test/MachO/t.s

Removed: 




diff  --git a/lld/test/MachO/t.s b/lld/test/MachO/t.s
index 95b312bf51f5..7ff97dacdf92 100644
--- a/lld/test/MachO/t.s
+++ b/lld/test/MachO/t.s
@@ -18,7 +18,7 @@
 # CHECK-DAG: [[PATH]]/main.o
 # CHECK-DAG: [[PATH]]/baz.o
 # CHECK-DAG: [[PATH]]/libfoo.dylib
-# CHECK-DAG: {{.*}}/usr/lib/libSystem.tbd
+# CHECK-DAG: {{.*}}/usr/lib{{[/\\]}}libSystem.tbd
 
 #--- foo.s
 .globl __Z3foo



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 3058526 - [mac/lld] Run tests with -fatal_warnings by default

2020-12-03 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-03T21:23:47-05:00
New Revision: 305852686bf52037f81c0582400ceddb5e8844b3

URL: 
https://github.com/llvm/llvm-project/commit/305852686bf52037f81c0582400ceddb5e8844b3
DIFF: 
https://github.com/llvm/llvm-project/commit/305852686bf52037f81c0582400ceddb5e8844b3.diff

LOG: [mac/lld] Run tests with -fatal_warnings by default

This helps us catch cases where we add support for a flag but forget to
remove HelpHidden from Options.td.

More explicit alternative to D92455

Differential Revision: https://reviews.llvm.org/D92575

Added: 


Modified: 
lld/test/MachO/fatal-warnings.s
lld/test/MachO/lit.local.cfg
lld/test/MachO/load-commands.s
lld/test/MachO/x86-64-reloc-unsigned.s

Removed: 




diff  --git a/lld/test/MachO/fatal-warnings.s b/lld/test/MachO/fatal-warnings.s
index 4ab5589cde08..ae08a1367868 100644
--- a/lld/test/MachO/fatal-warnings.s
+++ b/lld/test/MachO/fatal-warnings.s
@@ -1,10 +1,10 @@
 # REQUIRES: x86
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t1.o
 
-# RUN: %lld %t1.o -o /dev/null -single_module 2>&1 \
+# RUN: %no_fatal_warnings_lld %t1.o -o /dev/null -single_module 2>&1 \
 # RUN: | FileCheck -check-prefix=WARNING %s
-# RUN: not %lld %t1.o -fatal_warnings -o /dev/null -single_module 2>&1 \
-# RUN: | FileCheck -check-prefix=ERROR %s
+# RUN: not %no_fatal_warnings_lld %t1.o -fatal_warnings -o /dev/null \
+# RUN: -single_module 2>&1 | FileCheck -check-prefix=ERROR %s
 
 # ERROR: error: Option `-single_module' is deprecated
 # WARNING: warning: Option `-single_module' is deprecated

diff  --git a/lld/test/MachO/lit.local.cfg b/lld/test/MachO/lit.local.cfg
index 90ee9117cbad..64d28802068b 100644
--- a/lld/test/MachO/lit.local.cfg
+++ b/lld/test/MachO/lit.local.cfg
@@ -2,5 +2,7 @@
 
 import os
 
-config.substitutions.append(('%lld', 'lld -flavor darwinnew -syslibroot ' +
-  os.path.join(config.test_source_root, "MachO", "Inputs", "MacOSX.sdk")))
+lld = ('lld -flavor darwinnew -syslibroot ' +
+os.path.join(config.test_source_root, "MachO", "Inputs", "MacOSX.sdk"))
+config.substitutions.append(('%lld', lld + ' -fatal_warnings'))
+config.substitutions.append(('%no_fatal_warnings_lld', lld))

diff  --git a/lld/test/MachO/load-commands.s b/lld/test/MachO/load-commands.s
index abeefc4043e1..0ee9edbb3d50 100644
--- a/lld/test/MachO/load-commands.s
+++ b/lld/test/MachO/load-commands.s
@@ -2,9 +2,9 @@
 # RUN: rm -rf %t && mkdir -p %t
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o
 # RUN: %lld -o %t/executable %t/test.o
-# RUN: %lld -fatal_warnings -execute -o %t/explicit-executable %t/test.o
-# RUN: %lld -fatal_warnings -bundle -o %t/bundle %t/test.o
-# RUN: %lld -fatal_warnings -dylib -o %t/dylib %t/test.o
+# RUN: %lld -execute -o %t/explicit-executable %t/test.o
+# RUN: %lld -bundle -o %t/bundle %t/test.o
+# RUN: %lld -dylib -o %t/dylib %t/test.o
 
 ## These load commands should be in every final output binary.
 # COMMON-DAG: cmd LC_DYLD_INFO_ONLY

diff  --git a/lld/test/MachO/x86-64-reloc-unsigned.s 
b/lld/test/MachO/x86-64-reloc-unsigned.s
index c6e5eb665739..f1afc0cb7043 100644
--- a/lld/test/MachO/x86-64-reloc-unsigned.s
+++ b/lld/test/MachO/x86-64-reloc-unsigned.s
@@ -3,11 +3,11 @@
 # RUN: %lld -o %t %t.o
 # RUN: llvm-objdump --macho --rebase --full-contents %t | FileCheck %s
 
-# RUN: %lld -fatal_warnings -pie -o %t-pie %t.o
+# RUN: %lld -pie -o %t-pie %t.o
 # RUN: llvm-objdump --macho --rebase %t-pie | FileCheck %s --check-prefix=PIE
-# RUN: %lld -fatal_warnings -pie -no_pie -o %t-no-pie %t.o
+# RUN: %lld -pie -no_pie -o %t-no-pie %t.o
 # RUN: llvm-objdump --macho --rebase %t-no-pie | FileCheck %s 
--check-prefix=NO-PIE
-# RUN: %lld -fatal_warnings -no_pie -pie -o %t-no-pie %t.o
+# RUN: %lld -no_pie -pie -o %t-no-pie %t.o
 # RUN: llvm-objdump --macho --rebase %t-no-pie | FileCheck %s 
--check-prefix=NO-PIE
 
 # RUN: %lld -platform_version macos 10.6.0 11.0 -o %t-pie %t.o



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] 16b1f6e - [mac/lld] Add support for the LC_LINKER_OPTION load command in o files

2020-12-04 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-04T08:46:53-05:00
New Revision: 16b1f6e3858b7082ae9f8eea65aff8a04c692099

URL: 
https://github.com/llvm/llvm-project/commit/16b1f6e3858b7082ae9f8eea65aff8a04c692099
DIFF: 
https://github.com/llvm/llvm-project/commit/16b1f6e3858b7082ae9f8eea65aff8a04c692099.diff

LOG: [mac/lld] Add support for the LC_LINKER_OPTION load command in o files

clang puts `-framework CoreFoundation` in this load command for files
that use @available / __builtin_available. Without support for this,
binaries that don't explicitly link to CoreFoundation fail to link.

Differential Revision: https://reviews.llvm.org/D92624

Added: 
lld/test/MachO/lc-linker-option.ll

Modified: 
lld/MachO/Driver.cpp
lld/MachO/Driver.h
lld/MachO/InputFiles.cpp

Removed: 




diff  --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp
index ffd274b33a88..72ef1b28ed58 100644
--- a/lld/MachO/Driver.cpp
+++ b/lld/MachO/Driver.cpp
@@ -332,6 +332,59 @@ static InputFile *addFile(StringRef path, bool 
forceLoadArchive) {
   return newFile;
 }
 
+static void addLibrary(StringRef name, bool isWeak) {
+  if (Optional path = findLibrary(name)) {
+auto *dylibFile = dyn_cast_or_null(addFile(*path, false));
+if (isWeak && dylibFile)
+  dylibFile->forceWeakImport = true;
+return;
+  }
+  error("library not found for -l" + name);
+}
+
+static void addFramework(StringRef name, bool isWeak) {
+  if (Optional path = findFramework(name)) {
+auto *dylibFile = dyn_cast_or_null(addFile(*path, false));
+if (isWeak && dylibFile)
+  dylibFile->forceWeakImport = true;
+return;
+  }
+  error("framework not found for -framework " + name);
+}
+
+// Parses LC_LINKER_OPTION contents, which can add additional command line 
flags.
+void macho::parseLCLinkerOption(InputFile* f, unsigned argc, StringRef data) {
+  SmallVector argv;
+  size_t offset = 0;
+  for (unsigned i = 0; i < argc && offset < data.size(); ++i) {
+argv.push_back(data.data() + offset);
+offset += strlen(data.data() + offset) + 1;
+  }
+  if (argv.size() != argc || offset > data.size())
+fatal(toString(f) + ": invalid LC_LINKER_OPTION");
+
+  MachOOptTable table;
+  unsigned missingIndex, missingCount;
+  opt::InputArgList args = table.ParseArgs(argv, missingIndex, missingCount);
+  if (missingCount)
+fatal(Twine(args.getArgString(missingIndex)) + ": missing argument");
+  for (auto *arg : args.filtered(OPT_UNKNOWN))
+error("unknown argument: " + arg->getAsString(args));
+
+  for (auto *arg : args) {
+switch (arg->getOption().getID()) {
+case OPT_l:
+  addLibrary(arg->getValue(), false);
+  break;
+case OPT_framework:
+  addFramework(arg->getValue(), false);
+  break;
+default:
+  error(arg->getSpelling() + " is not allowed in LC_LINKER_OPTION");
+}
+  }
+}
+
 static void addFileList(StringRef path) {
   Optional buffer = readFile(path);
   if (!buffer)
@@ -707,29 +760,13 @@ bool macho::link(llvm::ArrayRef argsArr, 
bool canExitEarly,
   addFile(arg->getValue(), true);
   break;
 case OPT_l:
-case OPT_weak_l: {
-  StringRef name = arg->getValue();
-  if (Optional path = findLibrary(name)) {
-auto *dylibFile = dyn_cast_or_null(addFile(*path, false));
-if (opt.getID() == OPT_weak_l && dylibFile)
-  dylibFile->forceWeakImport = true;
-break;
-  }
-  error("library not found for -l" + name);
+case OPT_weak_l:
+  addLibrary(arg->getValue(), opt.getID() == OPT_weak_l);
   break;
-}
 case OPT_framework:
-case OPT_weak_framework: {
-  StringRef name = arg->getValue();
-  if (Optional path = findFramework(name)) {
-auto *dylibFile = dyn_cast_or_null(addFile(*path, false));
-if (opt.getID() == OPT_weak_framework && dylibFile)
-  dylibFile->forceWeakImport = true;
-break;
-  }
-  error("framework not found for -framework " + name);
+case OPT_weak_framework:
+  addFramework(arg->getValue(), opt.getID() == OPT_weak_framework);
   break;
-}
 case OPT_platform_version:
   handlePlatformVersion(arg);
   break;

diff  --git a/lld/MachO/Driver.h b/lld/MachO/Driver.h
index d371ee531433..9a6a05af0e0d 100644
--- a/lld/MachO/Driver.h
+++ b/lld/MachO/Driver.h
@@ -36,6 +36,8 @@ enum {
 #undef OPTION
 };
 
+void parseLCLinkerOption(InputFile*, unsigned argc, StringRef data);
+
 std::string createResponseFile(const llvm::opt::InputArgList &args);
 
 // Check for both libfoo.dylib and libfoo.tbd (in that order).

diff  --git a/lld/MachO/InputFiles.cpp b/lld/MachO/InputFiles.cpp
index 0c577bfd0785..1339152901ce 100644
--- a/lld/MachO/InputFiles.cpp
+++ b/lld/MachO/InputFiles.cpp
@@ -383,6 +383,13 @@ ObjFile::ObjFile(MemoryBufferRef mb, uint32_t modTime, 
StringRef archiveName)
   auto *buf = reinterpret_cast(mb.getBufferStart());
   auto *hdr = reinterpret_cast(mb.ge

[llvm-branch-commits] [lld] c8974af - fix typos to cycle bots

2020-12-04 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-04T10:18:44-05:00
New Revision: c8974af1645587c4ee012c0ae43fe384c7e1c9ac

URL: 
https://github.com/llvm/llvm-project/commit/c8974af1645587c4ee012c0ae43fe384c7e1c9ac
DIFF: 
https://github.com/llvm/llvm-project/commit/c8974af1645587c4ee012c0ae43fe384c7e1c9ac.diff

LOG: fix typos to cycle bots

Added: 


Modified: 
lld/COFF/DebugTypes.cpp

Removed: 




diff  --git a/lld/COFF/DebugTypes.cpp b/lld/COFF/DebugTypes.cpp
index 029da969957e..9db61fc63bcd 100644
--- a/lld/COFF/DebugTypes.cpp
+++ b/lld/COFF/DebugTypes.cpp
@@ -647,7 +647,7 @@ void TpiSource::mergeTypeRecord(TypeIndex curIndex, CVType 
ty) {
   merged.recHashes.push_back(pdbHash);
 
   // Retain a mapping from PDB function id to PDB function type. This mapping 
is
-  // used during symbol procesing to rewrite S_GPROC32_ID symbols to S_GPROC32
+  // used during symbol processing to rewrite S_GPROC32_ID symbols to S_GPROC32
   // symbols.
   if (ty.kind() == LF_FUNC_ID || ty.kind() == LF_MFUNC_ID) {
 bool success = ty.length() >= 12;
@@ -732,7 +732,7 @@ void TypeServerSource::loadGHashes() {
 return;
   Expected expectedIpi = pdbFile.getPDBIpiStream();
   if (auto e = expectedIpi.takeError())
-fatal("error retreiving IPI stream: " + toString(std::move(e)));
+fatal("error retrieving IPI stream: " + toString(std::move(e)));
   ipiSrc->assignGHashesFromVector(
   GloballyHashedType::hashIds(expectedIpi->typeArray(), ghashes));
 



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [lld] feadc37 - [lld/mac] Make X86_64::getImplicitAddend not do heap allocations

2020-12-07 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-07T09:23:51-05:00
New Revision: feadc3798d9ab123057a7a1064897188ac8de934

URL: 
https://github.com/llvm/llvm-project/commit/feadc3798d9ab123057a7a1064897188ac8de934
DIFF: 
https://github.com/llvm/llvm-project/commit/feadc3798d9ab123057a7a1064897188ac8de934.diff

LOG: [lld/mac] Make X86_64::getImplicitAddend not do heap allocations

Speeds up linking Chromium's base_unittests almost 10%. According to ministat:

N   Min   MaxMedian   AvgStddev
x   50.721932890.730731960.725608110.72565799  0.0032265649
+   50.640695810.671731950.658763890.65796089   0.011349451
Difference at 95.0% confidence
-0.0676971 +/- 0.0121682
-9.32906% +/- 1.67685%
(Student's t, pooled s = 0.00834328)

Differential Revision: https://reviews.llvm.org/D92734

Added: 


Modified: 
lld/MachO/Arch/X86_64.cpp

Removed: 




diff  --git a/lld/MachO/Arch/X86_64.cpp b/lld/MachO/Arch/X86_64.cpp
index 19e62a919caf..7f4024cc998d 100644
--- a/lld/MachO/Arch/X86_64.cpp
+++ b/lld/MachO/Arch/X86_64.cpp
@@ -52,9 +52,8 @@ static std::string getErrorLocation(MemoryBufferRef mb, const 
section_64 &sec,
 
 static void validateLength(MemoryBufferRef mb, const section_64 &sec,
const relocation_info &rel,
-   const std::vector &validLengths) {
-  if (std::find(validLengths.begin(), validLengths.end(), rel.r_length) !=
-  validLengths.end())
+   ArrayRef validLengths) {
+  if (find(validLengths, rel.r_length) != validLengths.end())
 return;
 
   std::string msg = getErrorLocation(mb, sec, rel) + ": relocations of type " +



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] b570f82 - docs: Add pointer to cmake caches for PGO

2020-12-07 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-07T15:55:26-05:00
New Revision: b570f82f43a74fc842b9fd7f03bf0eca18fc9474

URL: 
https://github.com/llvm/llvm-project/commit/b570f82f43a74fc842b9fd7f03bf0eca18fc9474
DIFF: 
https://github.com/llvm/llvm-project/commit/b570f82f43a74fc842b9fd7f03bf0eca18fc9474.diff

LOG: docs: Add pointer to cmake caches for PGO

Also add a link to end-user PGO documentation.

Differential Revision: https://reviews.llvm.org/D92768

Added: 


Modified: 
llvm/docs/HowToBuildWithPGO.rst
llvm/utils/collect_and_build_with_pgo.py

Removed: 




diff  --git a/llvm/docs/HowToBuildWithPGO.rst b/llvm/docs/HowToBuildWithPGO.rst
index a1f387745474..617aadc5dfe3 100644
--- a/llvm/docs/HowToBuildWithPGO.rst
+++ b/llvm/docs/HowToBuildWithPGO.rst
@@ -12,6 +12,14 @@ decrease overall compile time by 20%.
 This guide walks you through how to build Clang with PGO, though it also 
applies
 to other subprojects, such as LLD.
 
+If you want to build other software with PGO, see the `end-user documentation
+for PGO 
`_.
+
+
+Using preconfigured CMake caches
+
+
+See https://llvm.org/docs/AdvancedBuilds.html#multi-stage-pgo
 
 Using the script
 
@@ -62,8 +70,8 @@ This is configurable in the script itself.
 Building Clang with PGO
 ===
 
-If you prefer to not use the script, this briefly goes over how to build
-Clang/LLVM with PGO.
+If you prefer to not use the script or the cmake cache, this briefly goes over
+how to build Clang/LLVM with PGO.
 
 First, you should have at least LLVM, Clang, and compiler-rt checked out
 locally.

diff  --git a/llvm/utils/collect_and_build_with_pgo.py 
b/llvm/utils/collect_and_build_with_pgo.py
index e9f82617f4e9..38247534cf9c 100755
--- a/llvm/utils/collect_and_build_with_pgo.py
+++ b/llvm/utils/collect_and_build_with_pgo.py
@@ -10,6 +10,9 @@
 
 This is a total of four clean builds of clang (by default). This may take a
 while. :)
+
+This scripts duplicates 
https://llvm.org/docs/AdvancedBuilds.html#multi-stage-pgo
+Eventually, it will be updated to instead call the cmake cache mentioned there.
 """
 
 import argparse



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 9935b0f - [gn build] (manually) port db61b1844e11f

2020-12-08 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-08T11:45:43-05:00
New Revision: 9935b0fc9023c071c07523350b4f343d22e478f6

URL: 
https://github.com/llvm/llvm-project/commit/9935b0fc9023c071c07523350b4f343d22e478f6
DIFF: 
https://github.com/llvm/llvm-project/commit/9935b0fc9023c071c07523350b4f343d22e478f6.diff

LOG: [gn build] (manually) port db61b1844e11f

Added: 


Modified: 
llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn

Removed: 




diff  --git a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn 
b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
index 0292479ecd66..e7b532f57dab 100644
--- a/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/lib/builtins/BUILD.gn
@@ -197,6 +197,7 @@ static_library("builtins") {
 sources += [
   "comparetf2.c",
   "extenddftf2.c",
+  "extendhftf2.c",
   "extendsftf2.c",
   "fixtfdi.c",
   "fixtfsi.c",
@@ -212,6 +213,7 @@ static_library("builtins") {
   "floatuntitf.c",
   "multc3.c",
   "trunctfdf2.c",
+  "trunctfhf2.c",
   "trunctfsf2.c",
 ]
   }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] de4f551 - Revert "[clangd] Extract per-dir CDB cache to its own threadsafe class. NFC"

2020-12-09 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-09T20:11:19-05:00
New Revision: de4f5519015cc97f28718d90cc6dac73c0a15161

URL: 
https://github.com/llvm/llvm-project/commit/de4f5519015cc97f28718d90cc6dac73c0a15161
DIFF: 
https://github.com/llvm/llvm-project/commit/de4f5519015cc97f28718d90cc6dac73c0a15161.diff

LOG: Revert "[clangd] Extract per-dir CDB cache to its own threadsafe class. 
NFC"

This reverts commit 634a377bd8cbaa515a58295cfd85dcb6a21381c1.
Breaks tests on Windows, see https://reviews.llvm.org/D92381#2443407

Added: 


Modified: 
clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
clang-tools-extra/clangd/GlobalCompilationDatabase.h

Removed: 




diff  --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp 
b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
index f867920c9d1f..23e8c9fe716d 100644
--- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
+++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp
@@ -16,13 +16,11 @@
 #include "llvm/ADT/None.h"
 #include "llvm/ADT/Optional.h"
 #include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/ScopeExit.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FileUtilities.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
-#include 
 #include 
 #include 
 #include 
@@ -60,117 +58,10 @@ GlobalCompilationDatabase::getFallbackCommand(PathRef 
File) const {
   return Cmd;
 }
 
-// Loads and caches the CDB from a single directory.
-//
-// This class is threadsafe, which is to say we have independent locks for each
-// directory we're searching for a CDB.
-// Loading is deferred until first access.
-//
-// The DirectoryBasedCDB keeps a map from path => DirectoryCache.
-// Typical usage is to:
-//  - 1) determine all the paths that might be searched
-//  - 2) acquire the map lock and get-or-create all the DirectoryCache entries
-//  - 3) release the map lock and query the caches as desired
-//
-// FIXME: this should revalidate the cache sometimes
-// FIXME: IO should go through a VFS
-class DirectoryBasedGlobalCompilationDatabase::DirectoryCache {
-  // Absolute canonical path that we're the cache for. (Not case-folded).
-  const std::string Path;
-
-  // True if we've looked for a CDB here and found none.
-  // (This makes it possible for get() to return without taking a lock)
-  // FIXME: this should have an expiry time instead of lasting forever.
-  std::atomic FinalizedNoCDB = {false};
-
-  // Guards following cache state.
-  std::mutex Mu;
-  // Has cache been filled from disk? FIXME: this should be an expiry time.
-  bool CachePopulated = false;
-  // Whether a new CDB has been loaded but not broadcast yet.
-  bool NeedsBroadcast = false;
-  // Last loaded CDB, meaningful if CachePopulated is set.
-  // shared_ptr so we can overwrite this when callers are still using the CDB.
-  std::shared_ptr CDB;
-
-public:
-  DirectoryCache(llvm::StringRef Path) : Path(Path) {
-assert(llvm::sys::path::is_absolute(Path));
-  }
-
-  // Get the CDB associated with this directory.
-  // ShouldBroadcast:
-  //  - as input, signals whether the caller is willing to broadcast a
-  //newly-discovered CDB. (e.g. to trigger background indexing)
-  //  - as output, signals whether the caller should do so.
-  // (If a new CDB is discovered and ShouldBroadcast is false, we mark the
-  // CDB as needing broadcast, and broadcast it next time we can).
-  std::shared_ptr
-  get(bool &ShouldBroadcast) {
-// Fast path for common case without taking lock.
-if (FinalizedNoCDB.load()) {
-  ShouldBroadcast = false;
-  return nullptr;
-}
-std::lock_guard Lock(Mu);
-auto RequestBroadcast = llvm::make_scope_exit([&, OldCDB(CDB.get())] {
-  // If we loaded a new CDB, it should be broadcast at some point.
-  if (CDB != nullptr && CDB.get() != OldCDB)
-NeedsBroadcast = true;
-  else if (CDB == nullptr) // nothing to broadcast anymore!
-NeedsBroadcast = false;
-  // If we have something to broadcast, then do so iff allowed.
-  if (!ShouldBroadcast)
-return;
-  ShouldBroadcast = NeedsBroadcast;
-  NeedsBroadcast = false;
-});
-
-// For now, we never actually attempt to revalidate a populated cache.
-if (CachePopulated)
-  return CDB;
-assert(CDB == nullptr);
-
-load();
-CachePopulated = true;
-
-if (!CDB)
-  FinalizedNoCDB.store(true);
-return CDB;
-  }
-
-  llvm::StringRef path() const { return Path; }
-
-private:
-  // Updates `CDB` from disk state.
-  void load() {
-std::string Error; // ignored, because it's often "didn't find anything".
-CDB = tooling::CompilationDatabase::loadFromDirectory(Path, Error);
-if (!CDB) {
-  // Fallback: check for $src/build, the conventional CMake build root.
-  // Probe existence first to avoid each plugin doing IO if it doesn't
-  // exist.

[llvm-branch-commits] [lld] 9d6177c - [lld/mac] Use xxhash instead of MD5 for computing the UUID

2020-12-09 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-09T21:06:17-05:00
New Revision: 9d6177c2a526d503308426b635ec818f92cd037a

URL: 
https://github.com/llvm/llvm-project/commit/9d6177c2a526d503308426b635ec818f92cd037a
DIFF: 
https://github.com/llvm/llvm-project/commit/9d6177c2a526d503308426b635ec818f92cd037a.diff

LOG: [lld/mac] Use xxhash instead of MD5 for computing the UUID

15% faster for linking Chromium's base_unittests.txt, according to ministat:

```
N   Min   MaxMedian   AvgStddev
x  10  0.6502130.692875860.657933950.66127126   0.012365407
+  100.549937010.590069060.558855060.56146643   0.013215349
Difference at 95.0% confidence
-0.0998048 +/- 0.0120244
-15.0929% +/- 1.81838%
(Student's t, pooled s = 0.0127974)
```

And matches what we do on the other ports.

Differential Revision: https://reviews.llvm.org/D92736

Added: 


Modified: 
lld/MachO/Writer.cpp

Removed: 




diff  --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index fc4e36c9eb5e..45ff11e7c443 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -24,9 +24,9 @@
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/LEB128.h"
-#include "llvm/Support/MD5.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/xxhash.h"
 
 #include 
 
@@ -368,8 +368,23 @@ class LCUuid : public LoadCommand {
 uuidBuf = c->uuid;
   }
 
-  void writeUuid(const std::array &uuid) const {
-memcpy(uuidBuf, uuid.data(), uuid.size());
+  void writeUuid(uint64_t digest) const {
+// xxhash only gives us 8 bytes, so put some fixed data in the other half.
+static_assert(sizeof(uuid_command::uuid) == 16, "unexpected uuid size");
+memcpy(uuidBuf, "LLD\xa1UU1D", 8);
+memcpy(uuidBuf + 8, &digest, 8);
+
+// RFC 4122 conformance. We need to fix 4 bits in byte 6 and 2 bits in
+// byte 8. Byte 6 is already fine due to the fixed data we put in. We don't
+// want to lose bits of the digest in byte 8, so swap that with a byte of
+// fixed data that happens to have the right bits set.
+std::swap(uuidBuf[3], uuidBuf[8]);
+
+// Claim that this is an MD5-based hash. It isn't, but this signals that
+// this is not a time-based and not a random hash. MD5 seems like the least
+// bad lie we can put here.
+assert((uuidBuf[6] & 0xf0) == 0x30 && "See RFC 4122 Sections 4.2.2, 
4.1.3");
+assert((uuidBuf[8] & 0xc0) == 0x80 && "See RFC 4122 Section 4.2.2");
   }
 
   mutable uint8_t *uuidBuf;
@@ -662,18 +677,9 @@ void Writer::writeSections() {
 }
 
 void Writer::writeUuid() {
-  MD5 hash;
-  const auto *bufStart = reinterpret_cast(buffer->getBufferStart());
-  const auto *bufEnd = reinterpret_cast(buffer->getBufferEnd());
-  hash.update(StringRef(bufStart, bufEnd - bufStart));
-  MD5::MD5Result result;
-  hash.final(result);
-  // Conform to UUID version 4 & 5 as specified in RFC 4122:
-  // 1. Set the version field to indicate that this is an MD5-based UUID.
-  result.Bytes[6] = (result.Bytes[6] & 0xf) | 0x30;
-  // 2. Set the two MSBs of uuid_t::clock_seq_hi_and_reserved to zero and one.
-  result.Bytes[8] = (result.Bytes[8] & 0x3f) | 0x80;
-  uuidCommand->writeUuid(result.Bytes);
+  uint64_t digest =
+  xxHash64({buffer->getBufferStart(), buffer->getBufferEnd()});
+  uuidCommand->writeUuid(digest);
 }
 
 void Writer::run() {



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] 985739e - [gn build] fix build after a7b2847216b4f7

2020-12-10 Thread Nico Weber via llvm-branch-commits

Author: Nico Weber
Date: 2020-12-10T10:28:48-05:00
New Revision: 985739ec059d23d7478ea1eee5a14e8160658c1b

URL: 
https://github.com/llvm/llvm-project/commit/985739ec059d23d7478ea1eee5a14e8160658c1b
DIFF: 
https://github.com/llvm/llvm-project/commit/985739ec059d23d7478ea1eee5a14e8160658c1b.diff

LOG: [gn build] fix build after a7b2847216b4f7

Ports 6e42a417bacb since it's now needed, and undo an accidental
deletion from d69762c404ded while here (this part is not needed to fix
the build, it's just in the vicinity).

Added: 


Modified: 
llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn
llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn

Removed: 




diff  --git 
a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn
index acb545f41986..26c9b52a1660 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenACC/BUILD.gn
@@ -6,7 +6,7 @@ tablegen("ACC") {
   output_name = "ACC.h.inc"
 }
 
-tablegen("ACC.cpp") {
+tablegen("ACCcpp") {
   visibility = [ ":acc_gen" ]
   args = [ "-gen-directive-gen" ]
   output_name = "ACC.cpp.inc"
@@ -14,5 +14,8 @@ tablegen("ACC.cpp") {
 }
 
 group("acc_gen") {
-  deps = [ ":ACC" ]
+  deps = [
+":ACC",
+":ACCcpp",
+  ]
 }

diff  --git 
a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn 
b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
index a18f8db5f5eb..6fe62a0f5a71 100644
--- a/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
+++ b/llvm/utils/gn/secondary/llvm/include/llvm/Frontend/OpenMP/BUILD.gn
@@ -6,6 +6,13 @@ tablegen("OMP") {
   output_name = "OMP.h.inc"
 }
 
+tablegen("OMPcpp") {
+  visibility = [ ":public_tablegen" ]
+  args = [ "-gen-directive-gen" ]
+  output_name = "OMP.cpp.inc"
+  td_file = "OMP.td"
+}
+
 # Groups all tablegen() calls that create .inc files that are included in
 # Frontent/OpenMP's public headers (just one so far).
 # //llvm/lib/Frontend/OpenMP has this as a public_dep, so targets depending on
@@ -14,5 +21,6 @@ group("public_tablegen") {
   public_deps = [
 # Frontend/OpenMP's public headers include OMP.h.inc.
 ":OMP",
+":OMPcpp",
   ]
 }



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


  1   2   >