History log of /llvm-project/llvm/lib/MC/ELFObjectWriter.cpp (Results 1 – 25 of 667)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# 24892b86 19-Jan-2025 Kazu Hirata <kazu@google.com>

[MC] Avoid repeated hash lookups (NFC) (#123502)


Revision tags: llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# d73d5c8c 15-Nov-2024 Kazu Hirata <kazu@google.com>

[MC] Remove unused includes (NFC) (#116317)

Identified with misc-include-cleaner.


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# e44ecf76 23-Sep-2024 Arthur Eubanks <aeubanks@google.com>

[llvm][ELF] Add ELF header/section header table size statistics (#109345)

Followup to #102363. This makes the `elf-object-writer.*Bytes` stats sum
up to `assembler.ObjectBytes`.


# 36293eea 19-Sep-2024 Arthur Eubanks <aeubanks@google.com>

[NFC][ELF] Rename some ELFWriter methods (#109332)

More consistent casing + more accurate names.


Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4
# 59721f23 23-Aug-2024 Fangrui Song <i@maskray.me>

[MIPS] Optimize sortRelocs for o32

The o32 ABI specifies:

> Each relocation type of R_MIPS_HI16 must have an associated R_MIPS_LO16 entry immediately following it in the list of relocations. [...]

[MIPS] Optimize sortRelocs for o32

The o32 ABI specifies:

> Each relocation type of R_MIPS_HI16 must have an associated R_MIPS_LO16 entry immediately following it in the list of relocations. [...] the addend AHL is computed as (AHI << 16) + (short)ALO

In practice, the high-part and low-part relocations may not be adjacent
in assembly files, requiring the assembler to reorder relocations.
http://reviews.llvm.org/D19718 performed the reordering, but did not
optimize for the common case where a %lo immediately follows its
matching %hi. The quadratic time complexity could make sections with
many relocations very slow to process.

This patch implements the fast path, simplifies the code, and makes the
behavior more similar to GNU assembler (for the .rel.mips_hilo_8b test).
We also remove `OriginalSymbol`, removing overhead for other targets.

Fix #104562

Pull Request: https://github.com/llvm/llvm-project/pull/104723

show more ...


Revision tags: llvmorg-19.1.0-rc3
# 1a6bf944 18-Aug-2024 Fangrui Song <i@maskray.me>

[MC] Remove ELFRelocationEntry::OriginalAddend

For MIPS's o32 ABI (REL), https://reviews.llvm.org/D19718 introduced
`OriginalAddend` to find the matching R_MIPS_LO16 relocation for
R_MIPS_GOT16 when

[MC] Remove ELFRelocationEntry::OriginalAddend

For MIPS's o32 ABI (REL), https://reviews.llvm.org/D19718 introduced
`OriginalAddend` to find the matching R_MIPS_LO16 relocation for
R_MIPS_GOT16 when STT_SECTION conversion is applicable.

lw $2, %lo(local1)
lui $2, %got(local1)

However, we could just store the original `Addend` in
`ELFRelocationEntry` and remove `OriginalAddend`.

Note: The relocation ordering algorithm in
https://reviews.llvm.org/D19718 is inefficient (#104562), which will be
addressed by another patch.

show more ...


# 1baa6f75 08-Aug-2024 Arthur Eubanks <aeubanks@google.com>

[llvm][ELF] Add statistics on various section sizes (#102363)

Useful with other infrastructure that consume LLVM statistics to get an
idea of distribution of section sizes.

The breakdown of vari

[llvm][ELF] Add statistics on various section sizes (#102363)

Useful with other infrastructure that consume LLVM statistics to get an
idea of distribution of section sizes.

The breakdown of various section types is subject to change, this is
just an initial go at gather some sort of stats.

Example stats compiling X86ISelLowering.cpp (-g1):

```
"elf-object-writer.AllocROBytes": 308268,
"elf-object-writer.AllocRWBytes": 6240,
"elf-object-writer.AllocTextBytes": 1659203,
"elf-object-writer.DebugBytes": 3180386,
"elf-object-writer.OtherBytes": 5862,
"elf-object-writer.RelocationBytes": 2623440,
"elf-object-writer.StrtabBytes": 228599,
"elf-object-writer.SymtabBytes": 120336,
"elf-object-writer.UnwindBytes": 85216,
```

show more ...


# 5e1a5ffc 06-Aug-2024 Fangrui Song <i@maskray.me>

[MC,ARM] Move SHF_ARM_PUECODE change for .text to ARMTargetELFStreamer::finish

and remove MCELFObjectWriter::addTargetSectionFlags.


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# 2db576c8 23-Jul-2024 Fangrui Song <i@maskray.me>

ELFObjectWriter: Remove unneeded subclasses


# 219d80bc 23-Jul-2024 Fangrui Song <i@maskray.me>

MCAssembler: Move FileNames and CompilerVersion to MCObjectWriter


# 9e97f80c 23-Jul-2024 Fangrui Song <i@maskray.me>

MCAssembler: Move Symvers to ELFObjectWriter

Similar to c473e75adeaf2998e4fb444b0bdbf2dd19312e50


# c473e75a 23-Jul-2024 Fangrui Song <i@maskray.me>

MCAssmembler: Move ELFHeaderEFlags to ELFObjectWriter

Now that MCELFStreamer can access ELFObjectWriter (commit
70c52b62c5669993e341664a63bfbe5245e32884), we can move ELFHeaderEFlags
there.


# 70c52b62 22-Jul-2024 Fangrui Song <i@maskray.me>

[MC] Export llvm::ELFObjectWriter

Similar to commit 28fcafb50274be2520117eacb0a886adafefe59d (2011) for
MachObjectWriter and commit 9539a7796094ff5fb59d9c685140ea2e214b945c for
WinCOFFObjectWriter.

[MC] Export llvm::ELFObjectWriter

Similar to commit 28fcafb50274be2520117eacb0a886adafefe59d (2011) for
MachObjectWriter and commit 9539a7796094ff5fb59d9c685140ea2e214b945c for
WinCOFFObjectWriter.

MCELFStreamer can now access ELFObjectWriter directly without adding
ELF-specific markGnuAbi (https://reviews.llvm.org/D97976) and
setOverrideABIVersion to MCObjectWriter.

A few member variables have to be made public since we cannot use a
friend declaration for ELFWriter.

show more ...


# 1952dba4 08-Jul-2024 Fangrui Song <i@maskray.me>

[MC,ELF] Extract CREL encoder code

The extracted ELFObjectWriter.cpp code will be reused by llvm-objcopy
support (#97521).


# d5480209 03-Jul-2024 Alexis Engelke <engelke@in.tum.de>

[MC][ELF] Eliminate some hash maps from ELFObjectWriter (#97421)

Remove some maps. Mostly cleanup, only a slight performance win.

- Replace SectionIndexMap with layout order: The section layout o

[MC][ELF] Eliminate some hash maps from ELFObjectWriter (#97421)

Remove some maps. Mostly cleanup, only a slight performance win.

- Replace SectionIndexMap with layout order: The section layout order is
only used in MachO, so we can repurpose the field as section table
index.
- Store section offsets in MCSectionELF: No need for a map, and
especially not a std::map. Direct access to the underlying (and easily
modifyable) data structure is always faster.
- Improve storage of groups: There's no point in having a DenseMap, the
number of sections and groups are reasonably small to use vectors.

show more ...


# 057f28be 02-Jul-2024 Fangrui Song <i@maskray.me>

[MC] Remove unused MCAsmLayout declarations and includes


# bd321514 01-Jul-2024 Fangrui Song <i@maskray.me>

MCExpr::evaluateKnownAbsolute: replace the MCAsmLayout parameter with MCAssembler

and add a comment.


# 6b707a8c 01-Jul-2024 Fangrui Song <i@maskray.me>

[MC] Remove the MCAsmLayout parameter from MCObjectWriter::executePostLayoutBinding


# 1b704e88 01-Jul-2024 Fangrui Song <i@maskray.me>

[MC,llvm-readobj,yaml2obj] Support CREL relocation format

CREL is a compact relocation format for the ELF object file format.

This patch adds integrated assembler support (using the RELA form)
avai

[MC,llvm-readobj,yaml2obj] Support CREL relocation format

CREL is a compact relocation format for the ELF object file format.

This patch adds integrated assembler support (using the RELA form)
available with `llvm-mc -filetype=obj -crel a.s -o a.o`.
A dependent patch will add `clang -c -Wa,--crel,--allow-experimental-crel`.

Also add llvm-readobj support (for both REL and RELA forms) to
facilitate testing the assembler. Additionally, yaml2obj gains support
for the RELA form to aid testing with llvm-readobj.

We temporarily assign the section type code 0x40000020 from the generic
range to `SHT_CREL`. We avoided using `SHT_LLVM_` or `SHT_GNU_` to
avoid code churn and maintain broader applicability for interested psABIs.
Similarly, `DT_CREL` is temporarily 0x40000026.

LLVM will change the code and break compatibility. This is not an issue
if all relocatable files using CREL are regenerated (aka no prebuilt
relocatable files).

Link: https://discourse.llvm.org/t/rfc-crel-a-compact-relocation-format-for-elf/77600

Pull Request: https://github.com/llvm/llvm-project/pull/91280

show more ...


# 8e8c455a 01-Jul-2024 Fangrui Song <i@maskray.me>

ELFObjectWriter: Use DenseMap+SmallVector. NFC


# dce18286 01-Jul-2024 Fangrui Song <i@maskray.me>

[MC] Remove the MCAsmLayout parameter from ELFObjectWriter


# 23e62243 01-Jul-2024 Fangrui Song <i@maskray.me>

[MC] Remove the MCAsmLayout parameter from MCObjectWriter::{writeObject,writeSectionData}


# 4289c422 01-Jul-2024 Fangrui Song <i@maskray.me>

[MC] Remove the MCAsmLayout parameter from MCObjectWriter::recordRelocation


# 67957a45 30-Jun-2024 Fangrui Song <i@maskray.me>

[MC] Start merging MCAsmLayout into MCAssembler

Follow-up to 10c894cffd0f4bef21b54a43b5780240532e44cf.

MCAsmLayout, introduced by ac8a95498a99eb16dff9d3d0186616645d200b6e
(2010), provides APIs to c

[MC] Start merging MCAsmLayout into MCAssembler

Follow-up to 10c894cffd0f4bef21b54a43b5780240532e44cf.

MCAsmLayout, introduced by ac8a95498a99eb16dff9d3d0186616645d200b6e
(2010), provides APIs to compute fragment/symbol/section offsets.
The separate class is cumbersome and passing it around has overhead.
Let's remove it as the underlying implementation is tightly coupled with
MCAsmLayout anyway.

Some forwarders are added to ease migration.

show more ...


# bc6d9255 29-Jun-2024 Fangrui Song <i@maskray.me>

[MC] Simplify isSymbolRefDifferenceFullyResolvedImpl overloads. NFC

The base implementation is simple. Just inline it.


12345678910>>...27