345 Commits

Author SHA1 Message Date
Fangrui Song
b1cd3cb3f4 [MC] Replace getSymA()->getSymbol() with getAddSym. NFC
We will replace the MCSymbolRefExpr member in MCValue with MCSymbol.
This change reduces dependence on MCSymbolRefExpr.
2025-04-05 13:34:24 -07:00
Fangrui Song
086af83688 [MC] Replace getSymA()->getSymbol() with getAddSym. NFC
We will replace the MCSymbolRefExpr member in MCValue with MCSymbol.
This change reduces dependence on MCSymbolRefExpr.
2025-04-05 13:23:14 -07:00
Fangrui Song
b73e144bdf MCValue: Simplify code with getSubSym
MCValue::SymB is a MCSymbolRefExpr *, which might become MCSymbol * in
the future. Simplify some code that uses MCValue::SymB.
2025-03-23 12:13:13 -07:00
Fangrui Song
7722d7519c [MC] evaluateAsRelocatableImpl: remove the Fixup argument
Follow-up to d6fbffa23c84e622735b3e880fd800985c1c0072 . This commit
updates all call sites and removes the argument from the function.
2025-03-15 16:10:19 -07:00
Yaxun (Sam) Liu
da0f9e75d8
Reland: [MC] output inlined-at debug info (#106230) (#130306)
Reland https://github.com/llvm/llvm-project/pull/106230

The original PR was reverted due to compilation time regression.

This PR fixed that by adding a condition OutStreamer->isVerboseAsm() to
the generation of extra inlined-at debug info, so that it does not
affect normal compilation time.

Currently MC print source location of instructions in comments in
assembly when debug info is available, however, it does not include
inlined-at locations when a function is inlined.

For example, function foo is defined in header file a.h and is called
multiple times in b.cpp. If foo is inlined, current assembly will only
show its instructions with their line numbers in a.h. With inlined-at
locations, the assembly will also show where foo is called in b.cpp.

This patch adds inlined-at locations to the comments by using
DebugLoc::print. It makes the printed source location info consistent
with those printed by machine passes.
2025-03-11 09:43:14 -04:00
Nikita Popov
aa1d2cc5d7 Revert "[MC] output inlined-at debug info (#106230)"
This reverts commit f3dc358953a13caf7521fc615a08f6317930351c.

This causes a large compile-time regression:
https://llvm-compile-time-tracker.com/compare.php?from=267403442264959f6b06e227ff450c385f4b3ef2&to=f3dc358953a13caf7521fc615a08f6317930351c&stat=instructions:u
2025-03-07 09:45:15 +01:00
Yaxun (Sam) Liu
f3dc358953
[MC] output inlined-at debug info (#106230)
Currently MC print source location of instructions in comments in
assembly when debug info is available, however, it does not include
inlined-at locations when a function is inlined.

For example, function foo is defined in header file a.h and is called
multiple times in b.cpp. If foo is inlined, current assembly will only
show its instructions with their line numbers in a.h. With inlined-at
locations, the assembly will also show where foo is called in b.cpp.

This patch adds inlined-at locations to the comments by using
DebugLoc::print. It makes the printed source location info consistent
with those printed by machine passes.
2025-03-06 22:47:11 -05:00
Fangrui Song
60486292b7 [MC] Move MIPS-specific gprel/tprel/dtprel from MCStreamer to MipsTargetStreamer
https://reviews.llvm.org/D23669 inappropriately added MIPS-specific
dtprel/tprel directives to MCStreamer. In addition,
llvm-mc -filetype=null parsing these directives will crash.
This patch moves these functions to MipsTargetStreamer and fixes
-filetype=null.

gprel32 and gprel64, called by AsmPrinter, are moved to
MCTargetStreamer.
2025-03-02 14:59:21 -08:00
Fangrui Song
3fa5b52714 [MC] Decrease direct access to getContents()
to make it easier to store fragment contents out-of-line. Loosely based
on Alexis Engelke's prototype.
2024-12-21 17:14:26 -08:00
alx32
28646d0cc1
[MC] Add .loc_label instruction (#99710)
As discussed in [the
RFC](https://discourse.llvm.org/t/rfc-extending-llvm-mc-loc-directive-with-labeling-support/79608)
we need a way to create labels in the assembler-generated line section
in order to support the future addition of the
[DW_AT_LLVM_stmt_sequence](https://discourse.llvm.org/t/rfc-new-dwarf-attribute-for-symbolication-of-merged-functions/79434)
attribute.

We have a similar precedent for such behavior with the
[.cfi_label](https://github.com/llvm/llvm-project/pull/97922)
instruction - so we add the `.loc_label THE_LABEL_NAME` instruction
which:
- Terminates the current line sequence in the line section
- Creates a new label with the specified label name in the `.debug_line`
section
2024-09-20 06:32:34 -07:00
Fangrui Song
211494705b MCObjectStreamer: Remove an unneeded getBackendPtr test
All of `MCAsmBackend`, `MCCodeEmitter`, and `MCObjectWriter` must be
non-null.
2024-07-22 23:03:43 -07:00
Fangrui Song
219d80bcb7 MCAssembler: Move FileNames and CompilerVersion to MCObjectWriter 2024-07-22 20:20:32 -07:00
Alexis Engelke
f15266e9d5
[MC][ELF] Emit instructions directly into fragment (#94950)
Avoid needless copying of instructions and fixups and directly emit into
the fragment small vectors.

This (optionally, second commit) also removes the single use of the
MCCompactEncodedInstFragment to simplify code.
2024-07-04 16:46:31 +02:00
Fangrui Song
db48f1a176 [MC] Remove nullable getCurrentSectionOnly use from AsmParser
We will implement getCurrentSectionOnly with `CurFrag->getParent()`,
which is non-null. Eliminate a nullable use.
2024-06-27 22:37:37 -07:00
Fangrui Song
fcffb2c024 [MC] Replace one nullable getCurrentSectionOnly with CurFrag
We will implement getCurrentSectionOnly with `CurFrag->getParent()`,
which is non-null. Eliminate a nullable use.
2024-06-27 22:27:14 -07:00
Fangrui Song
fadc72235e [MC] switchSectionNoPrint: update CurFrag
To ensure that CurFrag->Parent and SectionStack.back() are in sync.
2024-06-27 22:00:40 -07:00
Fangrui Song
eaf816f6cb [MC] Remove unneeded nullness check from getOrCreateDataFragment. NFC
`getCurrentFragment()` no longer returns null after
7423bf78eb53d81ce0c7b3a38e39a56341ca2a89.
2024-06-27 20:13:10 -07:00
Fangrui Song
e48c4011ca [MC] Cache current fragment in MCStreamer
This eliminates indirection through `getCurrentSectionOnly()->curFragList()->Tail`.
2024-06-27 19:44:37 -07:00
Fangrui Song
7423bf78eb [MC] Ensure subsections have a MCDataFragment
Similar to 21fac2d1d060b0f9b11a746718e58d4cd1ee97e5 for sections. This
makes it feasible to cache the current fragment in MCStreamer.
2024-06-27 19:12:35 -07:00
Fangrui Song
aa3589f0cc
[MC,X86] emitInstruction: remove virtual function calls due to Intel JCC Erratum
https://reviews.llvm.org/D70157 (for Intel Jump Conditional Code
Erratum) introduced two virtual function calls in the generic
MCObjectStreamer::emitInstruction, which added some overhead.

This patch removes the virtual function overhead:

* Define `llvm::X86_MC::emitInstruction` that calls `emitInstruction{Begin,End}`.
* Define {X86ELFStreamer,X86WinCOFFStreamer}::emitInstruction to call `llvm::X86_MC::emitInstruction`

Pull Request: https://github.com/llvm/llvm-project/pull/96835
2024-06-27 09:43:32 -07:00
Fangrui Song
e7622ab472 [MC] Remove unused MCObjectStreamer::CurSubsectionIdx. NFC 2024-06-22 23:23:47 -07:00
Fangrui Song
95f983f823 [MC] Change Subsection parameters from const MCExpr * to uint32_t
Follow-up to 05ba5c0648ae5e80d5afce270495bf3b1eef9af4. uint32_t is
preferred over const MCExpr * in the section stack uses because it
should only be evaluated once. Change the paramter type to match.
2024-06-22 21:48:11 -07:00
Fangrui Song
05ba5c0648 [MC] MCSectionSubPair: replace const MCExpr * with uint32_t 2024-06-22 19:44:52 -07:00
Fangrui Song
485d7eaefd [MC] Remove remnant code related to pending labels 2024-06-22 09:41:34 -07:00
Fangrui Song
7500646629 [MC] Remove pending labels
This commit removes the complexity introduced by pending labels in
https://reviews.llvm.org/D5915 by using a simpler approach. D5915 aimed
to ensure padding placement before `.Ltmp0` for the following code, but
at the cost of expensive per-instruction `flushPendingLabels`.

```
// similar to llvm/test/MC/X86/AlignedBundling/labeloffset.s
.bundle_lock align_to_end
  calll   .L0$pb
.bundle_unlock
.L0$pb:
  popl    %eax
.Ltmp0:   //// padding should be inserted before this label instead of after
  addl    $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %eax
```

(D5915 was adjusted by https://reviews.llvm.org/D8072 and
https://reviews.llvm.org/D71368)

This patch achieves the same goal by setting the offset of the empty
MCDataFragment (`Prev`) in `layoutBundle`. This eliminates the need for
pending labels and simplifies the code.

llvm/test/MC/MachO/pending-labels.s (D71368): relocation symbols are
changed, but the result is still supported by linkers.
2024-06-22 00:34:16 -07:00
Fangrui Song
4684d0c007 [MC] emitLabelAtPos: change parameter to MCDataFragment &. NFC
emitLabelAtPos is only called by ARMELFStreamer with MCDataFragment.
2024-06-21 23:46:58 -07:00
Fangrui Song
87424778ef [MC] Remove the Parent parameter from MCFragment ctor callers. NFC 2024-06-21 22:47:55 -07:00
Fangrui Song
b1932b8483
[MC] Aligned bundling: remove special handling for RelaxAll
When both aligned bundling and RelaxAll are enabled, bundle padding is
directly written into fragments (https://reviews.llvm.org/D8072).
(The original motivation was memory usage, which has been achieved from
different angles with recent assembler improvement).

The code presents challenges with the work to replace fragment
representation (e.g. #94950 #95077). This patch removes the special
handling. RelaxAll still works but the behavior seems slightly different
as revealed by 2 changed tests. However, most `-mc-relax-all` tests are
unchanged.

RelaxAll used to be the default for clang -O0. This mode has significant
code size drawbacks and newer Clang doesn't use it (#90013).

---

flushPendingLabels: The FOffset parameter can be removed: pending labels
will be assigned to the incoming fragment at offset 0.

Pull Request: https://github.com/llvm/llvm-project/pull/95188
2024-06-14 10:01:36 -07:00
Fangrui Song
f808abf508
[MC] Add MCFragment allocation helpers
`allocFragment` might be changed to a placement new when the allocation
strategy changes.

`allocInitialFragment` is to deduplicate the following pattern
```
  auto *F = new MCDataFragment();
  Result->addFragment(*F);
  F->setParent(Result);
```

Pull Request: https://github.com/llvm/llvm-project/pull/95197
2024-06-14 09:39:32 -07:00
Fangrui Song
90a23d3a5a [MC] Restore setOffset(0) in emitLabel
For bolt/test/runtime/X86/exceptions-pic.test, llvm-bolt seems to call
emitLabel twice and the assert will fail. Work around it after
2cc4bc132cbcc76c5552cbc128830943ea596b3e
2024-06-12 19:53:43 -07:00
Fangrui Song
2cc4bc132c MCFragment: Initialize Offset to 0
After 9d0754ada5dbbc0c009bcc2f7824488419cc5530 ("[MC] Relax fragments
eagerly") removes the assert of Offset, it is no longer useful to
initialize the member to -1.

Now the symbol value estimate is more precise, which leads to slight
behavior change to layout-interdependency.s.
2024-06-12 14:13:20 -07:00
Fangrui Song
de19f7b6d4
[MC] Replace fragment ilist with singly-linked lists
Fragments are allocated with `operator new` and stored in an ilist with
Prev/Next/Parent pointers. A more efficient representation would be an
array of fragments without the overhead of Prev/Next pointers.

As the first step, replace ilist with singly-linked lists.

* `getPrevNode` uses have been eliminated by previous changes.
* The last use of the `Prev` pointer remains: for each subsection, there is an insertion point and
  the current insertion point is stored at `CurInsertionPoint`.
* `HexagonAsmBackend::finishLayout` needs a backward iterator. Save all
  fragments within `Frags`. Hexagon programs are usually small, and the
  performance does not matter that much.

To eliminate `Prev`, change the subsection representation to
singly-linked lists for subsections and a pointer to the active
singly-linked list. The fragments from all subsections will be chained
together at layout time.

Since fragment lists are disconnected before layout time, we can remove
`MCFragment::SubsectionNumber` (https://reviews.llvm.org/D69411). The
current implementation of `AttemptToFoldSymbolOffsetDifference` requires
future improvement for robustness.

Pull Request: https://github.com/llvm/llvm-project/pull/95077
2024-06-11 09:18:31 -07:00
Fangrui Song
cb63abca27 [MC] Remove getFragmentList uses. NFC 2024-06-10 18:27:34 -07:00
aengelke
77220823da
[MC] Maintain MCRelaxAll after reset() (#94945)
RelaxAll was set in the constructor, but cleared after reset().
2024-06-10 20:41:21 +02:00
Fangrui Song
9500a5d02e [MC] Make UseAssemblerInfoForParsing mostly true
Commit 6c0665e22174d474050e85ca367424f6e02476be
(https://reviews.llvm.org/D45164) enabled certain constant expression
evaluation for `MCObjectStreamer` at parse time (e.g. `.if` directives,
see llvm/test/MC/AsmParser/assembler-expressions.s).

`getUseAssemblerInfoForParsing` was added to make `clang -c` handling
inline assembly similar to `MCAsmStreamer` (e.g. `llvm-mc -filetype=asm`),
where such expression folding (related to
`AttemptToFoldSymbolOffsetDifference`) is unavailable.

I believe this is overly conservative. We can make some parse-time
expression folding work for `clang -c` even if `clang -S` would still
report an error, a MCAsmStreamer issue (we cannot print `.if`
directives) that should not restrict the functionality of
MCObjectStreamer.

```
% cat b.cc
asm(R"(
.pushsection .text,"ax"
.globl _start; _start: ret
.if . -_start == 1
  ret
.endif
.popsection
)");
% gcc -S b.cc && gcc -c b.cc
% clang -S -fno-integrated-as b.cc     # succeeded

% clang -c b.cc     # succeeded with this patch
% clang -S b.cc     # still failed
<inline asm>:4:5: error: expected absolute expression
    4 | .if . -_start == 1
      |     ^
1 error generated.
```

However, removing `getUseAssemblerInfoForParsing` would make
MCDwarfFrameEmitter::Emit (for .eh_frame FDE) slow (~4% compile time
regression for sqlite3.c amalgamation) due to expensive
`AttemptToFoldSymbolOffsetDifference`. For now, make
`UseAssemblerInfoForParsing` false in MCDwarfFrameEmitter::Emit.

Close #62520
Link: https://discourse.llvm.org/t/rfc-clang-assembly-object-equivalence-for-files-with-inline-assembly/78841

Pull Request: https://github.com/llvm/llvm-project/pull/91082
2024-05-19 23:35:15 -07:00
Nikita Popov
fa750f09be Revert "[MC] Remove UseAssemblerInfoForParsing"
This reverts commit 03c53c69a367008da689f0d2940e2197eb4a955c.

This causes very large compile-time regressions in some cases,
e.g. sqlite3 at O0 regresses by 5%.
2024-05-16 09:56:07 +09:00
Fangrui Song
03c53c69a3
[MC] Remove UseAssemblerInfoForParsing
Commit 6c0665e22174d474050e85ca367424f6e02476be
(https://reviews.llvm.org/D45164) enabled certain constant expression
evaluation for `MCObjectStreamer` at parse time (e.g. `.if` directives,
see llvm/test/MC/AsmParser/assembler-expressions.s).

`getUseAssemblerInfoForParsing` was added to make `clang -c` handling
inline assembly similar to `MCAsmStreamer` (e.g. `llvm-mc -filetype=asm`),
where such expression folding (related to
`AttemptToFoldSymbolOffsetDifference`) is unavailable.

I believe this is overly conservative. We can make some parse-time
expression folding work for `clang -c` even if `clang -S` would still
report an error, a MCAsmStreamer issue (we cannot print `.if`
directives) that should not restrict the functionality of
MCObjectStreamer.

```
% cat b.cc
asm(R"(
.pushsection .text,"ax"
.globl _start; _start: ret
.if . -_start == 1
  ret
.endif
.popsection
)");
% gcc -S b.cc && gcc -c b.cc
% clang -S -fno-integrated-as b.cc     # succeeded

% clang -c b.cc     # succeeded with this patch
% clang -S b.cc     # still failed
<inline asm>:4:5: error: expected absolute expression
    4 | .if . -_start == 1
      |     ^
1 error generated.
```

Close #62520
Link: https://discourse.llvm.org/t/rfc-clang-assembly-object-equivalence-for-files-with-inline-assembly/78841

Pull Request: https://github.com/llvm/llvm-project/pull/91082
2024-05-15 09:18:39 -07:00
Fangrui Song
45b59cb1d4 [MC] Move setRelaxAll() calls to MCObjectStreamer
Related to clean-up opportunities discussed at #90013.
2024-04-25 13:54:04 -07:00
Vinayak Dev
9ea34be3e4
[MC]: Fix typo in MCObjectStreamer.cpp (#80856)
Fixes a typo in llvm/lib/MC/MCObjectStreamer.cpp introduced in #80162
2024-02-06 16:54:17 +01:00
stephenpeckham
b1acb7a315
[XCOFF] Add compiler version to an auxiliary symbol table entry (#80162)
C_FILE symbols. To match the behavior of the assembler and the legacy
compiler, this includes using the generic ".file" name for the C_FILE
symbol and generating the actual file name in an auxiliary entry.
2024-02-06 09:08:18 -06:00
stephenpeckham
032a70ee11
[NFC] Fix typo (#80703) 2024-02-05 12:42:43 -06:00
Amir Ayupov
9fec33aadc Revert "[BOLT] Fix unconditional output of boltedcollection in merge-fdata (#78653)"
This reverts commit 82bc33ea3f1a539be50ed46919dc53fc6b685da9.

Accidentally pushed unrelated changes.
2024-01-18 19:59:09 -08:00
Amir Ayupov
82bc33ea3f
[BOLT] Fix unconditional output of boltedcollection in merge-fdata (#78653)
Fix the bug where merge-fdata unconditionally outputs boltedcollection 
line, regardless of whether input files have it set.

Test Plan:
Added bolt/test/X86/merge-fdata-nobat-mode.test which fails without this
fix.
2024-01-18 19:44:16 -08:00
Fangrui Song
8275dc9748 [MC] .reloc: register used symbols
When `sym` in `.reloc ., BFD_RELOC_NONE, sym` is not referenced
elsewhere, `sym` is not in the symbol table and the relocation
references the null symbol. Visit the expression to fix the issue.
2023-12-07 18:34:36 -08:00
Fangrui Song
e6fed06335 [RISCV] Make linker-relaxable instructions terminate MCDataFragment
`MCExpr::evaluateAsAbsolute` has a longstanding bug. When the MCAssembler is
non-null and the MCAsmLayout is null, it may incorrectly fold A-B even if A and
B are separated by a linker-relaxable instruction. This behavior can suppress
some ADD/SUB relocations and lead to wrong results if the linker performs
relaxation.

To fix the bug, ensure that linker-relaxable instructions only appear at the end
of an MCDataFragment, thereby making them terminate the fragment. When computing
A-B, suppress folding if A and B are separated by a linker-relaxable
instruction.

* `.subsection` now correctly give errors for non-foldable expressions.
* gen-dwarf.s will pass even if we add back the .debug_line or .eh_frame/.debug_frame code from D150004
* This will fix suppressed relocation when we add R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128.

In the future, we should investigate the desired behavior for
`MCExpr::evaluateAsAbsolute` when both MCAssembler and MCAsmLayout are non-null.

(Note: MCRelaxableFragment is only for assembler-relaxation. If we ever need
linker-relaxable MCRelaxableFragment, we would need to adjust RISCVMCExpr.cpp
(D58943/D73211).)

Depends on D153096

Differential Revision: https://reviews.llvm.org/D153097
2023-06-29 09:39:57 -07:00
Fangrui Song
665ccc19d3 [MC] Add SMLoc to MCCFIInstruction
to help debug and report better diagnostics for functions like
relaxDwarfCallFrameFragment (D153167).

In MCStreamer, some emitCFI* functions already take a SMLoc argument. Add a
SMLoc argument to the remaining functions that generate a MCCFIInstruction.
2023-06-26 17:58:29 -07:00
Fangrui Song
6746602bc6 [MC] Improve .subsection diagnostic 2023-06-15 18:35:51 -07:00
Fangrui Song
acc0224104 [MC] Remove an unneeded special case from MCObjectStreamer::flushPendingLabels
We always pass a non-null F to flushPendingLabels. Wait a bit before changing
the parameter to use a reference.
2023-06-15 13:52:20 -07:00
Fangrui Song
742040a7f4 [MC] Properly report errors for .subsection
For the out-of-range error, MCConstantExpr doesn't have a location, so we
can only show "<unknown>:0:".

Also, allow subsection numbers up to 2147483647, which is the maximum value GNU
assembler supports. (GNU assembler also supports negative numbers.)
2023-06-14 23:57:03 -07:00
Fangrui Song
dde1795f14 [RISCV][MC] .debug_line/.debug_frame/.eh_frame: emit relocations for assembly input files with relaxation
When assembling `.debug_line` for both explicitly specified and synthesized
`.loc` directives. the integrated assembler may incorrectly omit relocations for
-mrelax.

For an assembly file, we have a `MCAssembler` object and `evaluateAsAbsolute`
will incorrectly fold `AddrDelta` to a constant (which is not true in the
presence of linker relaxation).
`MCDwarfLineAddr::Emit` will emit a special opcode, which does not take into
account of linker relaxation. This is a sufficiently complex function that
I think should be called in any "fast paths" for linker relaxation aware assembling.

The following script demonstrates the bugs.

```
cat > x.c <<eof
void f();
void _start() {
  f();
  f();
  f();
}
eof
# C to object file: correct DW_LNS_fixed_advance_pc
clang --target=riscv64 -g -c x.c
llvm-dwarfdump --debug-line -v x.o | grep \ DW_LNS_fixed_advance_pc -q

# Assembly to object file with synthesized line number information: incorrect special opcodes
clang --target=riscv64 -S x.c && clang --target=riscv64 -g -c x.s
llvm-dwarfdump --debug-line -v x.o | grep \ DW_LNS_fixed_advance_pc -q; test $? -eq 1

# Assembly with .loc to object file: incorrect special opcodes
clang --target=riscv64 -S -g x.c && clang --target=riscv64 -c x.s
llvm-dwarfdump --debug-line -v x.o | grep \ DW_LNS_fixed_advance_pc -q; test $? -eq 1
```

The `MCDwarfLineAddr::Emit` code path is an old optimization in commit
57ab708bdd3231b23a8ef4978b11ff07616034a2 (2010) that seems no longer relevant.
It don't trigger for direct machine code emission (label differences are not
foldable without a `MCAssembler`). MCDwarfLineAddr::Emit does complex operations
that are repeated in MCAssembler::relaxDwarfLineAddr, which an intricate RISCV
override.

Let's remove the "fast path". Assembling the assembly output of
X86ISelLowering.cpp with `-g` may be 2% slower, but I think the cost is fine.
There are opportunities to make the "slow path" faster, e.g.

* Optimizing the current new MC*Fragment pattern that allocates new fragments on
  the heap.
* Reducing the number of relaxation times for .debug_line and .debug_frame, as
  well as possibly other sections using LEB128. For instance, LEB128 can have a
  one-byte estimate to avoid the second relaxation iteration.

For assembly input with -mno-relax, in theory we can prefer special opcodes to
DW_LNS_fixed_advance_pc to decrease the size of .debug_line, but such a change
may be overkill and unnecessarily diverge from -mrelax behaviors and GCC.

---

For .debug_frame/.eh_frame, MCDwarf currently emits DW_CFA_advance_loc without
relocations. Remove the special case to enable relocations. Similar to
.debug_line, even without the bug fix, the MCDwarfFrameEmitter::encodeAdvanceLoc
special case is a sufficiently complex code path that should be avoided.

---

When there are more than one section, we generate .debug_rnglists for
DWARF v5. We currently emit DW_RLE_start_length using ULEB128, which
is incorrect. The new test gen-dwarf.s adds a TODO.

---

About other `evaluateAsAbsolute` uses. `MCObjectStreamer::emit[SU]LEB128Value`
have similar code to MCDwarfLineAddr. They are fine to keep as we don't have
LEB128 relocations to correctly represent link-time non-constants anyway.

---

In the future, we should investigate ending a MCFragment for a relaxable
instruction, to further clean up the assembler support for linker relaxation
and fix `evaluateAsAbsolute`.

See bbea64250f65480d787e1c5ff45c4de3ec2dcda8 for some of the related code.

Reviewed By: enh, barannikov88

Differential Revision: https://reviews.llvm.org/D150004
2023-05-15 18:44:55 -07:00