[PATCH] D151589: [lld] add context-sensitive PGO options for MachO

2023-05-30 Thread Jez Ng via Phabricator via cfe-commits
int3 added inline comments.



Comment at: lld/test/MachO/cspgo-gen.ll:13
+
+define void @_start() {
+entry:

doesn't *really* matter since you are creating a dylib, but `lld-macho` doesn't 
actually treat `_start` as a special symbol (only `main`). maybe rename to 
`foo` to be less misleading?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151589/new/

https://reviews.llvm.org/D151589

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


[PATCH] D144999: [Clang][MC][MachO]Only emits compact-unwind format for "canonical" personality symbols. For the rest, use DWARFs.

2023-05-17 Thread Jez Ng via Phabricator via cfe-commits
int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

lgtm




Comment at: lld/MachO/UnwindInfoSection.cpp:346
 
-// If we have DWARF unwind info, create a CU entry that points to it.
+// If we have DWARF unwind info, set the DWARF encoding flag.
 if (d->unwindEntry->getName() == section_names::ehFrame) {

looks like the old comment can be retained


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144999/new/

https://reviews.llvm.org/D144999

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


[PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2023-03-23 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

I'm trying to add similar support to lld-macho, hence the question :)




Comment at: lld/COFF/LTO.cpp:183
+  [&](size_t task, const Twine ) {
+buf[task].first = moduleName.str();
 return std::make_unique(

Any reason why this doesn't instead store the module name in the 
`file_names[task]` vector that the cache callback uses? Are the task IDs not 
unique across each run of `ltoObj`, regardless of whether we end up using the 
cache or not?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137217/new/

https://reviews.llvm.org/D137217

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


[PATCH] D144638: [lit] Detect Consistent File Access Times

2023-02-23 Thread Jez Ng via Phabricator via cfe-commits
int3 added inline comments.



Comment at: llvm/utils/lit/lit/llvm/config.py:165
+#
+# This check hopefully detects both cases, and disables tests that require
+# consistent atime.

lenary wrote:
> jhenderson wrote:
> > Is "hopefully" really needed here?
> I'm hedging in this comment, in part because we're trying to find a race 
> condition experimentally, and also because this will cause lit to fatal error 
> before running any tests if `touch` exits non-zero for any reason. 
if we know for sure that NetBSD and Windows don't support this, why not 
hardcode those values in, and only try the experimental check otherwise?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144638/new/

https://reviews.llvm.org/D144638

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


[PATCH] D144482: [clang][docs] Document ThinLTO options for ld64.lld

2023-02-21 Thread Jez Ng via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
int3 marked an inline comment as done.
Closed by commit rGb0bf3e66d087: [clang][docs] Document ThinLTO options for 
ld64.lld (authored by int3).

Changed prior to commit:
  https://reviews.llvm.org/D144482?vs=499154=499205#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144482/new/

https://reviews.llvm.org/D144482

Files:
  clang/docs/ThinLTO.rst


Index: clang/docs/ThinLTO.rst
===
--- clang/docs/ThinLTO.rst
+++ clang/docs/ThinLTO.rst
@@ -118,7 +118,7 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
-- lld:
+- ld.lld, ld64.lld:
   ``-Wl,--thinlto-jobs=N``
 - lld-link:
   ``/opt:lldltojobs=N``
@@ -141,9 +141,10 @@
 
 - gold (as of LLVM 4.0):
   ``-Wl,-plugin-opt,cache-dir=/path/to/cache``
-- ld64 (support in clang 3.9 and Xcode 8):
+- ld64 (supported since clang 3.9 and Xcode 8) and Mach-O ld64.lld (as of LLVM
+  15.0):
   ``-Wl,-cache_path_lto,/path/to/cache``
-- ELF lld (as of LLVM 5.0):
+- ELF ld.lld (as of LLVM 5.0):
   ``-Wl,--thinlto-cache-dir=/path/to/cache``
 - COFF lld-link (as of LLVM 6.0):
   ``/lldltocache:/path/to/cache``
@@ -152,14 +153,14 @@
 -
 
 To help keep the size of the cache under control, ThinLTO supports cache
-pruning. Cache pruning is supported with gold, ld64 and ELF and COFF lld, but
-currently only gold, ELF and COFF lld allow you to control the policy with a
-policy string. The cache policy must be specified with a linker option.
+pruning. Cache pruning is supported with gold, ld64, and lld, but currently 
only
+gold and lld allow you to control the policy with a policy string. The cache
+policy must be specified with a linker option.
 
 - gold (as of LLVM 6.0):
   ``-Wl,-plugin-opt,cache-policy=POLICY``
-- ELF lld (as of LLVM 5.0):
-  ``-Wl,--thinlto-cache-policy,POLICY``
+- ELF ld.lld (as of LLVM 5.0), Mach-O ld64.lld (as of LLVM 15.0):
+  ``-Wl,--thinlto-cache-policy=POLICY``
 - COFF lld-link (as of LLVM 6.0):
   ``/lldltocachepolicy:POLICY``
 


Index: clang/docs/ThinLTO.rst
===
--- clang/docs/ThinLTO.rst
+++ clang/docs/ThinLTO.rst
@@ -118,7 +118,7 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
-- lld:
+- ld.lld, ld64.lld:
   ``-Wl,--thinlto-jobs=N``
 - lld-link:
   ``/opt:lldltojobs=N``
@@ -141,9 +141,10 @@
 
 - gold (as of LLVM 4.0):
   ``-Wl,-plugin-opt,cache-dir=/path/to/cache``
-- ld64 (support in clang 3.9 and Xcode 8):
+- ld64 (supported since clang 3.9 and Xcode 8) and Mach-O ld64.lld (as of LLVM
+  15.0):
   ``-Wl,-cache_path_lto,/path/to/cache``
-- ELF lld (as of LLVM 5.0):
+- ELF ld.lld (as of LLVM 5.0):
   ``-Wl,--thinlto-cache-dir=/path/to/cache``
 - COFF lld-link (as of LLVM 6.0):
   ``/lldltocache:/path/to/cache``
@@ -152,14 +153,14 @@
 -
 
 To help keep the size of the cache under control, ThinLTO supports cache
-pruning. Cache pruning is supported with gold, ld64 and ELF and COFF lld, but
-currently only gold, ELF and COFF lld allow you to control the policy with a
-policy string. The cache policy must be specified with a linker option.
+pruning. Cache pruning is supported with gold, ld64, and lld, but currently only
+gold and lld allow you to control the policy with a policy string. The cache
+policy must be specified with a linker option.
 
 - gold (as of LLVM 6.0):
   ``-Wl,-plugin-opt,cache-policy=POLICY``
-- ELF lld (as of LLVM 5.0):
-  ``-Wl,--thinlto-cache-policy,POLICY``
+- ELF ld.lld (as of LLVM 5.0), Mach-O ld64.lld (as of LLVM 15.0):
+  ``-Wl,--thinlto-cache-policy=POLICY``
 - COFF lld-link (as of LLVM 6.0):
   ``/lldltocachepolicy:POLICY``
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D144482: [clang][docs] Document ThinLTO options for ld64.lld

2023-02-21 Thread Jez Ng via Phabricator via cfe-commits
int3 created this revision.
int3 added reviewers: lld-macho, tejohnson, lgrey.
Herald added subscribers: ormris, steven_wu, hiraditya, inglorion.
Herald added a project: All.
int3 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The LTO-cache-related flags were added here: D105922: [lld-macho] Add LTO cache 
support 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D144482

Files:
  clang/docs/ThinLTO.rst


Index: clang/docs/ThinLTO.rst
===
--- clang/docs/ThinLTO.rst
+++ clang/docs/ThinLTO.rst
@@ -118,7 +118,7 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
-- lld:
+- ld.lld, ld64.lld:
   ``-Wl,--thinlto-jobs=N``
 - lld-link:
   ``/opt:lldltojobs=N``
@@ -141,9 +141,10 @@
 
 - gold (as of LLVM 4.0):
   ``-Wl,-plugin-opt,cache-dir=/path/to/cache``
-- ld64 (support in clang 3.9 and Xcode 8):
+- ld64 (supported since clang 3.9 and Xcode 8) and Mach-O ld64.lld (as of LLVM
+  15.0):
   ``-Wl,-cache_path_lto,/path/to/cache``
-- ELF lld (as of LLVM 5.0):
+- ELF ld.lld (as of LLVM 5.0):
   ``-Wl,--thinlto-cache-dir=/path/to/cache``
 - COFF lld-link (as of LLVM 6.0):
   ``/lldltocache:/path/to/cache``
@@ -158,8 +159,8 @@
 
 - gold (as of LLVM 6.0):
   ``-Wl,-plugin-opt,cache-policy=POLICY``
-- ELF lld (as of LLVM 5.0):
-  ``-Wl,--thinlto-cache-policy,POLICY``
+- ELF ld.lld (as of LLVM 5.0), Mach-O ld64.lld (as of LLVM 15.0):
+  ``-Wl,--thinlto-cache-policy=POLICY``
 - COFF lld-link (as of LLVM 6.0):
   ``/lldltocachepolicy:POLICY``
 


Index: clang/docs/ThinLTO.rst
===
--- clang/docs/ThinLTO.rst
+++ clang/docs/ThinLTO.rst
@@ -118,7 +118,7 @@
   ``-Wl,-plugin-opt,jobs=N``
 - ld64:
   ``-Wl,-mllvm,-threads=N``
-- lld:
+- ld.lld, ld64.lld:
   ``-Wl,--thinlto-jobs=N``
 - lld-link:
   ``/opt:lldltojobs=N``
@@ -141,9 +141,10 @@
 
 - gold (as of LLVM 4.0):
   ``-Wl,-plugin-opt,cache-dir=/path/to/cache``
-- ld64 (support in clang 3.9 and Xcode 8):
+- ld64 (supported since clang 3.9 and Xcode 8) and Mach-O ld64.lld (as of LLVM
+  15.0):
   ``-Wl,-cache_path_lto,/path/to/cache``
-- ELF lld (as of LLVM 5.0):
+- ELF ld.lld (as of LLVM 5.0):
   ``-Wl,--thinlto-cache-dir=/path/to/cache``
 - COFF lld-link (as of LLVM 6.0):
   ``/lldltocache:/path/to/cache``
@@ -158,8 +159,8 @@
 
 - gold (as of LLVM 6.0):
   ``-Wl,-plugin-opt,cache-policy=POLICY``
-- ELF lld (as of LLVM 5.0):
-  ``-Wl,--thinlto-cache-policy,POLICY``
+- ELF ld.lld (as of LLVM 5.0), Mach-O ld64.lld (as of LLVM 15.0):
+  ``-Wl,--thinlto-cache-policy=POLICY``
 - COFF lld-link (as of LLVM 6.0):
   ``/lldltocachepolicy:POLICY``
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D137338: Fix dupe word typos

2022-11-03 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

lld/MachO changes lgtm




Comment at: lld/MachO/Driver.cpp:1386
 // ld64 does something really weird. It attempts to realign the value to 
the
-// page size, but assumes the the page size is 4K. This doesn't work with
+// page size, but assumes the page size is 4K. This doesn't work with
 // most of Apple's ARM64 devices, which use a page size of 16K. This means

"assumes that the page size" sounds more natural and is probably what was 
intended



Comment at: lld/MachO/UnwindInfoSection.cpp:576-577
 // entries by using the regular format. This can happen when there
-// are many unique encodings, and we we saturated the local
+// are many unique encodings, and we saturated the local
 // encoding table early.
 if (i < cuIndices.size() &&

I think we can reflow this paragraph to max the line length


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137338/new/

https://reviews.llvm.org/D137338

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


[PATCH] D129772: [clang] Document -femit-compact-unwind option in the User’s Manual

2022-07-14 Thread Jez Ng via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7dbfc4fc065d: [clang] Document -femit-compact-unwind option 
in the User’s Manual (authored by int3).

Changed prior to commit:
  https://reviews.llvm.org/D129772?vs=444740=444790#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129772/new/

https://reviews.llvm.org/D129772

Files:
  clang/docs/UsersManual.rst


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -843,6 +843,23 @@
 option tells Clang to put double-quotes around the entire filename, which
 is the convention used by NMake and Jom.
 
+.. option:: -femit-dwarf-unwind=
+
+  When to emit DWARF unwind (EH frame) info. This is a Mach-O-specific option.
+
+  Valid values are:
+
+  * ``no-compact-unwind`` - Only emit DWARF unwind when compact unwind 
encodings
+aren't available. This is the default for arm64.
+  * ``always`` - Always emit DWARF unwind regardless.
+  * ``default`` - Use the platform-specific default (``always`` for all
+non-arm64-platforms).
+
+``no-compact-unwind`` is a performance optimization -- Clang will emit smaller
+object files that are more quickly processed by the linker. This may cause
+binary compatibility issues on older x86_64 targets, however, so use it with
+caution.
+
 .. _configuration-files:
 
 Configuration files


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -843,6 +843,23 @@
 option tells Clang to put double-quotes around the entire filename, which
 is the convention used by NMake and Jom.
 
+.. option:: -femit-dwarf-unwind=
+
+  When to emit DWARF unwind (EH frame) info. This is a Mach-O-specific option.
+
+  Valid values are:
+
+  * ``no-compact-unwind`` - Only emit DWARF unwind when compact unwind encodings
+aren't available. This is the default for arm64.
+  * ``always`` - Always emit DWARF unwind regardless.
+  * ``default`` - Use the platform-specific default (``always`` for all
+non-arm64-platforms).
+
+``no-compact-unwind`` is a performance optimization -- Clang will emit smaller
+object files that are more quickly processed by the linker. This may cause
+binary compatibility issues on older x86_64 targets, however, so use it with
+caution.
+
 .. _configuration-files:
 
 Configuration files
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D129772: [clang] Document -femit-compact-unwind option in the User’s Manual

2022-07-14 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 444740.
int3 retitled this revision from "[clang] Document -femit-compact-unwind flag 
in the User’s Manual" to "[clang] Document -femit-compact-unwind option in the 
User’s Manual".
int3 added a comment.

option


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129772/new/

https://reviews.llvm.org/D129772

Files:
  clang/docs/UsersManual.rst


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -843,6 +843,23 @@
 option tells Clang to put double-quotes around the entire filename, which
 is the convention used by NMake and Jom.
 
+.. option:: -femit-dwarf-unwind=
+
+  When to emit DWARF unwind (EH frame) info. This is a Mach-O-specific option.
+
+  Valid values are:
+
+  * ``no-compact-unwind`` - Only emit DWARF unwind when compact unwind 
encodings
+aren't available. This is the default for AArch64.
+  * ``always`` - Always emit DWARF unwind regardless.
+  * ``default`` - Use the platform-specific default (``always`` for all
+non-AArch64-platforms).
+
+``no-compact-unwind`` is a performance optimization -- Clang will emit smaller
+object files that are more quickly processed by the linker. This may cause
+binary compatibility issues on older x86_64 targets, however, so use it with
+caution.
+
 .. _configuration-files:
 
 Configuration files


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -843,6 +843,23 @@
 option tells Clang to put double-quotes around the entire filename, which
 is the convention used by NMake and Jom.
 
+.. option:: -femit-dwarf-unwind=
+
+  When to emit DWARF unwind (EH frame) info. This is a Mach-O-specific option.
+
+  Valid values are:
+
+  * ``no-compact-unwind`` - Only emit DWARF unwind when compact unwind encodings
+aren't available. This is the default for AArch64.
+  * ``always`` - Always emit DWARF unwind regardless.
+  * ``default`` - Use the platform-specific default (``always`` for all
+non-AArch64-platforms).
+
+``no-compact-unwind`` is a performance optimization -- Clang will emit smaller
+object files that are more quickly processed by the linker. This may cause
+binary compatibility issues on older x86_64 targets, however, so use it with
+caution.
+
 .. _configuration-files:
 
 Configuration files
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D129772: [clang] Document -femit-compact-unwind flag in the User’s Manual

2022-07-14 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

@davide just adding you in case you have opinions on the wording around the 
bincompat issue


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129772/new/

https://reviews.llvm.org/D129772

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


[PATCH] D129772: [clang] Document -femit-compact-unwind flag in the User’s Manual

2022-07-14 Thread Jez Ng via Phabricator via cfe-commits
int3 created this revision.
int3 added reviewers: lld-macho, davide.
Herald added a project: All.
int3 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129772

Files:
  clang/docs/UsersManual.rst


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -843,6 +843,23 @@
 option tells Clang to put double-quotes around the entire filename, which
 is the convention used by NMake and Jom.
 
+.. option:: -femit-dwarf-unwind=
+
+  When to emit DWARF unwind (EH frame) info. This is a Mach-O-specific flag.
+
+  Valid values are:
+
+  * ``no-compact-unwind`` - Only emit DWARF unwind when compact unwind 
encodings
+aren't available. This is the default for AArch64.
+  * ``always`` - Always emit DWARF unwind regardless.
+  * ``default`` - Use the platform-specific default (``always`` for all
+non-AArch64-platforms).
+
+``no-compact-unwind`` is a performance optimization -- Clang will emit smaller
+object files that are more quickly processed by the linker. This may cause
+binary compatibility issues on older x86_64 targets, however, so use it with
+caution.
+
 .. _configuration-files:
 
 Configuration files


Index: clang/docs/UsersManual.rst
===
--- clang/docs/UsersManual.rst
+++ clang/docs/UsersManual.rst
@@ -843,6 +843,23 @@
 option tells Clang to put double-quotes around the entire filename, which
 is the convention used by NMake and Jom.
 
+.. option:: -femit-dwarf-unwind=
+
+  When to emit DWARF unwind (EH frame) info. This is a Mach-O-specific flag.
+
+  Valid values are:
+
+  * ``no-compact-unwind`` - Only emit DWARF unwind when compact unwind encodings
+aren't available. This is the default for AArch64.
+  * ``always`` - Always emit DWARF unwind regardless.
+  * ``default`` - Use the platform-specific default (``always`` for all
+non-AArch64-platforms).
+
+``no-compact-unwind`` is a performance optimization -- Clang will emit smaller
+object files that are more quickly processed by the linker. This may cause
+binary compatibility issues on older x86_64 targets, however, so use it with
+caution.
+
 .. _configuration-files:
 
 Configuration files
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D127630: [MC] Fix likely uninitialized memory bug

2022-06-13 Thread Jez Ng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe4a21e1644f2: [MC] Fix likely uninitialized memory bug 
(authored by int3).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127630/new/

https://reviews.llvm.org/D127630

Files:
  clang/tools/driver/cc1as_main.cpp


Index: clang/tools/driver/cc1as_main.cpp
===
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -170,6 +170,7 @@
 Dwarf64 = 0;
 DwarfVersion = 0;
 EmbedBitcode = 0;
+EmitDwarfUnwind = EmitDwarfUnwindType::Default;
   }
 
   static bool CreateFromArgs(AssemblerInvocation ,


Index: clang/tools/driver/cc1as_main.cpp
===
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -170,6 +170,7 @@
 Dwarf64 = 0;
 DwarfVersion = 0;
 EmbedBitcode = 0;
+EmitDwarfUnwind = EmitDwarfUnwindType::Default;
   }
 
   static bool CreateFromArgs(AssemblerInvocation ,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D127630: [MC] Fix likely uninitialized memory bug

2022-06-13 Thread Jez Ng via Phabricator via cfe-commits
int3 created this revision.
int3 added reviewers: lld-macho, uabelho.
Herald added a project: All.
int3 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

See https://reviews.llvm.org/D122258#inline-1223493. I can't repro the
issue locally but this seems like the likely culprit.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127630

Files:
  clang/tools/driver/cc1as_main.cpp


Index: clang/tools/driver/cc1as_main.cpp
===
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -170,6 +170,7 @@
 Dwarf64 = 0;
 DwarfVersion = 0;
 EmbedBitcode = 0;
+EmitDwarfUnwind = EmitDwarfUnwindType::Default;
   }
 
   static bool CreateFromArgs(AssemblerInvocation ,


Index: clang/tools/driver/cc1as_main.cpp
===
--- clang/tools/driver/cc1as_main.cpp
+++ clang/tools/driver/cc1as_main.cpp
@@ -170,6 +170,7 @@
 Dwarf64 = 0;
 DwarfVersion = 0;
 EmbedBitcode = 0;
+EmitDwarfUnwind = EmitDwarfUnwindType::Default;
   }
 
   static bool CreateFromArgs(AssemblerInvocation ,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-06-13 Thread Jez Ng via Phabricator via cfe-commits
int3 added inline comments.



Comment at: clang/tools/driver/cc1as_main.cpp:323-329
+  if (auto *A = Args.getLastArg(OPT_femit_dwarf_unwind_EQ)) {
+Opts.EmitDwarfUnwind =
+llvm::StringSwitch(A->getValue())
+.Case("always", EmitDwarfUnwindType::Always)
+.Case("no-compact-unwind", EmitDwarfUnwindType::NoCompactUnwind)
+.Case("default", EmitDwarfUnwindType::Default);
+  }

still building ASAN but this looks sus -- if no flag gets passed, we never 
initialize `EmitDwarfUnwind` before using it on line 381

also it occurred to me that if the buildbots haven't flagged anything, ASAN 
probably can't detect this. Let me just put up a patch


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-06-13 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

Actually let me try it now


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-06-13 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

Oh dear. Hmm does running the test with ASAN enabled hit any memory issues?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-06-12 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

d'oh, I see it now. And of course the parent `llvm/test/MC/MachO` directory is 
gated to x86-only. Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-06-12 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

Buildbots gave me a bunch of errors of the form

/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/llvm-mc:
 error: unable to get target for 'arm64-apple-macos11.0', see --version and 
--triple.

I'm wondering if I'm just missing a REQUIRES line, but then again I don't see 
any other tests under MC/MachO that use REQUIRES...

Or should I be using `darwin` instead of `macos`? Does it matter?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-06-12 Thread Jez Ng via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef501bf85d8c: [MC] Omit DWARF unwind info if compact unwind 
is present where eligible (authored by int3).

Changed prior to commit:
  https://reviews.llvm.org/D122258?vs=427509=436220#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/femit-dwarf-unwind.c
  clang/test/Driver/femit-dwarf-unwind.s
  clang/tools/driver/cc1as_main.cpp
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCTargetOptions.h
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCTargetOptions.cpp
  llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/test/MC/MachO/emit-dwarf-unwind.s
  llvm/test/MC/X86/compact-unwind-mode-dwarf.s

Index: llvm/test/MC/X86/compact-unwind-mode-dwarf.s
===
--- /dev/null
+++ llvm/test/MC/X86/compact-unwind-mode-dwarf.s
@@ -0,0 +1,50 @@
+// RUN: llvm-mc -triple x86_64-apple-macos10.6 -filetype=obj %s -o %t.o
+// RUN: llvm-objdump --macho --unwind-info --dwarf=frames %t.o | FileCheck %s
+
+/// For functions whose unwind info cannot be encoded with compact unwind, make
+/// sure that we encode them using DWARF unwind, and make sure we emit a compact
+/// unwind entry that indicates that a DWARF encoding is being used.
+
+_f:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+_g:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+// CHECK: Contents of __compact_unwind section:
+// CHECK:   Entry at offset 0x0:
+// CHECK: start:0x[[#%x,F:]] _f
+// CHECK: length:   0x1
+// CHECK: compact encoding: 0x0400
+// CHECK:   Entry at offset 0x20:
+// CHECK: start:0x[[#%x,G:]] _g
+// CHECK: length:   0x1
+// CHECK: compact encoding: 0x0400
+
+// CHECK: .eh_frame contents:
+// CHECK:  0014  CIE
+// CHECK:   Format:DWARF32
+// CHECK:   Version:   1
+// CHECK:   Augmentation:  "zR"
+// CHECK:   Code alignment factor: 1
+// CHECK:   Data alignment factor: -8
+// CHECK:   Return address column: 16
+// CHECK:   Augmentation data: 10
+
+// CHECK: FDE cie= pc=[[#%.8x,F]]...
+// CHECK:   Format:   DWARF32
+// CHECK:   DW_CFA_GNU_args_size: +16
+
+// CHECK: FDE cie= pc=[[#%.8x,G]]...
+// CHECK:   Format:   DWARF32
+// CHECK:   DW_CFA_GNU_args_size: +16
Index: llvm/test/MC/MachO/emit-dwarf-unwind.s
===
--- /dev/null
+++ llvm/test/MC/MachO/emit-dwarf-unwind.s
@@ -0,0 +1,33 @@
+// RUN: rm -rf %t; mkdir %t
+// RUN: llvm-mc -triple x86_64-apple-macos11.0 %s -filetype=obj -o %t/x86_64.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64.o | FileCheck %s --check-prefix TWO-FDES
+// RUN: llvm-mc -triple arm64-apple-macos11.0 %s -filetype=obj -o %t/arm64.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/arm64.o | FileCheck %s --check-prefix ONE-FDE
+// RUN: llvm-mc -triple x86_64-apple-macos11.0 %s -filetype=obj --emit-dwarf-unwind no-compact-unwind -o %t/x86_64-no-dwarf.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64-no-dwarf.o | FileCheck %s --check-prefix ONE-FDE
+// RUN: llvm-mc -triple arm64-apple-macos11.0 %s -filetype=obj --emit-dwarf-unwind always -o %t/arm64-dwarf.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/arm64-dwarf.o | FileCheck %s --check-prefix TWO-FDES
+
+// TWO-FDES: FDE
+// TWO-FDES: FDE
+
+// ONE-FDE-NOT: FDE
+// ONE-FDE: FDE
+// ONE-FDE-NOT: FDE
+
+_main:
+  .cfi_startproc
+  .cfi_def_cfa_offset 16
+  ret
+  .cfi_endproc
+
+_foo:
+  .cfi_startproc
+  .cfi_def_cfa_offset 16
+  /// This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  /// unwind, so we must use DWARf unwind for this function.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+.subsections_via_symbols
Index: llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-05-05 Thread Jez Ng via Phabricator via cfe-commits
int3 marked 3 inline comments as done.
int3 added inline comments.



Comment at: clang/lib/CodeGen/BackendUtil.cpp:456
   Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
+  Options.MCOptions.EmitDwarfUnwind = CodeGenOpts.getEmitDwarfUnwind();
   Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;

int3 wrote:
> smeenai wrote:
> > smeenai wrote:
> > > int3 wrote:
> > > > smeenai wrote:
> > > > > int3 wrote:
> > > > > > this code doesn't execute if clang is passed an assembly file 
> > > > > > instead of a .c file, so this option doesn't have the desired 
> > > > > > effect on assembly inputs. I'm not sure what's the right way to 
> > > > > > tackle this, or if this behavior inconsistency is acceptable
> > > > > > 
> > > > > > 
> > > > > It seems unfortunate to have that inconsistency. From what I can 
> > > > > tell, clang/tools/driver/cc1as_main.cpp looks like it might be the 
> > > > > rough equivalent of this for the integrated assembler?
> > > > that's what I'd thought too, but I set a breakpoint on `cc1as_main` & 
> > > > `ExecuteAssemblerImpl` and then ran `clang -c foo.s`; neither 
> > > > breakpoint triggered
> > > Hmm, interesting. If you run with `-###`, is `-cc1as` being invoked 
> > > in-process or out of process? Idk if the in-process cc1as has a different 
> > > entry point.
> > Nah, looks like in-process cc1as should be calling `cc1as_main` as well: 
> > https://github.com/llvm/llvm-project/blob/98616cfc02613d98964588fac6494ec7583c495f/clang/tools/driver/driver.cpp#L319
> > 
> > (If it's out of process you'd need to debug the cc1as process and not the 
> > driver process, of course, but I'd be surprised if you end up with an out 
> > of process cc1as)
> ah yeah I guess that's it. I'd enabled `settings set 
> target.process.follow-fork-mode child` but that doesn't seem to have the 
> desired effect; but modifying cc1as_main itself shows that it is indeed being 
> called.
alright this works now, thanks for the pointers!



Comment at: clang/tools/driver/cc1as_main.cpp:323
 
+  if (auto *A = Args.getLastArg(OPT_femit_dwarf_unwind_EQ)) {
+Opts.EmitDwarfUnwind =

this is a bit of code duplication, but the same approach is used to have 
`OPT_fembed_bitcode_EQ` accepted by both the integrated assembler as will as 
the CompilerInvocation.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-05-05 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 427509.
int3 added a comment.

make things work under cc1as too


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/femit-dwarf-unwind.c
  clang/test/Driver/femit-dwarf-unwind.s
  clang/tools/driver/cc1as_main.cpp
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCTargetOptions.h
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCTargetOptions.cpp
  llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/test/MC/MachO/force-dwarf-unwind.s
  llvm/test/MC/X86/compact-unwind-mode-dwarf.s

Index: llvm/test/MC/X86/compact-unwind-mode-dwarf.s
===
--- /dev/null
+++ llvm/test/MC/X86/compact-unwind-mode-dwarf.s
@@ -0,0 +1,50 @@
+// RUN: llvm-mc -triple x86_64-apple-macos10.6 -filetype=obj %s -o %t.o
+// RUN: llvm-objdump --macho --unwind-info --dwarf=frames %t.o | FileCheck %s
+
+/// For functions whose unwind info cannot be encoded with compact unwind, make
+/// sure that we encode them using DWARF unwind, and make sure we emit a compact
+/// unwind entry that indicates that a DWARF encoding is being used.
+
+_f:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+_g:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+// CHECK: Contents of __compact_unwind section:
+// CHECK:   Entry at offset 0x0:
+// CHECK: start:0x[[#%x,F:]] _f
+// CHECK: length:   0x1
+// CHECK: compact encoding: 0x0400
+// CHECK:   Entry at offset 0x20:
+// CHECK: start:0x[[#%x,G:]] _g
+// CHECK: length:   0x1
+// CHECK: compact encoding: 0x0400
+
+// CHECK: .eh_frame contents:
+// CHECK:  0014  CIE
+// CHECK:   Format:DWARF32
+// CHECK:   Version:   1
+// CHECK:   Augmentation:  "zR"
+// CHECK:   Code alignment factor: 1
+// CHECK:   Data alignment factor: -8
+// CHECK:   Return address column: 16
+// CHECK:   Augmentation data: 10
+
+// CHECK: FDE cie= pc=[[#%.8x,F]]...
+// CHECK:   Format:   DWARF32
+// CHECK:   DW_CFA_GNU_args_size: +16
+
+// CHECK: FDE cie= pc=[[#%.8x,G]]...
+// CHECK:   Format:   DWARF32
+// CHECK:   DW_CFA_GNU_args_size: +16
Index: llvm/test/MC/MachO/force-dwarf-unwind.s
===
--- /dev/null
+++ llvm/test/MC/MachO/force-dwarf-unwind.s
@@ -0,0 +1,33 @@
+// RUN: rm -rf %t; mkdir %t
+// RUN: llvm-mc -triple x86_64-apple-macos11.0 %s -filetype=obj -o %t/x86_64.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64.o | FileCheck %s --check-prefix TWO-FDES
+// RUN: llvm-mc -triple arm64-apple-macos11.0 %s -filetype=obj -o %t/arm64.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/arm64.o | FileCheck %s --check-prefix ONE-FDE
+// RUN: llvm-mc -triple x86_64-apple-macos11.0 %s -filetype=obj --emit-dwarf-unwind no-compact-unwind -o %t/x86_64-no-dwarf.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64-no-dwarf.o | FileCheck %s --check-prefix ONE-FDE
+// RUN: llvm-mc -triple arm64-apple-macos11.0 %s -filetype=obj --emit-dwarf-unwind always -o %t/arm64-dwarf.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/arm64-dwarf.o | FileCheck %s --check-prefix TWO-FDES
+
+// TWO-FDES: FDE
+// TWO-FDES: FDE
+
+// ONE-FDE-NOT: FDE
+// ONE-FDE: FDE
+// ONE-FDE-NOT: FDE
+
+_main:
+  .cfi_startproc
+  .cfi_def_cfa_offset 16
+  ret
+  .cfi_endproc
+
+_foo:
+  .cfi_startproc
+  .cfi_def_cfa_offset 16
+  /// This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  /// unwind, so we must use DWARf unwind for this function.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+.subsections_via_symbols
Index: llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
===
--- llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -1377,7 +1377,7 @@
   default:
 // Any other CFI directives indicate a frame 

[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-05-05 Thread Jez Ng via Phabricator via cfe-commits
int3 added inline comments.



Comment at: clang/lib/CodeGen/BackendUtil.cpp:456
   Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
+  Options.MCOptions.EmitDwarfUnwind = CodeGenOpts.getEmitDwarfUnwind();
   Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;

smeenai wrote:
> smeenai wrote:
> > int3 wrote:
> > > smeenai wrote:
> > > > int3 wrote:
> > > > > this code doesn't execute if clang is passed an assembly file instead 
> > > > > of a .c file, so this option doesn't have the desired effect on 
> > > > > assembly inputs. I'm not sure what's the right way to tackle this, or 
> > > > > if this behavior inconsistency is acceptable
> > > > > 
> > > > > 
> > > > It seems unfortunate to have that inconsistency. From what I can tell, 
> > > > clang/tools/driver/cc1as_main.cpp looks like it might be the rough 
> > > > equivalent of this for the integrated assembler?
> > > that's what I'd thought too, but I set a breakpoint on `cc1as_main` & 
> > > `ExecuteAssemblerImpl` and then ran `clang -c foo.s`; neither breakpoint 
> > > triggered
> > Hmm, interesting. If you run with `-###`, is `-cc1as` being invoked 
> > in-process or out of process? Idk if the in-process cc1as has a different 
> > entry point.
> Nah, looks like in-process cc1as should be calling `cc1as_main` as well: 
> https://github.com/llvm/llvm-project/blob/98616cfc02613d98964588fac6494ec7583c495f/clang/tools/driver/driver.cpp#L319
> 
> (If it's out of process you'd need to debug the cc1as process and not the 
> driver process, of course, but I'd be surprised if you end up with an out of 
> process cc1as)
ah yeah I guess that's it. I'd enabled `settings set 
target.process.follow-fork-mode child` but that doesn't seem to have the 
desired effect; but modifying cc1as_main itself shows that it is indeed being 
called.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-05-05 Thread Jez Ng via Phabricator via cfe-commits
int3 added inline comments.



Comment at: clang/lib/CodeGen/BackendUtil.cpp:456
   Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
+  Options.MCOptions.EmitDwarfUnwind = CodeGenOpts.getEmitDwarfUnwind();
   Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;

smeenai wrote:
> int3 wrote:
> > this code doesn't execute if clang is passed an assembly file instead of a 
> > .c file, so this option doesn't have the desired effect on assembly inputs. 
> > I'm not sure what's the right way to tackle this, or if this behavior 
> > inconsistency is acceptable
> > 
> > 
> It seems unfortunate to have that inconsistency. From what I can tell, 
> clang/tools/driver/cc1as_main.cpp looks like it might be the rough equivalent 
> of this for the integrated assembler?
that's what I'd thought too, but I set a breakpoint on `cc1as_main` & 
`ExecuteAssemblerImpl` and then ran `clang -c foo.s`; neither breakpoint 
triggered


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-05-05 Thread Jez Ng via Phabricator via cfe-commits
int3 added inline comments.



Comment at: clang/lib/CodeGen/BackendUtil.cpp:456
   Options.MCOptions.SplitDwarfFile = CodeGenOpts.SplitDwarfFile;
+  Options.MCOptions.EmitDwarfUnwind = CodeGenOpts.getEmitDwarfUnwind();
   Options.MCOptions.MCRelaxAll = CodeGenOpts.RelaxAll;

this code doesn't execute if clang is passed an assembly file instead of a .c 
file, so this option doesn't have the desired effect on assembly inputs. I'm 
not sure what's the right way to tackle this, or if this behavior inconsistency 
is acceptable




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-05-05 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 427398.
int3 added a comment.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/femit-dwarf-unwind.c
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCTargetOptions.h
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCTargetOptions.cpp
  llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/test/MC/MachO/force-dwarf-unwind.s
  llvm/test/MC/X86/compact-unwind-mode-dwarf.s

Index: llvm/test/MC/X86/compact-unwind-mode-dwarf.s
===
--- /dev/null
+++ llvm/test/MC/X86/compact-unwind-mode-dwarf.s
@@ -0,0 +1,50 @@
+// RUN: llvm-mc -triple x86_64-apple-macos10.6 -filetype=obj %s -o %t.o
+// RUN: llvm-objdump --macho --unwind-info --dwarf=frames %t.o | FileCheck %s
+
+/// For functions whose unwind info cannot be encoded with compact unwind, make
+/// sure that we encode them using DWARF unwind, and make sure we emit a compact
+/// unwind entry that indicates that a DWARF encoding is being used.
+
+_f:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+_g:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+// CHECK: Contents of __compact_unwind section:
+// CHECK:   Entry at offset 0x0:
+// CHECK: start:0x[[#%x,F:]] _f
+// CHECK: length:   0x1
+// CHECK: compact encoding: 0x0400
+// CHECK:   Entry at offset 0x20:
+// CHECK: start:0x[[#%x,G:]] _g
+// CHECK: length:   0x1
+// CHECK: compact encoding: 0x0400
+
+// CHECK: .eh_frame contents:
+// CHECK:  0014  CIE
+// CHECK:   Format:DWARF32
+// CHECK:   Version:   1
+// CHECK:   Augmentation:  "zR"
+// CHECK:   Code alignment factor: 1
+// CHECK:   Data alignment factor: -8
+// CHECK:   Return address column: 16
+// CHECK:   Augmentation data: 10
+
+// CHECK: FDE cie= pc=[[#%.8x,F]]...
+// CHECK:   Format:   DWARF32
+// CHECK:   DW_CFA_GNU_args_size: +16
+
+// CHECK: FDE cie= pc=[[#%.8x,G]]...
+// CHECK:   Format:   DWARF32
+// CHECK:   DW_CFA_GNU_args_size: +16
Index: llvm/test/MC/MachO/force-dwarf-unwind.s
===
--- /dev/null
+++ llvm/test/MC/MachO/force-dwarf-unwind.s
@@ -0,0 +1,33 @@
+// RUN: rm -rf %t; mkdir %t
+// RUN: llvm-mc -triple x86_64-apple-macos11.0 %s -filetype=obj -o %t/x86_64.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64.o | FileCheck %s --check-prefix TWO-FDES
+// RUN: llvm-mc -triple arm64-apple-macos11.0 %s -filetype=obj -o %t/arm64.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/arm64.o | FileCheck %s --check-prefix ONE-FDE
+// RUN: llvm-mc -triple x86_64-apple-macos11.0 %s -filetype=obj --emit-dwarf-unwind no-compact-unwind -o %t/x86_64-no-dwarf.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64-no-dwarf.o | FileCheck %s --check-prefix ONE-FDE
+// RUN: llvm-mc -triple arm64-apple-macos11.0 %s -filetype=obj --emit-dwarf-unwind always -o %t/arm64-dwarf.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/arm64-dwarf.o | FileCheck %s --check-prefix TWO-FDES
+
+// TWO-FDES: FDE
+// TWO-FDES: FDE
+
+// ONE-FDE-NOT: FDE
+// ONE-FDE: FDE
+// ONE-FDE-NOT: FDE
+
+_main:
+  .cfi_startproc
+  .cfi_def_cfa_offset 16
+  ret
+  .cfi_endproc
+
+_foo:
+  .cfi_startproc
+  .cfi_def_cfa_offset 16
+  /// This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  /// unwind, so we must use DWARf unwind for this function.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+.subsections_via_symbols
Index: llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
===
--- llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -1377,7 +1377,7 @@
   default:
 // Any other CFI directives indicate a frame that we aren't prepared
 // to represent via compact unwind, so just bail out.
-return 0;
+  

[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present where eligible

2022-05-05 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 427396.
int3 retitled this revision from "[MC] Omit DWARF unwind info if compact unwind 
is present for all archs" to "[MC] Omit DWARF unwind info if compact unwind is 
present where eligible".
int3 edited the summary of this revision.
int3 added a comment.
Herald added a subscriber: ormris.

update


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/Driver/ToolChains/Clang.cpp
  clang/test/Driver/femit-dwarf-unwind.c
  lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCTargetOptions.h
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCTargetOptions.cpp
  llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/test/MC/MachO/force-dwarf-unwind.s
  llvm/test/MC/X86/compact-unwind-mode-dwarf.s

Index: llvm/test/MC/X86/compact-unwind-mode-dwarf.s
===
--- /dev/null
+++ llvm/test/MC/X86/compact-unwind-mode-dwarf.s
@@ -0,0 +1,50 @@
+// RUN: llvm-mc -triple x86_64-apple-macos10.6 -filetype=obj %s -o %t.o
+// RUN: llvm-objdump --macho --unwind-info --dwarf=frames %t.o | FileCheck %s
+
+/// For functions whose unwind info cannot be encoded with compact unwind, make
+/// sure that we encode them using DWARF unwind, and make sure we emit a compact
+/// unwind entry that indicates that a DWARF encoding is being used.
+
+_f:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+_g:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+// CHECK: Contents of __compact_unwind section:
+// CHECK:   Entry at offset 0x0:
+// CHECK: start:0x[[#%x,F:]] _f
+// CHECK: length:   0x1
+// CHECK: compact encoding: 0x0400
+// CHECK:   Entry at offset 0x20:
+// CHECK: start:0x[[#%x,G:]] _g
+// CHECK: length:   0x1
+// CHECK: compact encoding: 0x0400
+
+// CHECK: .eh_frame contents:
+// CHECK:  0014  CIE
+// CHECK:   Format:DWARF32
+// CHECK:   Version:   1
+// CHECK:   Augmentation:  "zR"
+// CHECK:   Code alignment factor: 1
+// CHECK:   Data alignment factor: -8
+// CHECK:   Return address column: 16
+// CHECK:   Augmentation data: 10
+
+// CHECK: FDE cie= pc=[[#%.8x,F]]...
+// CHECK:   Format:   DWARF32
+// CHECK:   DW_CFA_GNU_args_size: +16
+
+// CHECK: FDE cie= pc=[[#%.8x,G]]...
+// CHECK:   Format:   DWARF32
+// CHECK:   DW_CFA_GNU_args_size: +16
Index: llvm/test/MC/MachO/force-dwarf-unwind.s
===
--- /dev/null
+++ llvm/test/MC/MachO/force-dwarf-unwind.s
@@ -0,0 +1,33 @@
+// RUN: rm -rf %t; mkdir %t
+// RUN: llvm-mc -triple x86_64-apple-macos11.0 %s -filetype=obj -o %t/x86_64.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64.o | FileCheck %s --check-prefix TWO-FDES
+// RUN: llvm-mc -triple arm64-apple-macos11.0 %s -filetype=obj -o %t/arm64.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/arm64.o | FileCheck %s --check-prefix ONE-FDE
+// RUN: llvm-mc -triple x86_64-apple-macos11.0 %s -filetype=obj --emit-dwarf-unwind no-compact-unwind -o %t/x86_64-no-dwarf.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/x86_64-no-dwarf.o | FileCheck %s --check-prefix ONE-FDE
+// RUN: llvm-mc -triple arm64-apple-macos11.0 %s -filetype=obj --emit-dwarf-unwind always -o %t/arm64-dwarf.o
+// RUN: llvm-objdump --macho --dwarf=frames %t/arm64-dwarf.o | FileCheck %s --check-prefix TWO-FDES
+
+// TWO-FDES: FDE
+// TWO-FDES: FDE
+
+// ONE-FDE-NOT: FDE
+// ONE-FDE: FDE
+// ONE-FDE-NOT: FDE
+
+_main:
+  .cfi_startproc
+  .cfi_def_cfa_offset 16
+  ret
+  .cfi_endproc
+
+_foo:
+  .cfi_startproc
+  .cfi_def_cfa_offset 16
+  /// This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  /// unwind, so we must use DWARf unwind for this function.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+.subsections_via_symbols
Index: llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-28 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 425953.
int3 added a comment.

update


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCTargetOptions.h
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCTargetOptions.cpp
  llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
  llvm/test/MC/ELF/cfi-version.ll
  llvm/test/MC/MachO/force-dwarf-unwind.s
  llvm/test/MC/MachO/gen-dwarf64.s
  llvm/test/MC/X86/compact-unwind-mode-dwarf.s
  llvm/test/MC/X86/i386-darwin-frame-register.ll
  llvm/test/tools/dsymutil/X86/frame-1.test
  llvm/test/tools/dsymutil/X86/frame-2.test
  llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test

Index: llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
===
--- llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
+++ llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
+RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
 RUN:   | llvm-dwarfdump -debug-frame=0x0014 - | FileCheck %s
 CHECK: .debug_frame contents:
 CHECK-NEXT: 0014 0014  FDE cie= pc=...001d
Index: llvm/test/tools/dsymutil/X86/frame-2.test
===
--- llvm/test/tools/dsymutil/X86/frame-2.test
+++ llvm/test/tools/dsymutil/X86/frame-2.test
@@ -1,7 +1,7 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # Check the handling of multiple different CIEs. To have CIEs that
Index: llvm/test/tools/dsymutil/X86/frame-1.test
===
--- llvm/test/tools/dsymutil/X86/frame-1.test
+++ llvm/test/tools/dsymutil/X86/frame-1.test
@@ -1,6 +1,6 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # This test is meant to verify that identical CIEs will get reused
Index: llvm/test/MC/X86/i386-darwin-frame-register.ll
===
--- llvm/test/MC/X86/i386-darwin-frame-register.ll
+++ llvm/test/MC/X86/i386-darwin-frame-register.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
+; RUN: llc --force-dwarf-unwind-info -filetype=obj %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 ; IR reduced from a dummy:
 ; void foo() {}
Index: llvm/test/MC/X86/compact-unwind-mode-dwarf.s
===
--- /dev/null
+++ llvm/test/MC/X86/compact-unwind-mode-dwarf.s
@@ -0,0 +1,50 @@
+// RUN: llvm-mc -triple x86_64-apple-macos10.6 -filetype=obj %s -o %t.o
+// RUN: llvm-objdump --macho --unwind-info --dwarf=frames %t.o | FileCheck %s
+
+/// For functions whose unwind info cannot be encoded with compact unwind, make
+/// sure that we encode them using DWARF unwind, and make sure we emit a compact
+/// unwind entry that indicates that a DWARF encoding is being used.
+
+_f:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+_g:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+// CHECK: Contents of __compact_unwind section:
+// CHECK:   Entry at offset 0x0:
+// CHECK: start:0x[[#%x,F:]] _f
+// CHECK: 

[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-28 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 425944.
int3 added a comment.

add --no-force-dwarf-unwind-info; only omit by default on aarch64


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCTargetOptions.h
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCTargetOptions.cpp
  llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
  llvm/test/MC/ELF/cfi-version.ll
  llvm/test/MC/MachO/force-dwarf-unwind.s
  llvm/test/MC/MachO/gen-dwarf64.s
  llvm/test/MC/X86/compact-unwind-mode-dwarf.s
  llvm/test/MC/X86/i386-darwin-frame-register.ll
  llvm/test/tools/dsymutil/X86/frame-1.test
  llvm/test/tools/dsymutil/X86/frame-2.test
  llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test

Index: llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
===
--- llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
+++ llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
+RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
 RUN:   | llvm-dwarfdump -debug-frame=0x0014 - | FileCheck %s
 CHECK: .debug_frame contents:
 CHECK-NEXT: 0014 0014  FDE cie= pc=...001d
Index: llvm/test/tools/dsymutil/X86/frame-2.test
===
--- llvm/test/tools/dsymutil/X86/frame-2.test
+++ llvm/test/tools/dsymutil/X86/frame-2.test
@@ -1,7 +1,7 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # Check the handling of multiple different CIEs. To have CIEs that
Index: llvm/test/tools/dsymutil/X86/frame-1.test
===
--- llvm/test/tools/dsymutil/X86/frame-1.test
+++ llvm/test/tools/dsymutil/X86/frame-1.test
@@ -1,6 +1,6 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # This test is meant to verify that identical CIEs will get reused
Index: llvm/test/MC/X86/i386-darwin-frame-register.ll
===
--- llvm/test/MC/X86/i386-darwin-frame-register.ll
+++ llvm/test/MC/X86/i386-darwin-frame-register.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
+; RUN: llc --force-dwarf-unwind-info -filetype=obj %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 ; IR reduced from a dummy:
 ; void foo() {}
Index: llvm/test/MC/X86/compact-unwind-mode-dwarf.s
===
--- /dev/null
+++ llvm/test/MC/X86/compact-unwind-mode-dwarf.s
@@ -0,0 +1,50 @@
+// RUN: llvm-mc -triple x86_64-apple-macos10.6 -filetype=obj %s -o %t.o
+// RUN: llvm-objdump --macho --unwind-info --dwarf=frames %t.o | FileCheck %s
+
+/// For functions whose unwind info cannot be encoded with compact unwind, make
+/// sure that we encode them using DWARF unwind, and make sure we emit a compact
+/// unwind entry that indicates that a DWARF encoding is being used.
+
+_f:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+_g:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+// CHECK: Contents of __compact_unwind section:
+// CHECK:   Entry at offset 0x0:
+// 

[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-27 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

Thanks for the feedback!

> The binary compatibility issue is non-existent on arm64, but it could be 
> still a thing on x86_64.

Can we enable `OmitDwarfIfHaveCompactUnwind` by default on arm64 then? And have 
it be opt-in just for x86_64?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-26 Thread Jez Ng via Phabricator via cfe-commits
int3 added inline comments.



Comment at: llvm/lib/CodeGen/MachineModuleInfo.cpp:69
   MMI.TM.getMCRegisterInfo(), MMI.TM.getMCSubtargetInfo(), nullptr,
-  nullptr, false),
+  , false),
   MachineFunctions(std::move(MMI.MachineFunctions)) {

`MCTargetOptions` isn't passed directly to `MCObjectFileInfo`; it only gets an 
`MCContext`. `MCContext` already has a member pointer to MCTargetOptions, but 
it seemed not to be initialized in a number of cases, hence the need for this 
change.



Comment at: llvm/tools/llc/llc.cpp:697-700
+auto  = MMIWP->getMMI().getContext();
+Ctx.setGenDwarfForAssembly(Target->Options.ForceDwarfFrameSection);
 const_cast(LLVMTM.getObjFileLowering())
+->Initialize(Ctx, *Target);

lhames wrote:
> int3 wrote:
> > int3 wrote:
> > > lhames wrote:
> > > > This option hand-off feels very manual. I wonder if we should add a 
> > > > `propagateTargetOptionsToMC` function, but maybe the set of options 
> > > > that it would apply to is small enough not to bother for now?
> > > > 
> > > > I would add something like this to 
> > > > `LLVMTargetMachine::addPassesToEmitMC` too, for the the case where the 
> > > > caller passes in a null `MCContext*`. 
> > > thanks for the pointers! I'll look into that
> > actually, I'm not sure I understood your suggestion... which class do you 
> > envision `propagateTargetOptionsToMC` being defined in? How would it make 
> > things "less manual"?
> Oh! `TargetOptions` has an `MCTargetOptions` member already. If 
> `GenDwarfUnwindInfo` === `ForceDwarfUnwindInfo`, could you just sink 
> `ForceDwarfUnwindInfo` into `MCTargetOptions`? 
alright, I think I got it to work :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-26 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 425408.
int3 marked an inline comment as done.
int3 added a comment.
Herald added a project: lld-macho.
Herald added a reviewer: lld-macho.

use MCTargetOptions


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  lld/test/MachO/compact-unwind-both-local-and-dylib-personality.s
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/MC/MCTargetOptions.h
  llvm/include/llvm/MC/MCTargetOptionsCommandFlags.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/CodeGen/MachineModuleInfo.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCContext.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/MC/MCTargetOptionsCommandFlags.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
  llvm/test/MC/ELF/cfi-version.ll
  llvm/test/MC/MachO/gen-dwarf64.s
  llvm/test/MC/X86/compact-unwind-mode-dwarf.s
  llvm/test/MC/X86/i386-darwin-frame-register.ll
  llvm/test/tools/dsymutil/X86/frame-1.test
  llvm/test/tools/dsymutil/X86/frame-2.test
  llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test

Index: llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
===
--- llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
+++ llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
+RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
 RUN:   | llvm-dwarfdump -debug-frame=0x0014 - | FileCheck %s
 CHECK: .debug_frame contents:
 CHECK-NEXT: 0014 0014  FDE cie= pc=...001d
Index: llvm/test/tools/dsymutil/X86/frame-2.test
===
--- llvm/test/tools/dsymutil/X86/frame-2.test
+++ llvm/test/tools/dsymutil/X86/frame-2.test
@@ -1,7 +1,7 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # Check the handling of multiple different CIEs. To have CIEs that
Index: llvm/test/tools/dsymutil/X86/frame-1.test
===
--- llvm/test/tools/dsymutil/X86/frame-1.test
+++ llvm/test/tools/dsymutil/X86/frame-1.test
@@ -1,6 +1,6 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # This test is meant to verify that identical CIEs will get reused
Index: llvm/test/MC/X86/i386-darwin-frame-register.ll
===
--- llvm/test/MC/X86/i386-darwin-frame-register.ll
+++ llvm/test/MC/X86/i386-darwin-frame-register.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
+; RUN: llc --force-dwarf-unwind-info -filetype=obj %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 ; IR reduced from a dummy:
 ; void foo() {}
Index: llvm/test/MC/X86/compact-unwind-mode-dwarf.s
===
--- /dev/null
+++ llvm/test/MC/X86/compact-unwind-mode-dwarf.s
@@ -0,0 +1,50 @@
+// RUN: llvm-mc -triple x86_64-apple-macos10.6 -filetype=obj %s -o %t.o
+// RUN: llvm-objdump --macho --unwind-info --dwarf=frames %t.o | FileCheck %s
+
+/// For functions whose unwind info cannot be encoded with compact unwind, make
+/// sure that we encode them using DWARF unwind, and make sure we emit a compact
+/// unwind entry that indicates that a DWARF encoding is being used.
+
+_f:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+_g:
+  .cfi_startproc
+  ## This encodes DW_CFA_GNU_args_size which cannot be expressed using compact
+  ## unwind, so we must use DWARF unwind instead.
+  .cfi_escape 0x2e, 0x10
+  ret
+  .cfi_endproc
+
+// CHECK: Contents of __compact_unwind section:
+// CHECK:  

[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-25 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

bump @lhames @JDevlieghere would either of y'all be able to review this?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-20 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 424044.
int3 edited the summary of this revision.
int3 added a comment.
Herald added a subscriber: pengfei.

fix x86 backend's omission of DWARF unwind


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  llvm/include/llvm/CodeGen/CommandFlags.h
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/CommandFlags.cpp
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
  llvm/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
  llvm/test/MC/ELF/cfi-version.ll
  llvm/test/MC/MachO/gen-dwarf64.s
  llvm/test/MC/X86/compact-unwind-mode-dwarf.s
  llvm/test/MC/X86/i386-darwin-frame-register.ll
  llvm/test/tools/dsymutil/X86/frame-1.test
  llvm/test/tools/dsymutil/X86/frame-2.test
  llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
  llvm/tools/llc/llc.cpp
  llvm/tools/llvm-mc/llvm-mc.cpp

Index: llvm/tools/llvm-mc/llvm-mc.cpp
===
--- llvm/tools/llvm-mc/llvm-mc.cpp
+++ llvm/tools/llvm-mc/llvm-mc.cpp
@@ -176,6 +176,12 @@
  "source files"),
 cl::cat(MCCategory));
 
+static cl::opt
+GenDwarfUnwindInfo("generate-dwarf-unwind-info",
+   cl::desc("Generate dwarf unwind info regardless of "
+"whether compact unwind also generated"),
+   cl::cat(MCCategory));
+
 static cl::opt
 DebugCompilationDir("fdebug-compilation-dir",
 cl::desc("Specifies the debug info's compilation dir"),
@@ -429,6 +435,7 @@
   // MCObjectFileInfo needs a MCContext reference in order to initialize itself.
   MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), ,
 );
+  Ctx.setGenDwarfUnwindInfo(GenDwarfUnwindInfo);
   std::unique_ptr MOFI(
   TheTarget->createMCObjectFileInfo(Ctx, PIC, LargeCodeModel));
   Ctx.setObjectFileInfo(MOFI.get());
Index: llvm/tools/llc/llc.cpp
===
--- llvm/tools/llc/llc.cpp
+++ llvm/tools/llc/llc.cpp
@@ -694,9 +694,10 @@
codegen::getFileType(), NoVerify, MMIWP)) {
   reportError("target does not support generation of this file type");
 }
-
+auto  = MMIWP->getMMI().getContext();
+Ctx.setGenDwarfUnwindInfo(Target->Options.ForceDwarfUnwindInfo);
 const_cast(LLVMTM.getObjFileLowering())
-->Initialize(MMIWP->getMMI().getContext(), *Target);
+->Initialize(Ctx, *Target);
 if (MIR) {
   assert(MMIWP && "Forgot to create MMIWP?");
   if (MIR->parseMachineFunctions(*M, MMIWP->getMMI()))
Index: llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
===
--- llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
+++ llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
+RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
 RUN:   | llvm-dwarfdump -debug-frame=0x0014 - | FileCheck %s
 CHECK: .debug_frame contents:
 CHECK-NEXT: 0014 0014  FDE cie= pc=...001d
Index: llvm/test/tools/dsymutil/X86/frame-2.test
===
--- llvm/test/tools/dsymutil/X86/frame-2.test
+++ llvm/test/tools/dsymutil/X86/frame-2.test
@@ -1,7 +1,7 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # Check the handling of multiple different CIEs. To have CIEs that
Index: llvm/test/tools/dsymutil/X86/frame-1.test
===
--- llvm/test/tools/dsymutil/X86/frame-1.test
+++ llvm/test/tools/dsymutil/X86/frame-1.test
@@ -1,6 +1,6 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | 

[PATCH] D122258: [MC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-19 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

This is ready for review, please take a look 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC][RFC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-18 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 423532.
int3 added a comment.
Herald added a subscriber: dexonsmith.

- Use a separate ForceDwarfUnwindInfo flag
- Fix the remaining tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/Options.td
  llvm/include/llvm/CodeGen/CommandFlags.h
  llvm/include/llvm/MC/MCContext.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/CommandFlags.cpp
  llvm/lib/CodeGen/LLVMTargetMachine.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
  llvm/test/MC/ELF/cfi-version.ll
  llvm/test/MC/MachO/gen-dwarf64.s
  llvm/test/MC/X86/i386-darwin-frame-register.ll
  llvm/test/tools/dsymutil/X86/frame-1.test
  llvm/test/tools/dsymutil/X86/frame-2.test
  llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
  llvm/tools/llc/llc.cpp
  llvm/tools/llvm-mc/llvm-mc.cpp

Index: llvm/tools/llvm-mc/llvm-mc.cpp
===
--- llvm/tools/llvm-mc/llvm-mc.cpp
+++ llvm/tools/llvm-mc/llvm-mc.cpp
@@ -176,6 +176,12 @@
  "source files"),
 cl::cat(MCCategory));
 
+static cl::opt
+GenDwarfUnwindInfo("generate-dwarf-unwind-info",
+   cl::desc("Generate dwarf unwind info regardless of "
+"whether compact unwind also generated"),
+   cl::cat(MCCategory));
+
 static cl::opt
 DebugCompilationDir("fdebug-compilation-dir",
 cl::desc("Specifies the debug info's compilation dir"),
@@ -429,6 +435,7 @@
   // MCObjectFileInfo needs a MCContext reference in order to initialize itself.
   MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), ,
 );
+  Ctx.setGenDwarfUnwindInfo(GenDwarfUnwindInfo);
   std::unique_ptr MOFI(
   TheTarget->createMCObjectFileInfo(Ctx, PIC, LargeCodeModel));
   Ctx.setObjectFileInfo(MOFI.get());
Index: llvm/tools/llc/llc.cpp
===
--- llvm/tools/llc/llc.cpp
+++ llvm/tools/llc/llc.cpp
@@ -694,9 +694,10 @@
codegen::getFileType(), NoVerify, MMIWP)) {
   reportError("target does not support generation of this file type");
 }
-
+auto  = MMIWP->getMMI().getContext();
+Ctx.setGenDwarfUnwindInfo(Target->Options.ForceDwarfUnwindInfo);
 const_cast(LLVMTM.getObjFileLowering())
-->Initialize(MMIWP->getMMI().getContext(), *Target);
+->Initialize(Ctx, *Target);
 if (MIR) {
   assert(MMIWP && "Forgot to create MMIWP?");
   if (MIR->parseMachineFunctions(*M, MMIWP->getMMI()))
Index: llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
===
--- llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
+++ llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
@@ -1,4 +1,4 @@
-RUN: llc -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
+RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../../dsymutil/Inputs/frame-dw2.ll -o - \
 RUN:   | llvm-dwarfdump -debug-frame=0x0014 - | FileCheck %s
 CHECK: .debug_frame contents:
 CHECK-NEXT: 0014 0014  FDE cie= pc=...001d
Index: llvm/test/tools/dsymutil/X86/frame-2.test
===
--- llvm/test/tools/dsymutil/X86/frame-2.test
+++ llvm/test/tools/dsymutil/X86/frame-2.test
@@ -1,7 +1,7 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw4.ll -o %t/frame-dw4.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # Check the handling of multiple different CIEs. To have CIEs that
Index: llvm/test/tools/dsymutil/X86/frame-1.test
===
--- llvm/test/tools/dsymutil/X86/frame-1.test
+++ llvm/test/tools/dsymutil/X86/frame-1.test
@@ -1,6 +1,6 @@
 # RUN: rm -rf %t
 # RUN: mkdir -p %t
-# RUN: llc -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
+# RUN: llc --force-dwarf-unwind-info -filetype=obj %p/../Inputs/frame-dw2.ll -o %t/frame-dw2.o
 # RUN: dsymutil -f -oso-prepend-path=%t -y %s -o - | llvm-dwarfdump -debug-frame - | FileCheck %s
 
 # This test is meant to verify that identical CIEs will get reused
Index: 

[PATCH] D122258: [MC][RFC] Omit DWARF unwind info if compact unwind is present for all archs

2022-04-18 Thread Jez Ng via Phabricator via cfe-commits
int3 marked an inline comment as done.
int3 added inline comments.



Comment at: llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp:131-132
+   size_t Size) {
+  if (Size == 0)
+return;
   registerEHFramesInProcess(Addr, Size);

int3 wrote:
> lhames wrote:
> > Is this needed? With your change, registerEHFramesInProcess should be a 
> > no-op if `Size == 0`.
> might not be yeah. I wasn't sure whether the extra entry in `EHFrames` would 
> be an issue, but I will double check
looks like it isn't necessary. removing



Comment at: llvm/tools/llc/llc.cpp:697-700
+auto  = MMIWP->getMMI().getContext();
+Ctx.setGenDwarfForAssembly(Target->Options.ForceDwarfFrameSection);
 const_cast(LLVMTM.getObjFileLowering())
+->Initialize(Ctx, *Target);

int3 wrote:
> lhames wrote:
> > This option hand-off feels very manual. I wonder if we should add a 
> > `propagateTargetOptionsToMC` function, but maybe the set of options that it 
> > would apply to is small enough not to bother for now?
> > 
> > I would add something like this to `LLVMTargetMachine::addPassesToEmitMC` 
> > too, for the the case where the caller passes in a null `MCContext*`. 
> thanks for the pointers! I'll look into that
actually, I'm not sure I understood your suggestion... which class do you 
envision `propagateTargetOptionsToMC` being defined in? How would it make 
things "less manual"?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC][RFC] Omit DWARF unwind info if compact unwind is present for all archs

2022-03-25 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

I'm currently working on the eh_frame support in LLD itself, but will circle 
back to this diff in a week or so. Thanks for the feedback!




Comment at: 
clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp:48
 
+// FIXME
 TEST(InterpreterTest, CatchException) {

lhames wrote:
> I guess this is just a placeholder? The final commit should include more 
> detail.
yep, just a placeholder



Comment at: llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp:131-132
+   size_t Size) {
+  if (Size == 0)
+return;
   registerEHFramesInProcess(Addr, Size);

lhames wrote:
> Is this needed? With your change, registerEHFramesInProcess should be a no-op 
> if `Size == 0`.
might not be yeah. I wasn't sure whether the extra entry in `EHFrames` would be 
an issue, but I will double check



Comment at: llvm/tools/llc/llc.cpp:697-700
+auto  = MMIWP->getMMI().getContext();
+Ctx.setGenDwarfForAssembly(Target->Options.ForceDwarfFrameSection);
 const_cast(LLVMTM.getObjFileLowering())
+->Initialize(Ctx, *Target);

lhames wrote:
> This option hand-off feels very manual. I wonder if we should add a 
> `propagateTargetOptionsToMC` function, but maybe the set of options that it 
> would apply to is small enough not to bother for now?
> 
> I would add something like this to `LLVMTargetMachine::addPassesToEmitMC` 
> too, for the the case where the caller passes in a null `MCContext*`. 
thanks for the pointers! I'll look into that


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC][RFC] Omit DWARF unwind info if compact unwind is present for all archs

2022-03-22 Thread Jez Ng via Phabricator via cfe-commits
int3 added inline comments.



Comment at: llvm/lib/MC/MCObjectFileInfo.cpp:66-67
 
-  if (T.isWatchABI())
-OmitDwarfIfHaveCompactUnwind = true;
 

@MaskRay

> I vaguely remember there is a place where DWARF unwind info is enabled for 
> all but few environments (like watchOS). Where is it?

here :)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122258/new/

https://reviews.llvm.org/D122258

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


[PATCH] D122258: [MC][RFC] Omit DWARF unwind info if compact unwind is present for all archs

2022-03-22 Thread Jez Ng via Phabricator via cfe-commits
int3 created this revision.
int3 added reviewers: davide, kledzik, lhames.
Herald added subscribers: StephenFan, cmtice, hiraditya, kristof.beyls, emaste.
Herald added a reviewer: JDevlieghere.
Herald added a reviewer: jhenderson.
Herald added a project: All.
int3 requested review of this revision.
Herald added subscribers: llvm-commits, cfe-commits, MaskRay.
Herald added projects: clang, LLVM.

Diff is not yet complete, but I'm looking for some feedback...

Previously, omitting unnecessary DWARF unwinds was only done for
watchOS, but I've heard that it might be possible to do this for all
archs. @davide, @kledzik -- do you see any issues with this?

Motivation: I'm working on adding support for `__eh_frame` to LLD, but
I'm concerned that we would suffer a perf hit. Processing compact unwind
is already expensive, and that's a simpler format than EH frames. Given
that MC currently produces one EH frame entry for every compact unwind
entry, I don't think processing them will be cheap. I tried to do
something clever on LLD's end to drop the unnecessary EH frames at parse
time, but this made the code significantly more complex. So I'm looking
at fixing this at the MC level instead.

Code-wise, I'm a bit uncertain about the right approach here. A good
number of tests are failing. Some of them are tests that expected EH
frames to always be generated, and I figure we have two options here:
change the tests to have unwind info that can't be encoded with compact
unwind, or pass a flag to force EH frames to always be emitted. I've
done the former because it seems slightly easier than figuring out what
each test was supposed to do.

The other source of failure appears to stem from `lli` failing to catch
exceptions. Based on this comment 
,
I believe the root cause is that libunwind is unable to load compact
unwind dynamically. (I believe this limitation applies not just to MCJIT but to
ORC and the regular interpreter as well -- @lhames, would you be able to
confirm?)

In both cases, we need some way to tell `MCObjectFileInfo` to emit EH
frames. I'm currently doing that via
`MCContext::getGenDwarfForAssembly`. I'm not super familiar with the MC
code, though, so I'm wondering if I should use a different flag, or if I
should even be using `MCContext` here. Pointers will be appreciated!


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122258

Files:
  clang/unittests/Interpreter/ExceptionTests/InterpreterExceptionTest.cpp
  llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
  llvm/lib/ExecutionEngine/RuntimeDyld/RTDyldMemoryManager.cpp
  llvm/lib/MC/MCDwarf.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/test/ExecutionEngine/MCJIT/eh-lg-pic.ll
  llvm/test/ExecutionEngine/MCJIT/eh.ll
  llvm/test/ExecutionEngine/MCJIT/multi-module-eh-a.ll
  llvm/test/ExecutionEngine/MCJIT/remote/eh.ll
  llvm/test/ExecutionEngine/OrcLazy/minimal-throw-catch.ll
  llvm/test/ExecutionEngine/RuntimeDyld/X86/MachO_x86-64_PIC_relocations.s
  llvm/test/MC/ELF/cfi-version.ll
  llvm/test/MC/X86/i386-darwin-frame-register.ll
  llvm/test/tools/dsymutil/X86/frame-1.test
  llvm/test/tools/dsymutil/X86/frame-2.test
  llvm/test/tools/llvm-dwarfdump/X86/debug_frame_offset.test
  llvm/tools/llc/llc.cpp
  llvm/tools/llvm-mc/llvm-mc.cpp

Index: llvm/tools/llvm-mc/llvm-mc.cpp
===
--- llvm/tools/llvm-mc/llvm-mc.cpp
+++ llvm/tools/llvm-mc/llvm-mc.cpp
@@ -429,6 +429,7 @@
   // MCObjectFileInfo needs a MCContext reference in order to initialize itself.
   MCContext Ctx(TheTriple, MAI.get(), MRI.get(), STI.get(), ,
 );
+  Ctx.setGenDwarfForAssembly(GenDwarfForAssembly);
   std::unique_ptr MOFI(
   TheTarget->createMCObjectFileInfo(Ctx, PIC, LargeCodeModel));
   Ctx.setObjectFileInfo(MOFI.get());
@@ -436,7 +437,6 @@
   if (SaveTempLabels)
 Ctx.setAllowTemporaryLabels(false);
 
-  Ctx.setGenDwarfForAssembly(GenDwarfForAssembly);
   // Default to 4 for dwarf version.
   unsigned DwarfVersion = MCOptions.DwarfVersion ? MCOptions.DwarfVersion : 4;
   if (DwarfVersion < 2 || DwarfVersion > 5) {
Index: llvm/tools/llc/llc.cpp
===
--- llvm/tools/llc/llc.cpp
+++ llvm/tools/llc/llc.cpp
@@ -694,9 +694,10 @@
codegen::getFileType(), NoVerify, MMIWP)) {
   reportError("target does not support generation of this file type");
 }
-
+auto  = MMIWP->getMMI().getContext();
+Ctx.setGenDwarfForAssembly(Target->Options.ForceDwarfFrameSection);
 const_cast(LLVMTM.getObjFileLowering())
-->Initialize(MMIWP->getMMI().getContext(), *Target);
+->Initialize(Ctx, *Target);
 if (MIR) {
   assert(MMIWP && "Forgot to create MMIWP?");
   if (MIR->parseMachineFunctions(*M, MMIWP->getMMI()))
Index: 

[PATCH] D122110: [Clang] Set -mlinker-version explicitly in the lto test

2022-03-21 Thread Jez Ng via Phabricator via cfe-commits
int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

Ohh gotcha. So clang assumes that the platform linker's version is at least as 
high as the host linker's, assuming the host linker is ld64. That seems kind of 
hacky, but I suppose it's existing behavior...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122110/new/

https://reviews.llvm.org/D122110

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


[PATCH] D122110: [Clang] Set -mlinker-version explicitly in the lto test

2022-03-20 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

Would it make sense to have clang pass `-object_path_lto` whenever it's 
invoking LLD?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122110/new/

https://reviews.llvm.org/D122110

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


[PATCH] D122109: [CMake][Clang] Skip host link version detection for lld on Darwin

2022-03-20 Thread Jez Ng via Phabricator via cfe-commits
int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122109/new/

https://reviews.llvm.org/D122109

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


[PATCH] D119612: [clang] Pass more flags to ld64.lld

2022-02-17 Thread Jez Ng via Phabricator via cfe-commits
int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

lgtm!




Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:272
 
-  // ld64 version 262 and above run the deduplicate pass by default.
-  if (Version >= VersionTuple(262) && 
shouldLinkerNotDedup(C.getJobs().empty(), Args))
+  // ld64 version 262 and above and lld run the deduplicate pass by default.
+  if ((Version >= VersionTuple(262) || LinkerIsLLD) &&

thakis wrote:
> MaskRay wrote:
> > lld runs `--icf=none` (i.e. `-no_deduplicate`) by default.
> Hm, good point. Should we pass `--icf=safe` for lld if 
> `!shouldLinkerNotDedup` here then?
I think our dedup pass is both a lot more effective and a lot more expensive 
link-time-wise than ld64's so maybe we shouldn't do it by default...


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119612/new/

https://reviews.llvm.org/D119612

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


[PATCH] D114842: [lld-macho] Remove old macho darwin lld

2021-11-30 Thread Jez Ng via Phabricator via cfe-commits
int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

lgtm. Could you make a post to llvm-dev before landing this? Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114842/new/

https://reviews.llvm.org/D114842

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


[PATCH] D99811: [TextAPI] move source code files out of subdirectory, NFC

2021-04-03 Thread Jez Ng via Phabricator via cfe-commits
int3 accepted this revision.
int3 added a comment.
This revision is now accepted and ready to land.

lgtm


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99811/new/

https://reviews.llvm.org/D99811

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


[PATCH] D97741: [clang+lld] Pass -platform_version args to ld64.lld

2021-03-02 Thread Jez Ng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG18fa1d380d6c: [clang+lld] Pass -platform_version args to 
ld64.lld (authored by int3).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97741/new/

https://reviews.llvm.org/D97741

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
  clang/test/Driver/Inputs/lld/ld64.lld.darwinold
  clang/test/Driver/darwin-infer-simulator-sdkroot.c
  clang/test/Driver/darwin-ld-demangle-lld.c
  clang/test/Driver/darwin-ld-lto.c
  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-sdkroot.c
  clang/test/Driver/target-triple-deployment.c

Index: clang/test/Driver/target-triple-deployment.c
===
--- clang/test/Driver/target-triple-deployment.c
+++ clang/test/Driver/target-triple-deployment.c
@@ -1,16 +1,16 @@
 // RUN: touch %t.o
-// RUN: %clang -target x86_64-apple-macosx10.4 -mlinker-version=400 -### %t.o 2> %t.log
-// RUN: %clang -target x86_64-apple-darwin9 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target x86_64-apple-macosx10.7 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target x86_64-apple-macosx10.4 -mlinker-version=400 -### %t.o 2> %t.log
+// RUN: %clang -fuse-ld= -target x86_64-apple-darwin9 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target x86_64-apple-macosx10.7 -mlinker-version=400 -### %t.o 2>> %t.log
 //
-// RUN: %clang -target armv7-apple-ios -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target armv7-apple-ios0.0 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target armv7-apple-ios1.2.3 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target armv7-apple-ios5.0 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target armv7-apple-ios7.0 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target arm64-apple-ios -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target arm64e-apple-ios13.0 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target arm64e-apple-ios14.1 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios0.0 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios1.2.3 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios5.0 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios7.0 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target arm64-apple-ios -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target arm64e-apple-ios13.0 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target arm64e-apple-ios14.1 -mlinker-version=400 -### %t.o 2>> %t.log
 //
 // RUN: FileCheck %s < %t.log
 
Index: clang/test/Driver/darwin-sdkroot.c
===
--- clang/test/Driver/darwin-sdkroot.c
+++ clang/test/Driver/darwin-sdkroot.c
@@ -43,7 +43,7 @@
 //
 // RUN: rm -rf %t/SDKs/iPhoneOS8.0.0.sdk
 // RUN: mkdir -p %t/SDKs/iPhoneOS8.0.0.sdk
-// RUN: env SDKROOT=%t/SDKs/iPhoneOS8.0.0.sdk %clang -target arm64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
+// RUN: env SDKROOT=%t/SDKs/iPhoneOS8.0.0.sdk %clang -fuse-ld= -target arm64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-IPHONE %s
 //
 // CHECK-IPHONE: clang
@@ -55,7 +55,7 @@
 //
 // RUN: rm -rf %t/SDKs/iPhoneSimulator8.0.sdk
 // RUN: mkdir -p %t/SDKs/iPhoneSimulator8.0.sdk
-// RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -target x86_64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
+// RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -fuse-ld= -target x86_64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-SIMULATOR %s
 //
 // CHECK-SIMULATOR: clang
@@ -66,7 +66,7 @@
 //
 // RUN: rm -rf %t/SDKs/MacOSX10.10.0.sdk
 // RUN: mkdir -p %t/SDKs/MacOSX10.10.0.sdk
-// RUN: env SDKROOT=%t/SDKs/MacOSX10.10.0.sdk %clang -target x86_64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
+// RUN: env SDKROOT=%t/SDKs/MacOSX10.10.0.sdk %clang -fuse-ld= -target x86_64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-MACOSX %s
 //
 // CHECK-MACOSX: clang
Index: clang/test/Driver/darwin-ld-platform-version-watchos.c
===
--- clang/test/Driver/darwin-ld-platform-version-watchos.c
+++ 

[PATCH] D97741: [clang+lld] Pass -platform_version args to ld64.lld

2021-03-01 Thread Jez Ng via Phabricator via cfe-commits
int3 created this revision.
int3 added reviewers: lld-macho, thakis.
Herald added subscribers: steven_wu, hiraditya.
int3 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Now that ld64.lld points to the new Darwin backend, we can pass it the newer
`-platform_version` flag.

Most of the changes were originally in D95204: [lld-macho] Switch default to 
new Darwin backend , but I backed them out due 
to
test failures on builds which have `CLANG_DEFAULT_LINKER=lld`. The tests are
properly updated in this diff. @thakis, want to have a second look to make sure
things make sense? I haven't worked with clang-driver code much.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97741

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
  clang/test/Driver/Inputs/lld/ld64.lld.darwinold
  clang/test/Driver/darwin-infer-simulator-sdkroot.c
  clang/test/Driver/darwin-ld-demangle-lld.c
  clang/test/Driver/darwin-ld-lto.c
  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-sdkroot.c
  clang/test/Driver/target-triple-deployment.c

Index: clang/test/Driver/target-triple-deployment.c
===
--- clang/test/Driver/target-triple-deployment.c
+++ clang/test/Driver/target-triple-deployment.c
@@ -1,16 +1,16 @@
 // RUN: touch %t.o
-// RUN: %clang -target x86_64-apple-macosx10.4 -mlinker-version=400 -### %t.o 2> %t.log
-// RUN: %clang -target x86_64-apple-darwin9 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target x86_64-apple-macosx10.7 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target x86_64-apple-macosx10.4 -mlinker-version=400 -### %t.o 2> %t.log
+// RUN: %clang -fuse-ld= -target x86_64-apple-darwin9 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target x86_64-apple-macosx10.7 -mlinker-version=400 -### %t.o 2>> %t.log
 //
-// RUN: %clang -target armv7-apple-ios -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target armv7-apple-ios0.0 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target armv7-apple-ios1.2.3 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target armv7-apple-ios5.0 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target armv7-apple-ios7.0 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target arm64-apple-ios -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target arm64e-apple-ios13.0 -mlinker-version=400 -### %t.o 2>> %t.log
-// RUN: %clang -target arm64e-apple-ios14.1 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios0.0 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios1.2.3 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios5.0 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target armv7-apple-ios7.0 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target arm64-apple-ios -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target arm64e-apple-ios13.0 -mlinker-version=400 -### %t.o 2>> %t.log
+// RUN: %clang -fuse-ld= -target arm64e-apple-ios14.1 -mlinker-version=400 -### %t.o 2>> %t.log
 //
 // RUN: FileCheck %s < %t.log
 
Index: clang/test/Driver/darwin-sdkroot.c
===
--- clang/test/Driver/darwin-sdkroot.c
+++ clang/test/Driver/darwin-sdkroot.c
@@ -43,7 +43,7 @@
 //
 // RUN: rm -rf %t/SDKs/iPhoneOS8.0.0.sdk
 // RUN: mkdir -p %t/SDKs/iPhoneOS8.0.0.sdk
-// RUN: env SDKROOT=%t/SDKs/iPhoneOS8.0.0.sdk %clang -target arm64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
+// RUN: env SDKROOT=%t/SDKs/iPhoneOS8.0.0.sdk %clang -fuse-ld= -target arm64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-IPHONE %s
 //
 // CHECK-IPHONE: clang
@@ -55,7 +55,7 @@
 //
 // RUN: rm -rf %t/SDKs/iPhoneSimulator8.0.sdk
 // RUN: mkdir -p %t/SDKs/iPhoneSimulator8.0.sdk
-// RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -target x86_64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
+// RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -fuse-ld= -target x86_64-apple-darwin -mlinker-version=400 --sysroot="" %s -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-SIMULATOR %s
 //
 // CHECK-SIMULATOR: clang
@@ -66,7 +66,7 @@
 //
 // RUN: rm -rf %t/SDKs/MacOSX10.10.0.sdk
 // RUN: mkdir -p %t/SDKs/MacOSX10.10.0.sdk
-// RUN: env SDKROOT=%t/SDKs/MacOSX10.10.0.sdk %clang -target x86_64-apple-darwin 

[PATCH] D95204: [lld-macho] Switch default to new Darwin backend

2021-03-01 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

I've reverted the clang driver changes for now in 
rG922de2574c17a755279358be928e5343dcf56c56 
.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95204/new/

https://reviews.llvm.org/D95204

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


[PATCH] D95204: [lld-macho] Switch default to new Darwin backend

2021-03-01 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

Thanks for the heads up. Looking


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95204/new/

https://reviews.llvm.org/D95204

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


[PATCH] D95204: [lld-macho] Switch default to new Darwin backend

2021-03-01 Thread Jez Ng via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG415c0cd698a8: [lld-macho] Switch default to new Darwin 
backend (authored by int3).
Herald added a project: lld-macho.

Changed prior to commit:
  https://reviews.llvm.org/D95204?vs=327145=327148#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95204/new/

https://reviews.llvm.org/D95204

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
  clang/test/Driver/Inputs/lld/ld64.lld.darwinold
  clang/test/Driver/darwin-ld-demangle-lld.c
  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
  lld/test/MachO/invalid/stub-link.s
  lld/test/MachO/lit.local.cfg
  lld/test/MachO/search-paths-darwin.test
  lld/test/MachO/syslibroot.test
  lld/test/darwin/cmdline-lto_library.objtxt
  lld/test/darwin/cmdline-objc_gc.objtxt
  lld/test/darwin/cmdline-objc_gc_compaction.objtxt
  lld/test/darwin/cmdline-objc_gc_only.objtxt
  lld/test/darwin/native-and-mach-o.objtxt
  lld/test/mach-o/Inputs/swift-version-1.yaml
  lld/test/mach-o/Inputs/wrong-arch-error.yaml
  lld/test/mach-o/PIE.yaml
  lld/test/mach-o/align_text.yaml
  lld/test/mach-o/arm-interworking-movw.yaml
  lld/test/mach-o/arm-interworking.yaml
  lld/test/mach-o/arm-shims.yaml
  lld/test/mach-o/arm-subsections-via-symbols.yaml
  lld/test/mach-o/arm64-reloc-negDelta32-fixup.yaml
  lld/test/mach-o/arm64-relocs-errors-delta64-offset.yaml
  lld/test/mach-o/arm64-section-order.yaml
  lld/test/mach-o/bind-opcodes.yaml
  lld/test/mach-o/cstring-sections.yaml
  lld/test/mach-o/data-in-code-load-command.yaml
  lld/test/mach-o/data-only-dylib.yaml
  lld/test/mach-o/dead-strip-globals.yaml
  lld/test/mach-o/debug-syms.yaml
  lld/test/mach-o/demangle.yaml
  lld/test/mach-o/dependency_info.yaml
  lld/test/mach-o/do-not-emit-unwind-fde-arm64.yaml
  lld/test/mach-o/dso_handle.yaml
  lld/test/mach-o/dylib-install-names.yaml
  lld/test/mach-o/eh-frame-relocs-arm64.yaml
  lld/test/mach-o/empty-sections.yaml
  lld/test/mach-o/error-simulator-vs-macosx.yaml
  lld/test/mach-o/exe-offsets.yaml
  lld/test/mach-o/exe-segment-overlap.yaml
  lld/test/mach-o/executable-exports.yaml
  lld/test/mach-o/export-trie-order.yaml
  lld/test/mach-o/exported_symbols_list-dylib.yaml
  lld/test/mach-o/exported_symbols_list-obj.yaml
  lld/test/mach-o/exported_symbols_list-undef.yaml
  lld/test/mach-o/fat-archive.yaml
  lld/test/mach-o/filelist.yaml
  lld/test/mach-o/flat_namespace_undef_error.yaml
  lld/test/mach-o/flat_namespace_undef_suppress.yaml
  lld/test/mach-o/force_load-dylib.yaml
  lld/test/mach-o/force_load-x86_64.yaml
  lld/test/mach-o/framework-user-paths.yaml
  lld/test/mach-o/function-starts-load-command.yaml
  lld/test/mach-o/gcc_except_tab-got-arm64.yaml
  lld/test/mach-o/got-order.yaml
  lld/test/mach-o/hello-world-arm64.yaml
  lld/test/mach-o/hello-world-armv6.yaml
  lld/test/mach-o/hello-world-armv7.yaml
  lld/test/mach-o/hello-world-x86.yaml
  lld/test/mach-o/hello-world-x86_64.yaml
  lld/test/mach-o/image-base.yaml
  lld/test/mach-o/infer-arch.yaml
  lld/test/mach-o/interposing-section.yaml
  lld/test/mach-o/keep_private_externs.yaml
  lld/test/mach-o/lazy-bind-x86_64.yaml
  lld/test/mach-o/lc_segment_filesize.yaml
  lld/test/mach-o/lib-search-paths.yaml
  lld/test/mach-o/library-order.yaml
  lld/test/mach-o/library-rescan.yaml
  lld/test/mach-o/libresolve-bizarre-root-override.yaml
  lld/test/mach-o/libresolve-multiple-syslibroots.yaml
  lld/test/mach-o/libresolve-one-syslibroot.yaml
  lld/test/mach-o/libresolve-simple.yaml
  lld/test/mach-o/libresolve-user-paths.yaml
  lld/test/mach-o/libresolve-z.yaml
  lld/test/mach-o/load-commands-size.yaml
  lld/test/mach-o/mach_header-cpusubtype.yaml
  lld/test/mach-o/mh_bundle_header.yaml
  lld/test/mach-o/mh_dylib_header.yaml
  lld/test/mach-o/objc-category-list-atom.yaml
  lld/test/mach-o/objc-image-info-host-vs-simulator.yaml
  lld/test/mach-o/objc-image-info-invalid-size.yaml
  lld/test/mach-o/objc-image-info-invalid-version.yaml
  lld/test/mach-o/objc-image-info-mismatched-swift-version.yaml
  lld/test/mach-o/objc-image-info-pass-output.yaml
  lld/test/mach-o/objc-image-info-simulator-vs-host.yaml
  lld/test/mach-o/objc-image-info-unsupported-gc.yaml
  lld/test/mach-o/objc_export_list.yaml
  lld/test/mach-o/order_file-basic.yaml
  lld/test/mach-o/parse-aliases.yaml
  lld/test/mach-o/parse-arm-relocs.yaml
  lld/test/mach-o/parse-cfstring32.yaml
  lld/test/mach-o/parse-cfstring64.yaml
  lld/test/mach-o/parse-compact-unwind32.yaml
  lld/test/mach-o/parse-compact-unwind64.yaml
  lld/test/mach-o/parse-data-in-code-armv7.yaml
  lld/test/mach-o/parse-data-in-code-x86.yaml
  lld/test/mach-o/parse-data-relocs-arm64.yaml
  

[PATCH] D95204: [lld-macho] Switch default to new Darwin backend

2021-03-01 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 327145.
int3 added a comment.

keep around darwinnew link for now


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95204/new/

https://reviews.llvm.org/D95204

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
  clang/test/Driver/Inputs/lld/ld64.lld.darwinold
  clang/test/Driver/darwin-ld-demangle-lld.c
  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
  lld/tools/lld/CMakeLists.txt
  lld/tools/lld/lld.cpp
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn

Index: llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
===
--- llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
+++ llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
@@ -5,6 +5,7 @@
   "ld.lld",
   "ld64.lld",
   "ld64.lld.darwinnew",
+  "ld64.lld.darwinold",
   "wasm-ld",
 ]
 foreach(target, symlinks) {
Index: llvm/utils/gn/build/BUILD.gn
===
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -218,11 +218,7 @@
 
   # On Windows, the linker is not invoked through the compiler driver.
   if (use_lld && host_os != "win") {
-if (host_os == "mac") {
-  ldflags += [ "-fuse-ld=lld.darwinnew" ]
-} else {
-  ldflags += [ "-fuse-ld=lld" ]
-}
+ldflags += [ "-fuse-ld=lld" ]
   }
 
   if (llvm_build_instrumented_coverage) {
Index: lld/tools/lld/lld.cpp
===
--- lld/tools/lld/lld.cpp
+++ lld/tools/lld/lld.cpp
@@ -56,7 +56,7 @@
   Gnu,   // -flavor gnu
   WinLink,   // -flavor link
   Darwin,// -flavor darwin
-  DarwinNew, // -flavor darwinnew
+  DarwinOld, // -flavor darwinold
   Wasm,  // -flavor wasm
 };
 
@@ -70,8 +70,9 @@
   .CasesLower("ld", "ld.lld", "gnu", Gnu)
   .CasesLower("wasm", "ld-wasm", Wasm)
   .CaseLower("link", WinLink)
-  .CasesLower("ld64", "ld64.lld", "darwin", Darwin)
-  .CasesLower("darwinnew", "ld64.lld.darwinnew", DarwinNew)
+  .CasesLower("ld64", "ld64.lld", "darwin", "darwinnew",
+  "ld64.lld.darwinnew", Darwin)
+  .CasesLower("darwinold", "ld64.lld.darwinold", DarwinOld)
   .Default(Invalid);
 }
 
@@ -154,9 +155,9 @@
   case WinLink:
 return !coff::link(args, exitEarly, stdoutOS, stderrOS);
   case Darwin:
-return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
-  case DarwinNew:
 return !macho::link(args, exitEarly, stdoutOS, stderrOS);
+  case DarwinOld:
+return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
   case Wasm:
 return !lld::wasm::link(args, exitEarly, stdoutOS, stderrOS);
   default:
Index: lld/tools/lld/CMakeLists.txt
===
--- lld/tools/lld/CMakeLists.txt
+++ lld/tools/lld/CMakeLists.txt
@@ -25,7 +25,7 @@
 
 if(NOT LLD_SYMLINKS_TO_CREATE)
   set(LLD_SYMLINKS_TO_CREATE
-  lld-link ld.lld ld64.lld ld64.lld.darwinnew wasm-ld)
+  lld-link ld.lld ld64.lld ld64.lld.darwinnew ld64.lld.darwinold wasm-ld)
 endif()
 
 foreach(link ${LLD_SYMLINKS_TO_CREATE})
Index: clang/test/Driver/darwin-ld-platform-version-watchos.c
===
--- clang/test/Driver/darwin-ld-platform-version-watchos.c
+++ clang/test/Driver/darwin-ld-platform-version-watchos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld= \
+// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinold \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinnew \
+// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-NEW %s
Index: clang/test/Driver/darwin-ld-platform-version-tvos.c
===
--- clang/test/Driver/darwin-ld-platform-version-tvos.c
+++ clang/test/Driver/darwin-ld-platform-version-tvos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld= \
+// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld=lld.darwinold \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // 

[PATCH] D95204: [lld-macho] Switch default to new Darwin port

2021-02-05 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 321921.
int3 marked an inline comment as done.
int3 added a comment.

fix


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95204/new/

https://reviews.llvm.org/D95204

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
  clang/test/Driver/Inputs/lld/ld64.lld.darwinold
  clang/test/Driver/darwin-ld-demangle-lld.c
  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
  lld/tools/lld/CMakeLists.txt
  lld/tools/lld/lld.cpp
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn

Index: llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
===
--- llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
+++ llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
@@ -4,7 +4,7 @@
   "lld-link",
   "ld.lld",
   "ld64.lld",
-  "ld64.lld.darwinnew",
+  "ld64.lld.darwinold",
   "wasm-ld",
 ]
 foreach(target, symlinks) {
Index: llvm/utils/gn/build/BUILD.gn
===
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -236,11 +236,7 @@
 
   # On Windows, the linker is not invoked through the compiler driver.
   if (use_lld && host_os != "win") {
-if (host_os == "mac") {
-  ldflags += [ "-fuse-ld=lld.darwinnew" ]
-} else {
-  ldflags += [ "-fuse-ld=lld" ]
-}
+ldflags += [ "-fuse-ld=lld" ]
   }
 
   if (llvm_build_instrumented_coverage) {
Index: lld/tools/lld/lld.cpp
===
--- lld/tools/lld/lld.cpp
+++ lld/tools/lld/lld.cpp
@@ -56,7 +56,7 @@
   Gnu,   // -flavor gnu
   WinLink,   // -flavor link
   Darwin,// -flavor darwin
-  DarwinNew, // -flavor darwinnew
+  DarwinOld, // -flavor darwinold
   Wasm,  // -flavor wasm
 };
 
@@ -71,7 +71,7 @@
   .CasesLower("wasm", "ld-wasm", Wasm)
   .CaseLower("link", WinLink)
   .CasesLower("ld64", "ld64.lld", "darwin", Darwin)
-  .CasesLower("darwinnew", "ld64.lld.darwinnew", DarwinNew)
+  .CasesLower("darwinold", "ld64.lld.darwinold", DarwinOld)
   .Default(Invalid);
 }
 
@@ -154,9 +154,9 @@
   case WinLink:
 return !coff::link(args, exitEarly, stdoutOS, stderrOS);
   case Darwin:
-return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
-  case DarwinNew:
 return !macho::link(args, exitEarly, stdoutOS, stderrOS);
+  case DarwinOld:
+return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
   case Wasm:
 return !lld::wasm::link(args, exitEarly, stdoutOS, stderrOS);
   default:
Index: lld/tools/lld/CMakeLists.txt
===
--- lld/tools/lld/CMakeLists.txt
+++ lld/tools/lld/CMakeLists.txt
@@ -25,7 +25,7 @@
 
 if(NOT LLD_SYMLINKS_TO_CREATE)
   set(LLD_SYMLINKS_TO_CREATE
-  lld-link ld.lld ld64.lld ld64.lld.darwinnew wasm-ld)
+  lld-link ld.lld ld64.lld ld64.lld.darwinold wasm-ld)
 endif()
 
 foreach(link ${LLD_SYMLINKS_TO_CREATE})
Index: clang/test/Driver/darwin-ld-platform-version-watchos.c
===
--- clang/test/Driver/darwin-ld-platform-version-watchos.c
+++ clang/test/Driver/darwin-ld-platform-version-watchos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld= \
+// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinold \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinnew \
+// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-NEW %s
Index: clang/test/Driver/darwin-ld-platform-version-tvos.c
===
--- clang/test/Driver/darwin-ld-platform-version-tvos.c
+++ clang/test/Driver/darwin-ld-platform-version-tvos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld= \
+// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld=lld.darwinold \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
-// RUN: 

[PATCH] D95204: [lld-macho] Switch default to new Darwin port

2021-02-02 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 321001.
int3 added a subscriber: gkm.
int3 added a comment.

rebase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95204/new/

https://reviews.llvm.org/D95204

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
  clang/test/Driver/Inputs/lld/ld64.lld.darwinold
  clang/test/Driver/darwin-ld-demangle-lld.c
  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
  lld/tools/lld/CMakeLists.txt
  lld/tools/lld/lld.cpp
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn

Index: llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
===
--- llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
+++ llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
@@ -4,7 +4,7 @@
   "lld-link",
   "ld.lld",
   "ld64.lld",
-  "ld64.lld.darwinnew",
+  "ld64.lld.darwinold",
   "wasm-ld",
 ]
 foreach(target, symlinks) {
Index: llvm/utils/gn/build/BUILD.gn
===
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -237,7 +237,7 @@
   # On Windows, the linker is not invoked through the compiler driver.
   if (use_lld && host_os != "win") {
 if (host_os == "mac") {
-  ldflags += [ "-fuse-ld=lld.darwinnew" ]
+  ldflags += [ "-fuse-ld=ld64.lld" ]
 } else {
   ldflags += [ "-fuse-ld=lld" ]
 }
Index: lld/tools/lld/lld.cpp
===
--- lld/tools/lld/lld.cpp
+++ lld/tools/lld/lld.cpp
@@ -56,7 +56,7 @@
   Gnu,   // -flavor gnu
   WinLink,   // -flavor link
   Darwin,// -flavor darwin
-  DarwinNew, // -flavor darwinnew
+  DarwinOld, // -flavor darwinold
   Wasm,  // -flavor wasm
 };
 
@@ -71,7 +71,7 @@
   .CasesLower("wasm", "ld-wasm", Wasm)
   .CaseLower("link", WinLink)
   .CasesLower("ld64", "ld64.lld", "darwin", Darwin)
-  .CasesLower("darwinnew", "ld64.lld.darwinnew", DarwinNew)
+  .CasesLower("darwinold", "ld64.lld.darwinold", DarwinOld)
   .Default(Invalid);
 }
 
@@ -154,9 +154,9 @@
   case WinLink:
 return !coff::link(args, exitEarly, stdoutOS, stderrOS);
   case Darwin:
-return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
-  case DarwinNew:
 return !macho::link(args, exitEarly, stdoutOS, stderrOS);
+  case DarwinOld:
+return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
   case Wasm:
 return !lld::wasm::link(args, exitEarly, stdoutOS, stderrOS);
   default:
Index: lld/tools/lld/CMakeLists.txt
===
--- lld/tools/lld/CMakeLists.txt
+++ lld/tools/lld/CMakeLists.txt
@@ -25,7 +25,7 @@
 
 if(NOT LLD_SYMLINKS_TO_CREATE)
   set(LLD_SYMLINKS_TO_CREATE
-  lld-link ld.lld ld64.lld ld64.lld.darwinnew wasm-ld)
+  lld-link ld.lld ld64.lld ld64.lld.darwinold wasm-ld)
 endif()
 
 foreach(link ${LLD_SYMLINKS_TO_CREATE})
Index: clang/test/Driver/darwin-ld-platform-version-watchos.c
===
--- clang/test/Driver/darwin-ld-platform-version-watchos.c
+++ clang/test/Driver/darwin-ld-platform-version-watchos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld= \
+// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinold \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinnew \
+// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-NEW %s
Index: clang/test/Driver/darwin-ld-platform-version-tvos.c
===
--- clang/test/Driver/darwin-ld-platform-version-tvos.c
+++ clang/test/Driver/darwin-ld-platform-version-tvos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld= \
+// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld=lld.darwinold \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // 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-tvos12.3 

[PATCH] D95204: [lld-macho] Switch default to new Darwin port

2021-02-02 Thread Jez Ng via Phabricator via cfe-commits
int3 updated this revision to Diff 320940.
int3 retitled this revision from "[lld-macho] switch default to new Darwin 
port" to "[lld-macho] Switch default to new Darwin port".
int3 edited the summary of this revision.
int3 edited reviewers, added: thakis; removed: gkm.
int3 added a comment.

update


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95204/new/

https://reviews.llvm.org/D95204

Files:
  clang/lib/Driver/ToolChain.cpp
  clang/test/Driver/Inputs/lld/ld64.lld.darwinnew
  clang/test/Driver/Inputs/lld/ld64.lld.darwinold
  clang/test/Driver/darwin-ld-demangle-lld.c
  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
  lld/tools/lld/CMakeLists.txt
  lld/tools/lld/lld.cpp
  llvm/utils/gn/build/BUILD.gn
  llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn

Index: llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
===
--- llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
+++ llvm/utils/gn/secondary/lld/tools/lld/BUILD.gn
@@ -4,7 +4,7 @@
   "lld-link",
   "ld.lld",
   "ld64.lld",
-  "ld64.lld.darwinnew",
+  "ld64.lld.darwinold",
   "wasm-ld",
 ]
 foreach(target, symlinks) {
Index: llvm/utils/gn/build/BUILD.gn
===
--- llvm/utils/gn/build/BUILD.gn
+++ llvm/utils/gn/build/BUILD.gn
@@ -237,7 +237,7 @@
   # On Windows, the linker is not invoked through the compiler driver.
   if (use_lld && host_os != "win") {
 if (host_os == "mac") {
-  ldflags += [ "-fuse-ld=lld.darwinnew" ]
+  ldflags += [ "-fuse-ld=ld64.lld" ]
 } else {
   ldflags += [ "-fuse-ld=lld" ]
 }
Index: lld/tools/lld/lld.cpp
===
--- lld/tools/lld/lld.cpp
+++ lld/tools/lld/lld.cpp
@@ -56,7 +56,7 @@
   Gnu,   // -flavor gnu
   WinLink,   // -flavor link
   Darwin,// -flavor darwin
-  DarwinNew, // -flavor darwinnew
+  DarwinOld, // -flavor darwinold
   Wasm,  // -flavor wasm
 };
 
@@ -71,7 +71,7 @@
   .CasesLower("wasm", "ld-wasm", Wasm)
   .CaseLower("link", WinLink)
   .CasesLower("ld64", "ld64.lld", "darwin", Darwin)
-  .CasesLower("darwinnew", "ld64.lld.darwinnew", DarwinNew)
+  .CasesLower("darwinold", "ld64.lld.darwinold", DarwinOld)
   .Default(Invalid);
 }
 
@@ -154,9 +154,9 @@
   case WinLink:
 return !coff::link(args, exitEarly, stdoutOS, stderrOS);
   case Darwin:
-return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
-  case DarwinNew:
 return !macho::link(args, exitEarly, stdoutOS, stderrOS);
+  case DarwinOld:
+return !mach_o::link(args, exitEarly, stdoutOS, stderrOS);
   case Wasm:
 return !lld::wasm::link(args, exitEarly, stdoutOS, stderrOS);
   default:
Index: lld/tools/lld/CMakeLists.txt
===
--- lld/tools/lld/CMakeLists.txt
+++ lld/tools/lld/CMakeLists.txt
@@ -25,7 +25,7 @@
 
 if(NOT LLD_SYMLINKS_TO_CREATE)
   set(LLD_SYMLINKS_TO_CREATE
-  lld-link ld.lld ld64.lld ld64.lld.darwinnew wasm-ld)
+  lld-link ld.lld ld64.lld ld64.lld.darwinold wasm-ld)
 endif()
 
 foreach(link ${LLD_SYMLINKS_TO_CREATE})
Index: clang/test/Driver/darwin-ld-platform-version-watchos.c
===
--- clang/test/Driver/darwin-ld-platform-version-watchos.c
+++ clang/test/Driver/darwin-ld-platform-version-watchos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld= \
+// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinold \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=400 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
-// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld.darwinnew \
+// RUN: %clang -target arm64_32-apple-watchos5.2 -fuse-ld=lld \
 // RUN:   -isysroot %S/Inputs/WatchOS6.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o -B%S/Inputs/lld 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-NEW %s
Index: clang/test/Driver/darwin-ld-platform-version-tvos.c
===
--- clang/test/Driver/darwin-ld-platform-version-tvos.c
+++ clang/test/Driver/darwin-ld-platform-version-tvos.c
@@ -1,6 +1,6 @@
 // RUN: touch %t.o
 
-// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld= \
+// RUN: %clang -target arm64-apple-tvos12.3 -fuse-ld=lld.darwinold \
 // RUN:   -isysroot %S/Inputs/iPhoneOS13.0.sdk -mlinker-version=0 \
 // RUN:   -### %t.o 2>&1 \
 // RUN:   | FileCheck --check-prefix=LINKER-OLD %s
@@ -8,7 +8,7 @@
 // RUN:   

[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

Yes, I was referring to that question too :) I'm working on the new lld-macho 
implementation, under the `DarwinNew` flavor. I'm not sure if anything depends 
on the old `Darwin` flavor, which is why we haven't removed it yet, though we 
plan to do that once we get the new implementation to a more mature stage.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76452/new/

https://reviews.llvm.org/D76452



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


[PATCH] D76452: Use LLD by default for Android.

2020-04-24 Thread Jez Ng via Phabricator via cfe-commits
int3 added a comment.

I don't think I have enough context here to answer the question, but I'm pretty 
sure that change wouldn't affect what I'm working on


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76452/new/

https://reviews.llvm.org/D76452



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