15285 Commits

Author SHA1 Message Date
Fangrui Song
b9ec4ab6ac
[CMake] Install LLVMgold.so for LLVM_INSTALL_TOOLCHAIN_ONLY=on (#87567)
LLVMgold.so can be used with GNU ar, gold, ld, and nm to process LLVM
bitcode files. Install it in LLVM_INSTALL_TOOLCHAIN_ONLY=on builds like
we install libLTO.so.

Suggested by @emelife

Fix #84271
2024-04-04 10:28:36 -07:00
Fangrui Song
9e3b64b9f9 [llvm-objcopy] Add --compress-sections
--compress-sections is similar to --compress-debug-sections but applies
to arbitrary sections.

* `--compress-sections <section>=none`: decompress sections
* `--compress-sections <section>=[zlib|zstd]`: compress sections with zlib/zstd

Like `--remove-section`, the pattern is by default a glob, but a regex
when --regex is specified.

For `--remove-section` like options, `!` prevents matches and is not
dependent on ordering (see `ELF/wildcard-syntax.test`). Since
`--compress-sections a=zlib --compress-sections a=none` naturally allows
overriding, having an order-independent `!` would be confusing.
Therefore, `!` is disallowed.

Sections within a segment are effectively immutable. Report an error for
an attempt to (de)compress them. `SHF_ALLOC` sections in a relocatable
file can be compressed, but linkers usually reject them.

Link: https://discourse.llvm.org/t/rfc-compress-arbitrary-sections-with-ld-lld-compress-sections/71674

Pull Request: https://github.com/llvm/llvm-project/pull/85036
2024-04-04 09:33:18 -07:00
Simon Pilgrim
1c7fda9f4c Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFC. 2024-04-04 12:26:34 +01:00
Stephen Tozer
708ce85690
[RemoveDIs][NFC] Use ScopedDbgInfoFormatSetter in more places (#87380)
The class `ScopedDbgInfoFormatSetter` was added as a convenient way to
temporarily change the debug info format of a function or module, as
part of IR printing; since this process is repeated in a number of other
places, this patch uses the format-setter class in those places as well.
2024-04-04 10:20:14 +01:00
Daniil Kovalev
4f19f15a60
[PAC][llvm-readobj][AArch64][ELF] Support GNU_PROPERTY_AARCH64_FEATURE_PAUTH (#87545)
Reland #85231 after fixing build failure
https://lab.llvm.org/buildbot/#/builders/186/builds/15631.
Use `PRIx64` for format output of `uint64_t` as hex.
Original PR description below.

This adds support for `GNU_PROPERTY_AARCH64_FEATURE_PAUTH` feature (as
defined in https://github.com/ARM-software/abi-aa/pull/240) handling in
llvm-readobj and llvm-readelf. The following constants for supported
platforms are also introduced:

- `AARCH64_PAUTH_PLATFORM_INVALID = 0x0`
- `AARCH64_PAUTH_PLATFORM_BAREMETAL = 0x1`
- `AARCH64_PAUTH_PLATFORM_LLVM_LINUX = 0x10000002`

For the llvm_linux platform, output of the tools contains descriptions
of PAuth features which are enabled/disabled depending on the version
value. Version value bits correspond to the following `LangOptions`
defined in #85232:

- bit 0: `PointerAuthIntrinsics`;
- bit 1: `PointerAuthCalls`;
- bit 2: `PointerAuthReturns`;
- bit 3: `PointerAuthAuthTraps`;
- bit 4: `PointerAuthVTPtrAddressDiscrimination`;
- bit 5: `PointerAuthVTPtrTypeDiscrimination`;
- bit 6: `PointerAuthInitFini`.

Support for `.note.AARCH64-PAUTH-ABI-tag` is dropped since it's deleted
from the spec in ARM-software/abi-aa#250.
2024-04-04 08:20:13 +03:00
Gulfem Savrun Yeniceri
be57c90fef Revert "dsymutil: Re-add missing -latomic (#85380)"
This reverts commit 23616c65e7d632e750ddb67d55cc39098a69a8a6
because it breaks Fuchsia Clang toolchain builders.
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8751656876289840849/overview
2024-04-03 23:14:31 +00:00
maflcko
23616c65e7
dsymutil: Re-add missing -latomic (#85380)
This was accidentally removed in
https://reviews.llvm.org/D137799#4657404 /
https://reviews.llvm.org/D137799#C3933303OL44, and downstream projects
are forced to add it back. For example,
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=4e26331a5ee87928a16888c36d51e270f0f10f90

Fix this, by re-adding it.

Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
2024-04-03 19:39:25 +02:00
Jonas Devlieghere
83402c3019
[dsymutil] Support generating dSYMs for firmware environments (#87432)
Support generating dSYM companion files for (non-Darwin) firmware
environments by considering the binary component of the triple in
addition to the OS component.

rdar://125629792
2024-04-02 20:43:28 -07:00
Daniil Kovalev
c45861f437
Revert "[PAC][llvm-readobj][AArch64][ELF] Support GNU_PROPERTY_AARCH64_FEATURE_PAUTH" (#87434)
Reverts llvm/llvm-project#85231

See build failure
https://lab.llvm.org/buildbot/#/builders/186/builds/15631
2024-04-03 03:15:47 +03:00
Daniil Kovalev
5029949952
[PAC][llvm-readobj][AArch64][ELF] Support GNU_PROPERTY_AARCH64_FEATURE_PAUTH (#85231)
This adds support for `GNU_PROPERTY_AARCH64_FEATURE_PAUTH` feature (as
defined in https://github.com/ARM-software/abi-aa/pull/240) handling in
llvm-readobj and llvm-readelf. The following constants for supported
platforms are also introduced:

- `AARCH64_PAUTH_PLATFORM_INVALID = 0x0`
- `AARCH64_PAUTH_PLATFORM_BAREMETAL = 0x1`
- `AARCH64_PAUTH_PLATFORM_LLVM_LINUX = 0x10000002`

For the llvm_linux platform, output of the tools contains descriptions
of PAuth features which are enabled/disabled depending on the version
value. Version value bits correspond to the following `LangOptions`
defined in #85232:

- bit 0: `PointerAuthIntrinsics`;
- bit 1: `PointerAuthCalls`;
- bit 2: `PointerAuthReturns`;
- bit 3: `PointerAuthAuthTraps`;
- bit 4: `PointerAuthVTPtrAddressDiscrimination`;
- bit 5: `PointerAuthVTPtrTypeDiscrimination`;
- bit 6: `PointerAuthInitFini`.

Support for `.note.AARCH64-PAUTH-ABI-tag` is dropped since it's deleted
from the spec in ARM-software/abi-aa#250.
2024-04-03 00:28:47 +03:00
Mingming Liu
1351d17826
[InstrFDO][TypeProf] Implement binary instrumentation and profile read/write (#66825)
(The profile format change is split into a standalone change into https://github.com/llvm/llvm-project/pull/81691)

* For InstrFDO value profiling, implement instrumentation and lowering for virtual table address.
* This is controlled by `-enable-vtable-value-profiling` and off by default.
* When the option is on, raw profiles will carry serialized `VTableProfData` structs and compressed vtables as payloads.
 
* Implement profile reader and writer support 
  * Raw profile reader is used by `llvm-profdata` but not compiler. Raw profile reader will construct InstrProfSymtab with symbol names, and map profiled runtime address to vtable symbols.
  * Indexed profile reader is used by `llvm-profdata` and compiler. When initialized, the reader stores a pointer to the beginning of in-memory compressed vtable names and the length of string. When used in `llvm-profdata`, reader decompress the string to show symbols of a profiled site. When used in compiler, string decompression doesn't
happen since IR is used to construct InstrProfSymtab.
  * Indexed profile writer collects the list of vtable names, and stores that to index profiles.
  * Text profile reader and writer support are added but mostly follow the implementation for indirect-call value type.
* `llvm-profdata show -show-vtables <args> <profile>` is implemented.

rfc in
https://discourse.llvm.org/t/rfc-dynamic-type-profiling-and-optimizations-in-llvm/74600#pick-instrumentation-points-and-instrument-runtime-types-7
2024-04-01 08:52:35 -07:00
Kazu Hirata
44253a9ce6
[memprof] Add MemProf version (#86414)
This patch adds a version field to the MemProf section of the indexed
profile format, calling the new version "version 1".  The existing
version is called "version 0".

The writer supports both versions via a command-line option:

  llvm-profdata merge --memprof-version=1 ...

The reader supports both versions by automatically detecting the
version from the header.
2024-03-28 14:29:34 -07:00
Justin Bogner
237572f2ff
[SPIR-V] Fix paths when copying spriv-dis and spirv-val on windows (#86876)
We need `CMAKE_EXECUTABLE_SUFFIX` here so we get the paths right when
they end in `.exe`.
2024-03-28 10:29:30 -07:00
Fangrui Song
2763353891
[Object,ELFType] Rename TargetEndianness to Endianness (#86604)
`TargetEndianness` is long and unwieldy. "Target" in the name is confusing. Rename it to "Endianness".

I cannot find noticeable out-of-tree users of `TargetEndianness`, but
keep `TargetEndianness` to make this patch safer. `TargetEndianness`
will be removed by a subsequent change.
2024-03-28 09:10:34 -07:00
Andrew Ng
c9db031c48
[Support] Fix color handling in formatted_raw_ostream (#86700)
The color methods in formatted_raw_ostream were forwarding directly to
the underlying stream without considering existing buffered output. This
would cause incorrect colored output for buffered uses of
formatted_raw_ostream.

Fix this issue by applying the color to the formatted_raw_ostream itself
and temporarily disabling scanning of any color related output so as not
to affect the position tracking.

This fix means that workarounds that forced formatted_raw_ostream
buffering to be disabled can be removed. In the case of llvm-objdump,
this can improve disassembly performance when redirecting to a file by
more than an order of magnitude on both Windows and Linux. This
improvement restores the disassembly performance when redirecting to a
file to a level similar to before color support was added.
2024-03-28 11:41:49 +00:00
Orlando Cazalet-Hyams
2a2fd488b6
[RemoveDIs] Update DIBuilder C API and OCaml bindings [2/2] (#86529)
Follow on from #84915 which adds the DbgRecord function variants. The C API
changes were reviewed in #85657.

# C API

Update the LLVMDIBuilderInsert... functions to insert DbgRecords instead
of debug intrinsics.

    LLVMDIBuilderInsertDeclareBefore
    LLVMDIBuilderInsertDeclareAtEnd
    LLVMDIBuilderInsertDbgValueBefore
    LLVMDIBuilderInsertDbgValueAtEnd

Calling these functions will now cause an assertion if the module is in the
wrong debug info format. They should only be used when the module is in "new
debug format".

Use LLVMIsNewDbgInfoFormat to query and LLVMSetIsNewDbgInfoFormat to change the
debug info format of a module.

Please see https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-change
(RemoveDIsDebugInfo.md) for more info.

# OCaml bindings

Add set_is_new_dbg_info_format and is_new_dbg_info_format to the OCaml bindings.
These can be used to set and query the current debug info mode. These will
eventually be removed, but are useful while we're transitioning between old and
new debug info formats.

Add string_of_lldbgrecord, like string_of_llvalue but prints DbgRecords.

In test dbginfo.ml, unconditionally set the module debug info to the new mode
and update CHECK lines to check for DbgRecords. Without this change the test
crashes because it attempts to insert DbgRecords (new default behaviour of
llvm_dibuild_insert_declare_...) into a module that is in the old debug info
mode.
2024-03-28 08:54:27 +00:00
Aiden Grossman
fa90a0aa0e [llvm-exegesis] Improve error handling for shm_open calls
This patch adds error handling for shm_open failures in one case where
they were not handled before and also makes an error handler in another
case report the value of errno for diagnosis.
2024-03-27 13:25:44 -07:00
Carlos Alberto Enciso
9c0c98ed37
[llvm-debuginfo-analyzer][DOC] Convert 'README.txt' to markdown. (#86394)
As part of the WebAssembly support work
https://github.com/llvm/llvm-project/pull/85566

The README.txt is a bit odd since it only lists issues and problems
without talking about what works. It’s also hard to read on the GitHub
web view.

- Convert to Markdown and linking to the command docs
https://llvm.org/docs/CommandGuide/llvm-debuginfo-analyzer
- Rename some left 'elf reader' to 'DWARF reader'.
2024-03-27 05:27:44 +00:00
Cooper Partin
c62c74639a
Add support for PSV EntryFunctionName (#86296)
This change introduces a version 3 of the PSV data that includes support
for the name of the entry function as an offset into StringTable data to
a null-terminated utf-8 string.

Additional tests were added to ensure that the new value was properly
serialized/deserialized from object data.

Fixes #80175

---------

Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-03-25 10:18:53 -07:00
Martin Storsjö
336bdf1a25 [verify-uselistorder] Fix a typo, fix linking
This fixes a typo from 2ef612050844355906e4b67d892a00bbb58c41d6,
which broke the build with errors like:

    ld.lld: error: undefined symbol: LoadBitcodeIntoNewDbgInforFormat
    >>> referenced by verify-uselistorder.cpp
    >>>               tools/verify-uselistorder/CMakeFiles/verify-uselistorder.dir/verify-uselistorder.cpp.o:(main)
    >>> did you mean: LoadBitcodeIntoNewDbgInfoFormat
    >>> defined in: lib/libLLVMBitReader.a(BitcodeReader.cpp.o)
    collect2: error: ld returned 1 exit status
2024-03-25 11:53:20 +02:00
Orlando Cazalet-Hyams
8263a88334
[RemoveDIs] Load into new debug info format by default in llvm-link (#86274)
Directly load all bitcode into the new debug info format in llvm-link.
This means that new-mode bitcode no longer round-trips back to old-mode
after parsing, and that old-mode bitcode gets auto-upgraded to new-mode
debug info (which is the current in-memory default in LLVM).
2024-03-25 09:29:19 +00:00
Orlando Cazalet-Hyams
2ef6120508
[RemoveDIs] Do not load into new debug info format from bitcode by default (#86268)
This is NFC right now, as the global default behaviour is also "do not
load into the new debug info format by default", but we want to change
that soon.

Additionally unconditionally convert from the new debug info format into
if we've loaded into it (e.g., if the bitcode file loaded was already in
the new format).

The latter change is needed because verify-uselistorder doesn't yet
understand DbgRecords (it doesn't know how to map them).

The former change is needed because if we load from an old debug format
bitcode file but load directly into the new format _and then convert
back to the old mode after_, the use-lists of the debug intrinsic
functions (the functions' global value uses) change.
2024-03-25 09:28:01 +00:00
Orlando Cazalet-Hyams
e550022b68
[RemoveDIs] Load into new debug info format by default in llvm-dis (#86276)
Directly load all bitcode into the new debug info format in llvm-dis.
This means that new-mode bitcode no longer round-trips back to old-mode
after parsing, and that old-mode bitcode gets auto-upgraded to new-mode
debug info (which is the current in-memory default in LLVM).
2024-03-25 09:26:27 +00:00
Aiden Grossman
50e6218132 Reland "[llvm-exegesis] Add thread IDs to subprocess memory names (#84451)"
This reverts commit 1fe9c417a0bf143f9bb9f9e1fbf7b20f44196883.

This relands commit 6bbe8a296ee91754d423c59c35727eaa624f7140.

This was causing build failures on one of the ARMv8 builders. Still not
completely sure why, but relanding it to see if the failure pops up
again. If it does, the plan is to fix forward by disabling tests on ARM
temporarily as llvm-exegesis does not currently use SubprocessMemory
on ARM.
2024-03-22 11:51:09 -07:00
Aiden Grossman
36a6afdd2c Reland "[llvm-exegesis] Refactor parent code to separate function (#86232)"
This reverts commit c3a41aac5f32475b9a0499e6e888e713763566dc.

This relands commit bd493756fa51e538575fc320aae50d75394f0567.

Apparently I forgot to update a couple values, so this change failed on
every builder that builds those sections (should be every Linux
platform) rather than something architecture specific like originally
thought. I swore I updated the values and ran check-llvm before merging.
Wondering If I forgot to push those changes...
2024-03-22 10:30:42 -07:00
Aiden Grossman
c3a41aac5f Revert "[llvm-exegesis] Refactor parent code to separate function (#86232)"
This reverts commit bd493756fa51e538575fc320aae50d75394f0567.

Causes build failures on non-X86 platforms.
https://lab.llvm.org/buildbot/#/changes/128363
2024-03-22 10:25:23 -07:00
Aiden Grossman
bd493756fa
[llvm-exegesis] Refactor parent code to separate function (#86232)
This patch refactors the parent code to a separate function in the
subprocess executor to make the code more clear and easy to follow.
2024-03-22 10:01:39 -07:00
Orlando Cazalet-Hyams
26857582e5 Revert "[RemoveDIs] Update DIBuilder C API with DbgRecord functions [2/2] (#85657)"
This reverts commit 2091c74796b1dac68e622284c63a870b88b7554f.

Builtbot failure: https://lab.llvm.org/buildbot/#/builders/16/builds/63080
2024-03-22 16:21:50 +00:00
Orlando Cazalet-Hyams
2091c74796
[RemoveDIs] Update DIBuilder C API with DbgRecord functions [2/2] (#85657)
Follow on from #84915 which adds the DbgRecord function variants.

Update the LLVMDIBuilderInsert... functions to insert DbgRecords instead
of debug intrinsics.

    LLVMDIBuilderInsertDeclareBefore
    LLVMDIBuilderInsertDeclareAtEnd
    LLVMDIBuilderInsertDbgValueBefore
    LLVMDIBuilderInsertDbgValueAtEnd

Calling these functions will now cause an assertion if the module is in the
wrong debug info format. They should only be used when the module is in "new
debug format".

Use LLVMIsNewDbgInfoFormat to query and LLVMSetIsNewDbgInfoFormat to change the
debug info format of a module.

Please see https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-change
(RemoveDIsDebugInfo.md) for more info.
2024-03-22 15:47:40 +00:00
Orlando Cazalet-Hyams
b3f98dff75
[RemoveDIs] Load into new debug info format by default in llvm-lto and llvm-lto2 (#86271)
Directly load all bitcode into the new debug info format in `llvm-lto`
and `llvm-lto2`. This means that new-mode bitcode no longer round-trips
back to old-mode after parsing, and that old-mode bitcode gets
auto-upgraded to new-mode debug info (which is the current in-memory
default in LLVM).
2024-03-22 13:52:11 +00:00
Aiden Grossman
718fbbef5f
[llvm-exegesis] Kill process that recieve a signal (#86069)
Before this patch, llvm-exegesis would leave processes lingering that
experienced signals like segmentation faults. They would up in a
signal-delivery-stop state under the ptrace and never exit. This does
not cause problems (or at least many) in llvm-exegesis as they are
cleaned up after the main process exits, which usually happens quickly.
However, in downstream use, when many blocks are being executed (many of
which run into signals) within a single process, these processes stay
around and can easily exhaust the process limit on some systems.

This patch cleans them up by sending SIGKILL after information about the
signal that was sent has been gathered.
2024-03-21 18:14:18 -07:00
Nathan Lanza
d22cf4365c
[cmake] Place clang behind mlir in the liist of external projects
In preparation for the initial ClangIR upstreaming process, move clang
behind MLIR in the list of external projects. Otherwise, cmake will
attempt to build clang before MLIR.

reland of https://github.com/llvm/llvm-project/pull/86050

Reviewers: 

Pull Request: https://github.com/llvm/llvm-project/pull/86210
2024-03-21 19:52:19 -04:00
Cooper Partin
1538b82fd3
Revert "Add support for PSV EntryFunctionName (#84409)" (#86211)
This reverts commit cde54df39cab3a1d60a3e1862ab341609bee3cc3.

Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-03-21 15:40:29 -07:00
Cooper Partin
cde54df39c
Add support for PSV EntryFunctionName (#84409)
This change introduces a version 3 of the PSV data that includes support
for the name of the entry function as an offset into StringTable data to
a null-terminated utf-8 string.

Additional tests were added to ensure that the new value was properly
serialized/deserialized from object data.

Fixes #80175

---------

Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
2024-03-21 14:43:15 -07:00
Ilia Kuklin
4946cc37f4
[llvm-objcopy] Add --skip-symbol and --skip-symbols options (#80873)
Add --skip-symbol and --skip-symbols options that allow to skip symbols
when executing other options that can change the symbol's name, binding
or visibility, similar to an existing option --keep-symbol that keeps a
symbol from being removed by other options.
2024-03-21 17:05:35 +05:00
Nathan Lanza
cbcdf126cc Revert "[cmake] Place clang behind mlir in the list of external projects (#86050)"
This reverts commit 26c290b46ac6b4a81feb28ae1862fac961138a24.
2024-03-20 23:51:00 -07:00
Nathan Lanza
26c290b46a
[cmake] Place clang behind mlir in the list of external projects (#86050)
In preparation for the initial ClangIR upstreaming process, move clang
behind MLIR in the list of external projects. Otherwise, cmake will
attempt to build clang before MLIR.
2024-03-21 01:42:59 -04:00
quic-areg
31f4b329c8
[Hexagon] ELF attributes for Hexagon (#85359)
Defines a subset of attributes and emits them to a section called
.hexagon.attributes.

The current attributes recorded are the attributes needed by
llvm-objdump to automatically determine target features and eliminate
the need to manually pass features.
2024-03-19 16:22:30 -05:00
Stephen Tozer
ffd08c7759
[RemoveDIs][NFC] Rename DPValue -> DbgVariableRecord (#85216)
This is the major rename patch that prior patches have built towards.
The DPValue class is being renamed to DbgVariableRecord, which reflects
the updated terminology for the "final" implementation of the RemoveDI
feature. This is a pure string substitution + clang-format patch. The
only manual component of this patch was determining where to perform
these string substitutions: `DPValue` and `DPV` are almost exclusively
used for DbgRecords, *except* for:

- llvm/lib/target, where 'DP' is used to mean double-precision, and so
appears as part of .td files and in variable names. NB: There is a
single existing use of `DPValue` here that refers to debug info, which
I've manually updated.
- llvm/tools/gold, where 'LDPV' is used as a prefix for symbol
visibility enums.

Outside of these places, I've applied several basic string
substitutions, with the intent that they only affect DbgRecord-related
identifiers; I've checked them as I went through to verify this, with
reasonable confidence that there are no unintended changes that slipped
through the cracks. The substitutions applied are all case-sensitive,
and are applied in the order shown:

```
  DPValue -> DbgVariableRecord
  DPVal -> DbgVarRec
  DPV -> DVR
```

Following the previous rename patches, it should be the case that there
are no instances of any of these strings that are meant to refer to the
general case of DbgRecords, or anything other than the DPValue class.
The idea behind this patch is therefore that pure string substitution is
correct in all cases as long as these assumptions hold.
2024-03-19 20:07:07 +00:00
Jonas Devlieghere
32a6e9d669
[dsymutil] Remove support for obfuscated bitcode (#85713)
Remove support for obfuscated bitcode in dsymutil and the DWARF linker.
We no longer support bitcode submissions and the obfuscation support has
been removed from the rest of the compiler.

rdar://123863918
2024-03-19 12:30:50 -07:00
Andres Villegas
3176c15719
Revert "[dsymutil] Remove support for obfuscated bitcode" (#85826)
Reverts llvm/llvm-project#85713 Since it is breaking Linux x64 builds.
2024-03-19 13:58:31 -04:00
Fangrui Song
24f22b3f93
[llvm-readelf] Print a blank line for the first hex/string dump
GNU readelf prints a blank line before the first hex/string dump, which
serves as a separator when there are other dump operations. Port the
behavior.

Pull Request: https://github.com/llvm/llvm-project/pull/85744
2024-03-19 09:38:55 -07:00
Jonas Devlieghere
43a2ec483f
[dsymutil] Remove support for obfuscated bitcode (#85713)
Remove support for obfuscated bitcode in dsymutil and the DWARF linker.
We no longer support bitcode submissions and the obfuscation support has
been removed from the rest of the compiler.

rdar://123863918
2024-03-19 08:30:47 -07:00
alx32
b59c2a0eb4
[llvm-objdump][macho] Fix relative method list dumping for little endian hosts (#85778)
`macho-relative-method-lists.test` is failing on little endian
platforms, when matching 'name'.

```
CHK32-NEXT: name 0x144 (0x{{[0-9a-f]*}}) instance_method_00

next:10'0             X error: no match found
          18:  name 0x144 (0x7ac)      
```
This seems like the obvious fix.

Co-authored-by: Alex B <alexborcan@meta.com>
2024-03-19 07:43:09 -07:00
Orlando Cazalet-Hyams
4f909da6bc
[RemoveDIs] Add flag to control loading into new debug mode from bitcode (#85649)
--load-bitcode-into-experimental-debuginfo-iterators

      false: Convert to the old debug mode after reading.
      true: Upgrade to the new debug info format (*).
      unset: Same as false (for now).

(*) As of this patch it actually just means "don't convert to either
mode after loading". Auto-upgrading will be implemented in an upcoming
patch.

With this flag we can incrementally add support for RemoveDIs by
overriding the "unset" behaviour in individual tools. The flag can be
removed once all tools support the new debug info mode.
2024-03-19 12:12:35 +00:00
Martin Storsjö
cb2ca23345
[llvm-shlib] Fix the version naming style of libLLVM for Windows (#85710)
This reverts the changes from 91a384621e5b762d9c173ffd247cfeadd5f436a2
for Windows targets. The changes in that commit don't work as expected
for Windows targets (those parts of llvm_add_library don't quite behave
the same for Windows), while the previous status quo (producing a
library named "libLLVM-<major>.dll") is the defacto standard way of
doing versioned library names there, contrary to on Unix.

After that commit, the library always ended up named "libLLVM.dll",
executables linking against it would reference "libLLVM.dll", and
"libLLVM-<major>.dll" was provided as a symlink.

Thus revert this bit back to as it were, so that executables actually
link against a versioned libLLVM, and no separate symlink is needed.

The only thing that might be improved compared to the status quo as it
was before these changes, is that the import library is named
"lib/libLLVM-<major>.dll.a", while the common style would be to name it
plainly "lib/libLLVM.dll.a" (even while it produces references to
"libLLVM-<major>.dll", but none of these had that effect for Windows
targets.

(As a side note, the llvm-shlib library can be built for MinGW, but not
currently in MSVC configurations.)
2024-03-19 08:48:57 +02:00
Benji Smith
a8bda0b4a6
[C API] Add accessors for function prefix and prologue data (#82193)
A test is added to echo.ll, and the echo.cpp part of llvm-c-test is
updated to clone a function's prefix and prologue.
2024-03-18 14:58:22 +01:00
Orlando Cazalet-Hyams
f0dbcfe352
[RemoveDIs] Update DIBuilder C API with DbgRecord functions [1/2] (#84915)
Follow on from #84739, which updates the DIBuilder class.

All the functions that have been added are temporary and will be
deprecated in the future. The intention is that they'll help downstream
projects adapt during the transition period.

```
New functions (all to be deprecated)
------------------------------------
LLVMIsNewDbgInfoFormat                      # Returns true if the module is in the new non-instruction mode.
LLVMSetIsNewDbgInfoFormat                   # Convert to the requested debug info format.

LLVMDIBuilderInsertDeclareIntrinsicBefore   # Insert a debug intrinsic (old debug info format). 
LLVMDIBuilderInsertDeclareIntrinsicAtEnd    # Same as above.
LLVMDIBuilderInsertDbgValueIntrinsicBefore  # Same as above.
LLVMDIBuilderInsertDbgValueIntrinsicAtEnd   # Same as above.

LLVMDIBuilderInsertDeclareRecordBefore      # Insert a debug record (new debug info format). 
LLVMDIBuilderInsertDeclareRecordAtEnd       # Same as above.
LLVMDIBuilderInsertDbgValueRecordBefore     # Same as above.
LLVMDIBuilderInsertDbgValueRecordAtEnd      # Same as above.
```

The existing `LLVMDIBuilderInsert...` functions call through to the
intrinsic versions (old debug info format) currently.

In the next patch, I'll swap them to call the debug records versions
(new debug info format). Downstream users of this API can query and
change the current format using the first two functions above, or can
instead opt to temporarily use intrinsics or records explicitly.
2024-03-18 11:45:14 +00:00
Carlos Alberto Enciso
c1ccf0781b
[llvm-debuginfo-analyzer][NFC] Rename LVElfReader.cpp[h] (#85530)
As part of the WebAssembly support work review
  https://github.com/llvm/llvm-project/pull/82588

It was decided to rename:

  Files: LVElfReader.cpp[h] -> LVDWARFReader.cpp[h]
         ELFReaderTest.cpp  -> DWARFReaderTest.cpp

  Class: LVELFReader        -> LVDWARFReader

The name LVDWARFReader would match the another reader LVCodeViewReader
as they will reflect the type of
debug information format that they are parsing.
2024-03-18 05:08:42 +00:00
Carlos Alberto Enciso
c8da99959d
[llvm-debuginfo-analyzer][DOC] Change .wasm references to .o (#85566)
As part of the WebAssembly support work
https://github.com/llvm/llvm-project/pull/82588

As the object files used in the test cases are a single object (just
produced by clang without being processed by wasm-ld), it was determined
to use .o intead of .wasm.

Update the README.txt to reflect that the tool now supports WebAssembly.
2024-03-18 05:07:08 +00:00