History log of /llvm-project/lld/ELF/ScriptParser.cpp (Results 76 – 100 of 283)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# d479b2e4 25-Jun-2022 Fangrui Song <i@maskray.me>

[ELF] Fix precedence of == and != in expressions

In GNU ld, the == and != operators have lower precedence than < > <= >=.
This behavior matches C.


# 4cb05dc3 25-Jun-2022 Fangrui Song <i@maskray.me>

[ELF] Support quoted name in the TARGET command


# 363b2956 25-Jun-2022 Fangrui Song <i@maskray.me>

[ELF] Support quoted symbol in the ENTRY command

This matches GNU ld and matches other places we unquote the symbol name.

Fixes #56208


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4
# 8527f32f 12-May-2022 Ben Shi <ben.shi@streamcomputing.com>

[lld][ELF] Support BFD name elf32-avr

Reviewed By: MaskRay

differential Revision: https://reviews.llvm.org/D125544


# 177fd72f 13-May-2022 Fangrui Song <i@maskray.me>

[ELF] Disallow input section description without a filename

GNU ld does not allow `.foo : { (*foo) }`, but we may recognize it as three
input section descriptions: file "(" with any section name, fi

[ELF] Disallow input section description without a filename

GNU ld does not allow `.foo : { (*foo) }`, but we may recognize it as three
input section descriptions: file "(" with any section name, file "*foo" with
any section name, file ")" with any section name. Disallow the error-prone usage.

Reviewed By: peter.smith

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

show more ...


# 5a44980f 04-May-2022 Fangrui Song <i@maskray.me>

[ELF] Support custom sections between DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END

We currently hard code RELRO sections. When a custom section is between
DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_

[ELF] Support custom sections between DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END

We currently hard code RELRO sections. When a custom section is between
DATA_SEGMENT_ALIGN and DATA_SEGMENT_RELRO_END, we may report a spurious
`error: section: ... is not contiguous with other relro sections`. GNU ld
makes such sections RELRO.

glibc recently switched to default --with-default-link=no. This configuration
places `__libc_atexit` and others between DATA_SEGMENT_ALIGN and
DATA_SEGMENT_RELRO_END. This patch allows such a ld.bfd --verbose
linker script to be fed into lld.

Reviewed By: peter.smith

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

show more ...


Revision tags: llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3
# 6c814931 08-Mar-2022 Fangrui Song <i@maskray.me>

[ELF] Don't use multiple inheritance for OutputSection. NFC

Add an OutputDesc class inheriting from SectionCommand. An OutputDesc wraps an
OutputSection. This change allows InputSection::getParent t

[ELF] Don't use multiple inheritance for OutputSection. NFC

Add an OutputDesc class inheriting from SectionCommand. An OutputDesc wraps an
OutputSection. This change allows InputSection::getParent to be inlined.

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

show more ...


Revision tags: llvmorg-14.0.0-rc2
# 9e9c86fd 28-Feb-2022 Fangrui Song <i@maskray.me>

[ELF] Change some non-null pointer parameters to references. NFC

To decrease difference for D120650. Also, rename some `OutputSection *sec` (and
`cmd`) to the more common `osec`.


# b01430a0 24-Feb-2022 Fangrui Song <i@maskray.me>

[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC


# 66f8ac8d 17-Feb-2022 Fangrui Song <i@maskray.me>

[ELF] Support (TYPE=<value>) to customize the output section type

The current output section type allows to set the ELF section type to
SHT_PROGBITS or SHT_NOLOAD. This patch allows an arbitrary sec

[ELF] Support (TYPE=<value>) to customize the output section type

The current output section type allows to set the ELF section type to
SHT_PROGBITS or SHT_NOLOAD. This patch allows an arbitrary section value
to be specified. Some common SHT_* literal names are supported as well.

```
SECTIONS {
note (TYPE=SHT_NOTE) : { BYTE(8) *(note) }
init_array ( TYPE=14 ) : { QUAD(14) }
fini_array (TYPE = SHT_FINI_ARRAY) : { QUAD(15) }
}
```

When `sh_type` is specified, it is an error if an input section has a different type.

Our syntax is compatible with GNU ld 2.39 (https://sourceware.org/bugzilla/show_bug.cgi?id=28841).

Reviewed By: peter.smith

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

show more ...


Revision tags: llvmorg-14.0.0-rc1
# 27bb7990 08-Feb-2022 Fangrui Song <i@maskray.me>

[ELF] Clean up headers. NFC


Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3
# 83d59e05 20-Jan-2022 Alexandre Ganea <alexandre.ganea@legionlabs.com>

Re-land [LLD] Remove global state in lldCommon

Move all variables at file-scope or function-static-scope into a hosting structure (lld::CommonLinkerContext) that lives at lldMain()-scope. Drivers wi

Re-land [LLD] Remove global state in lldCommon

Move all variables at file-scope or function-static-scope into a hosting structure (lld::CommonLinkerContext) that lives at lldMain()-scope. Drivers will inherit from this structure and add their own global state, in the same way as for the existing COFFLinkerContext.

See discussion in https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html

The previous land f860fe362282ed69b9d4503a20e5d20b9a041189 caused issues in https://lab.llvm.org/buildbot/#/builders/123/builds/8383, fixed by 22ee510dac9440a74b2e5b3fe3ff13ccdbf55af3.

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

show more ...


# e6b15394 16-Jan-2022 Alexandre Ganea <alexandre.ganea@legionlabs.com>

Revert [LLD] Remove global state in lldCommon

It seems to be causing issues on https://lab.llvm.org/buildbot/#/builders/123/builds/8383


# f860fe36 16-Jan-2022 Alexandre Ganea <alexandre.ganea@legionlabs.com>

[LLD] Remove global state in lldCommon

Move all variables at file-scope or function-static-scope into a hosting structure (lld::CommonLinkerContext) that lives at lldMain()-scope. Drivers will inher

[LLD] Remove global state in lldCommon

Move all variables at file-scope or function-static-scope into a hosting structure (lld::CommonLinkerContext) that lives at lldMain()-scope. Drivers will inherit from this structure and add their own global state, in the same way as for the existing COFFLinkerContext.

See discussion in https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html

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

show more ...


Revision tags: llvmorg-13.0.1-rc2
# 64038ef8 27-Dec-2021 Fangrui Song <i@maskray.me>

[ELF] ScriptParser: change std::vector to SmallVector


# a1c2ee01 26-Dec-2021 Fangrui Song <i@maskray.me>

[ELF] LinkerScript/OutputSection: change other std::vector members to SmallVector

11+KiB smaller .text with both libc++ and libstdc++ builds.


# 7051aeef 26-Nov-2021 Fangrui Song <i@maskray.me>

[ELF] Rename BaseCommand to SectionCommand. NFC

BaseCommand was picked when PHDRS/INSERT/etc were not implemented. Rename it to
SectionCommand to match `sectionCommands` and make it clear that the c

[ELF] Rename BaseCommand to SectionCommand. NFC

BaseCommand was picked when PHDRS/INSERT/etc were not implemented. Rename it to
SectionCommand to match `sectionCommands` and make it clear that the commands
are used in SECTIONS (except a special case for SymbolAssignment).

Also, improve naming of some BaseCommand variables (base -> cmd).

show more ...


# 6188fd49 26-Nov-2021 Fangrui Song <i@maskray.me>

[ELF] Rename OutputSection::sectionCommands to commands. NFC

This partially reverts r315409: the description applies to LinkerScript, but not
to OutputSection.

The name "sectionCommands" is used in

[ELF] Rename OutputSection::sectionCommands to commands. NFC

This partially reverts r315409: the description applies to LinkerScript, but not
to OutputSection.

The name "sectionCommands" is used in both LinkerScript::sectionCommands and
OutputSection::sectionCommands, which may lead to confusion.
"commands" in OutputSection has no ambiguity because there are no other types
of commands.

show more ...


# 8cdf1c1e 24-Nov-2021 Igor Kudrin <ikudrin@accesssoftek.com>

[ELF] Support the "read-only" memory region attribute

The attribute 'r' allows (or disallows for the negative case) read-only
sections, i.e. ones without the SHF_WRITE flag, to be assigned to the
me

[ELF] Support the "read-only" memory region attribute

The attribute 'r' allows (or disallows for the negative case) read-only
sections, i.e. ones without the SHF_WRITE flag, to be assigned to the
memory region. Before the patch, lld could put a section in the wrong
region or fail with "error: no memory region specified for section".

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

show more ...


Revision tags: llvmorg-13.0.1-rc1
# bf6e259b 25-Oct-2021 Fangrui Song <i@maskray.me>

[ELF] Update comments/diagnostics for some long options to use the canonical two-dash form

Rewrite some comments as appropriate.


# 2bf06d93 27-Sep-2021 Fangrui Song <i@maskray.me>

[ELF] Support symbol names with space in linker script expressions

Fix PR51961

Reviewed By: jhenderson

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


Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2
# 00809c88 05-Aug-2021 Fangrui Song <i@maskray.me>

[ELF] Apply version script patterns to non-default version symbols

Currently version script patterns are ignored for .symver produced
non-default version (single @) symbols. This makes such symbols

[ELF] Apply version script patterns to non-default version symbols

Currently version script patterns are ignored for .symver produced
non-default version (single @) symbols. This makes such symbols
not localizable by `local:`, e.g.

```
.symver foo3_v1,foo3@v1
.globl foo_v1
foo3_v1:

ld.lld --version-script=a.ver -shared a.o
```

This patch adds the support:

* Move `config->versionDefinitions[VER_NDX_LOCAL].patterns` to `config->versionDefinitions[versionId].localPatterns`
* Rename `config->versionDefinitions[versionId].patterns` to `config->versionDefinitions[versionId].nonLocalPatterns`
* Allow `findAllByVersion` to find non-default version symbols when `includeNonDefault` is true. (Note: `symtab` keys do not have `@@`)
* Make each pattern check both the unversioned `pat.name` and the versioned `${pat.name}@${v.name}`
* `localPatterns` can localize `${pat.name}@${v.name}`. `nonLocalPatterns` can prevent localization by assigning `verdefIndex` (before `parseSymbolVersion`).

---

If a user notices new `undefined symbol` errors with a version script containing
`local: *;`, the issue is likely due to a missing `global:` pattern.

Reviewed By: peter.smith

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

show more ...


# a533eb74 05-Aug-2021 Fangrui Song <i@maskray.me>

Revert "[ELF] Apply version script patterns to non-default version symbols"

This reverts commit 7ed22a6fa90cbdc70d6806c1121a0c50c1978dce.

buf is not cleared so the commit misses some cases.


# 7ed22a6f 04-Aug-2021 Fangrui Song <i@maskray.me>

[ELF] Apply version script patterns to non-default version symbols

Currently version script patterns are ignored for .symver produced
non-default version (single @) symbols. This makes such symbols

[ELF] Apply version script patterns to non-default version symbols

Currently version script patterns are ignored for .symver produced
non-default version (single @) symbols. This makes such symbols
not localizable by `local:`, e.g.

```
.symver foo3_v1,foo3@v1
.globl foo_v1
foo3_v1:

ld.lld --version-script=a.ver -shared a.o
# In a.out, foo3@v1 is incorrectly exported.
```

This patch adds the support:

* Move `config->versionDefinitions[VER_NDX_LOCAL].patterns` to `config->versionDefinitions[versionId].localPatterns`
* Rename `config->versionDefinitions[versionId].patterns` to `config->versionDefinitions[versionId].nonLocalPatterns`
* Allow `findAllByVersion` to find non-default version symbols when `includeNonDefault` is true. (Note: `symtab` keys do not have `@@`)
* Make each pattern check both the unversioned `pat.name` and the versioned `${pat.name}@${v.name}`
* `localPatterns` can localize `${pat.name}@${v.name}`. `nonLocalPatterns` can prevent localization by assigning `verdefIndex` (before `parseSymbolVersion`).

---

If a user notices new `undefined symbol` errors with a version script containing
`local: *;`, the issue is likely due to a missing `global:` pattern.

Reviewed By: peter.smith

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

show more ...


Revision tags: llvmorg-13.0.0-rc1, llvmorg-14-init
# e7a7ad13 25-Jul-2021 Fangrui Song <i@maskray.me>

[ELF] Support quoted symbols in symbol assignments

glibc/elf/tst-absolute-zero-lib.lds uses `"absolute" = 0;`


12345678910>>...12