History log of /llvm-project/lld/ELF/ScriptLexer.cpp (Results 1 – 25 of 45)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# 483516fd 17-Nov-2024 Fangrui Song <i@maskray.me>

[ELF] Remove unneeded Twine()


# e24457a3 15-Nov-2024 Fangrui Song <i@maskray.me>

[ELF] Migrate away from global ctx


# ed6c106e 07-Nov-2024 Fangrui Song <i@maskray.me>

[ELF] Replace errorCount with errCount(ctx)

to reduce reliance on the global context.


# 09c2c5e1 07-Nov-2024 Fangrui Song <i@maskray.me>

[ELF] Replace error(...) with ErrAlways or Err

Most are migrated to ErrAlways mechanically.
In the future we should change most to Err.


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1
# cf57a670 21-Sep-2024 Fangrui Song <i@maskray.me>

[ELF] ScriptParser: pass Ctx to ScriptParser and ScriptLexer. NFC


Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2
# a7e8bddf 28-Jul-2024 Fangrui Song <i@maskray.me>

[ELF] Respect --sysroot for INCLUDE

If an included script is under the sysroot directory, when it opens an
absolute path file (`INPUT` or `GROUP`), add sysroot before the absolute
path. When the inc

[ELF] Respect --sysroot for INCLUDE

If an included script is under the sysroot directory, when it opens an
absolute path file (`INPUT` or `GROUP`), add sysroot before the absolute
path. When the included script ends, the `isUnderSysroot` state is
restored.

show more ...


# 8f72b0cb 28-Jul-2024 Fangrui Song <i@maskray.me>

[ELF] Fix INCLUDE cycle detection

Fix #93947: the cycle detection mechanism added by
https://reviews.llvm.org/D37524 also disallowed including a file twice,
which is an unnecessary limitation.

Now

[ELF] Fix INCLUDE cycle detection

Fix #93947: the cycle detection mechanism added by
https://reviews.llvm.org/D37524 also disallowed including a file twice,
which is an unnecessary limitation.

Now that we have an include stack #100493, supporting multiple inclusion
is trivial. Note: a filename can be referenced with many different
paths, e.g. a.lds, ./a.lds, ././a.lds. We don't attempt to detect the
cycle in the earliest point.

show more ...


# 9328c20c 27-Jul-2024 Fangrui Song <i@maskray.me>

[ELF] Track line number precisely

`getLineNumber` is both imprecise (when `INCLUDE` is used) and
inefficient (see https://reviews.llvm.org/D104137). Track line number
precisely now that we have `str

[ELF] Track line number precisely

`getLineNumber` is both imprecise (when `INCLUDE` is used) and
inefficient (see https://reviews.llvm.org/D104137). Track line number
precisely now that we have `struct Buffer` abstraction from #100493.

show more ...


# 2a89356d 27-Jul-2024 Fangrui Song <i@maskray.me>

[ELF] Add till and rewrite while (... consume("}"))

After #100493, the idiom `while (!errorCount() && !consume("}"))` could
lead to inaccurate diagnostics or dead loops. Introduce till to change
the

[ELF] Add till and rewrite while (... consume("}"))

After #100493, the idiom `while (!errorCount() && !consume("}"))` could
lead to inaccurate diagnostics or dead loops. Introduce till to change
the code pattern.

show more ...


# 1978c21d 26-Jul-2024 Fangrui Song <i@maskray.me>

[ELF] ScriptLexer: generate tokens lazily

The current tokenize-whole-file approach has a few limitations.

* Lack of state information: `maybeSplitExpr` is needed to parse
expressions. It's infeas

[ELF] ScriptLexer: generate tokens lazily

The current tokenize-whole-file approach has a few limitations.

* Lack of state information: `maybeSplitExpr` is needed to parse
expressions. It's infeasible to add new states to behave more like GNU
ld.
* `readInclude` may insert tokens in the middle, leading to a time
complexity issue with N-nested `INCLUDE`.
* line/column information for diagnostics are inaccurate, especially
after an `INCLUDE`.
* `getLineNumber` cannot be made more efficient without significant code
complexity and memory consumption. https://reviews.llvm.org/D104137

The patch switches to a traditional lexer that generates tokens lazily.

* `atEOF` behavior is modified: we need to call `peek` to determine EOF.
* `peek` and `next` cannot call `setError` upon `atEOF`.
* Since `consume` no longer reports an error upon `atEOF`, the idiom `while (!errorCount() && !consume(")"))`
would cause a dead loop. Use `while (peek() != ")" && !atEOF()) { ... } expect(")")` instead.
* An include stack is introduced to handle `readInclude`. This can be
utilized to address #93947 properly.
* `tokens` and `pos` are removed.
* `commandString` is reimplemented. Since it is used in -Map output,
`\n` needs to be replaced with space.

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

show more ...


Revision tags: llvmorg-19.1.0-rc1
# 026972af 25-Jul-2024 Fangrui Song <i@maskray.me>

[ELF] Remove obsoleted comment after #99567


# 2ae862b7 24-Jul-2024 Hongyu Chen <hongyc4@uci.edu>

[ELF] Remove `consumeLabel` in ScriptLexer (#99567)

This commit removes `consumeLabel` since we can just use consume
function to have the same functionalities.


Revision tags: llvmorg-20-init
# b828c13f 20-Jul-2024 Hongyu Chen <hongyc4@uci.edu>

[ELF] Delete peek2 in Lexer (#99790)

Thanks to Fangrui's change

https://github.com/llvm/llvm-project/commit/28045ceab08d41a8a42d93ebc445e8fe906f884c
so peek2 can be removed.


# c93554b8 20-Jul-2024 Fangrui Song <i@maskray.me>

[ELF] Simplify ScriptLexer::consume. NFC


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# fae96104 15-Jul-2023 Fangrui Song <i@maskray.me>

[ELF] Support operator ^ and ^=

GNU ld added ^ support in July 2023 and it looks like ^= is in plan as
well.

For now, we don't support `a^=0` (^= without a preceding space).


Revision tags: llvmorg-16.0.6
# 8d85c96e 05-Jun-2023 Fangrui Song <i@maskray.me>

[lld] StringRef::{starts,ends}with => {starts,ends}_with. NFC

The latter form is now preferred to be similar to C++20 starts_with.
This replacement also removes one function call when startswith is

[lld] StringRef::{starts,ends}with => {starts,ends}_with. NFC

The latter form is now preferred to be similar to C++20 starts_with.
This replacement also removes one function call when startswith is not inlined.

show more ...


Revision tags: llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3, llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7, llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init
# 0a0effdd 26-Jun-2022 Fangrui Song <i@maskray.me>

[ELF] Support -= *= /= <<= >>= &= |= in symbol assignments


# 77295c54 26-Jun-2022 Fangrui Song <i@maskray.me>

[ELF] Allow ? without adjacent space

GNU ld allows 1 ? 2?3:4 : 5?6 :7


Revision tags: llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, 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, llvmorg-14.0.0-rc2, 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, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3
# e3877787 22-Jun-2021 Colin Cross <ccross@android.com>

[ELF] Optimize ScriptLexer::getLineNumber by caching the previous line number and offset

getLineNumber() was counting the number of line feeds from the start of
the buffer to the current token. For

[ELF] Optimize ScriptLexer::getLineNumber by caching the previous line number and offset

getLineNumber() was counting the number of line feeds from the start of
the buffer to the current token. For large linker scripts this became a
performance bottleneck. For one 4MB linker script over 4 minutes was
spent in getLineNumber's StringRef::count.

Store the line number from the last token, and only count the additional
line feeds since the last token.

Reviewed By: MaskRay

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

show more ...


Revision tags: llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1
# ae4279bd 22-Jul-2020 Georgii Rymar <grimar@accesssoftek.com>

[LLD][ELF] - Linkerscript: report location for the "unclosed comment in a linker script" error.

Currently we print "error: unclosed comment in a linker script", which doesn't
provide information abo

[LLD][ELF] - Linkerscript: report location for the "unclosed comment in a linker script" error.

Currently we print "error: unclosed comment in a linker script", which doesn't
provide information about the real error location.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46793.

Differential revision: https://reviews.llvm.org/D84300

show more ...


Revision tags: llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2
# ac6abc99 05-Jun-2020 Fangrui Song <maskray@google.com>

[ELF] Don't cause assertion failure if --dynamic-list or --version-script takes an empty file

Fixes PR46184
Report line 1 of the last memory buffer.


Revision tags: llvmorg-10.0.1-rc1
# 07837b8f 15-May-2020 Fangrui Song <maskray@google.com>

[ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {`

Similar to D74882. This reverts much code from commit
bd8cfe65f5fee4ad573adc2172359c9552e8cdc0 (D68323) a

[ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {`

Similar to D74882. This reverts much code from commit
bd8cfe65f5fee4ad573adc2172359c9552e8cdc0 (D68323) and fixes some
problems before D68323.

Sorry for the churn but D68323 was a mistake. Namespace qualifiers avoid
bugs where the definition does not match the declaration from the
header. See
https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions (D74515)

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

show more ...


# 7c5fcb35 01-Apr-2020 Kazuaki Ishizaki <ishizaki@jp.ibm.com>

[lld] NFC: fix trivial typos in comments

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


Revision tags: llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3, llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1
# adcd0268 28-Jan-2020 Benjamin Kramer <benny.kra@googlemail.com>

Make llvm::StringRef to std::string conversions explicit.

This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly m

Make llvm::StringRef to std::string conversions explicit.

This is how it should've been and brings it more in line with
std::string_view. There should be no functional change here.

This is mostly mechanical from a custom clang-tidy check, with a lot of
manual fixups. It uncovers a lot of minor inefficiencies.

This doesn't actually modify StringRef yet, I'll do that in a follow-up.

show more ...


12