History log of /llvm-project-15.0.7/lld/ELF/LinkerScript.cpp (Results 1 – 25 of 898)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-20.1.0, llvmorg-20.1.0-rc3, llvmorg-20.1.0-rc2, llvmorg-20.1.0-rc1, llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, 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, llvmorg-16.0.6, 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, 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
# 85cfd917 24-Jul-2022 Fangrui Song <[email protected]>

[ELF] Optimize some non-constant alignTo with alignToPowerOf2. NFC

My x86-64 lld executable is 2KiB smaller. .eh_frame writing gets faster as there
were lots of divisions.


Revision tags: llvmorg-14.0.6
# 5413bf1b 20-Jun-2022 Kazu Hirata <[email protected]>

Don't use Optional::hasValue (NFC)


# 757d9d22 19-Jun-2022 Kazu Hirata <[email protected]>

[lld] Use value_or instead of getValueOr (NFC)


Revision tags: 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
# 6c814931 08-Mar-2022 Fangrui Song <[email protected]>

[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
# 8ca46bba 24-Feb-2022 Fangrui Song <[email protected]>

[ELF] Move isUsedInRegularObj assignment from ctor to call sites. NFC

This removes the tricky
`isUsedInRegularObj(!file || file->kind() == InputFile::ObjKind)`
and the copy from `Symbol::mergeProper

[ELF] Move isUsedInRegularObj assignment from ctor to call sites. NFC

This removes the tricky
`isUsedInRegularObj(!file || file->kind() == InputFile::ObjKind)`
and the copy from `Symbol::mergeProperties`.

show more ...


# b01430a0 24-Feb-2022 Fangrui Song <[email protected]>

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


# fc0aa842 23-Feb-2022 Fangrui Song <[email protected]>

[ELF] Check COMMON symbols for PROVIDE and don't redefine COMMON symbols edata/end/etext

In GNU ld, the definition precedence is: regular symbol assignment > relocatable object definition > `PROVIDE

[ELF] Check COMMON symbols for PROVIDE and don't redefine COMMON symbols edata/end/etext

In GNU ld, the definition precedence is: regular symbol assignment > relocatable object definition > `PROVIDE` symbol assignment.

GNU ld's internal linker scripts define the non-reserved (by C and C++)
edata/end/etext with `PROVIDE` so the relocatable object definition takes
precedence. This makes sense because `int end;` is valid.

We currently redefine such symbols if they are COMMON, but not if they are
regular definitions, so `int end;` with -fcommon is essentially a UB in ld.lld.
Fix this (also improve consistency and match GNU ld) by using the
`isDefined` code path for `isCommon`. In GNU ld, reserved identifiers like
`__ehdr_start` do not use `PROVIDE`, while we treat them all as `PROVIDE`, this
seems fine.

Reviewed By: peter.smith

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

show more ...


Revision tags: llvmorg-14.0.0-rc1
# 27bb7990 08-Feb-2022 Fangrui Song <[email protected]>

[ELF] Clean up headers. NFC


Revision tags: llvmorg-15-init
# fbf2f664 01-Feb-2022 Fangrui Song <[email protected]>

[ELF] Update flag propagation rule to ignore discarded output sections

See the updated insert-before.test for the effects: many synthetic
sections are SHF_ALLOC|SHF_WRITE. If they are discarded, we

[ELF] Update flag propagation rule to ignore discarded output sections

See the updated insert-before.test for the effects: many synthetic
sections are SHF_ALLOC|SHF_WRITE. If they are discarded, we don't want
to propagate their flags to subsequent output section descriptions.

`getFirstInputSection(sec) == nullptr` can technically be merged into
`isDiscardable` but I'd like to postpone that as not sharing code may give more
refactoring opportunity.

Depends on D118529.

Reviewed By: peter.smith, bluca

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

show more ...


# a0318711 01-Feb-2022 Fangrui Song <[email protected]>

[ELF] Rename adjustSectionsBeforeSorting to adjustOutputSections and make it affect INSERT commands

adjustSectionsBeforeSorting updates some output section attributes
(alignment/flags) and removes d

[ELF] Rename adjustSectionsBeforeSorting to adjustOutputSections and make it affect INSERT commands

adjustSectionsBeforeSorting updates some output section attributes
(alignment/flags) and removes discardable empty sections. When it is called,
INSERT commands have not been processed. Therefore the flags propagation rule
may not affect output sections defined in an INSERT command properly.

Fix this by moving processInsertCommands before adjustSectionsBeforeSorting.

adjustSectionsBeforeSorting is somewhat misnamed. The order between it and
sortInputSections does not matter. With the pass shuffle, the name of
adjustSectionsBeforeSorting becomes wrong. Therefore rename it. The new
name is not set into stone. The function mixes several tasks and the
code may be refactored in a way that we may give them more meaningful
names.

With this patch, I think the behavior of attribute propagation becomes more
reasonable. In particular, in the absence of non-INSERT SECTIONS,
inserting a section after a SHF_ALLOC one will give us a SHF_ALLOC section,
not a non-SHF_ALLOC one (see linkerscript/insert-after.test).

Reviewed By: peter.smith, bluca

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

show more ...


Revision tags: llvmorg-13.0.1, llvmorg-13.0.1-rc3
# 83d59e05 20-Jan-2022 Alexandre Ganea <[email protected]>

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 ...


# ac0986f8 17-Jan-2022 Fangrui Song <[email protected]>

[ELF] Change std::vector<InputSectionBase *> to SmallVector

There is no remaining std::vector<InputSectionBase> now. My x86-64 lld
executable is 2KiB small.


# 769057a5 17-Jan-2022 Fangrui Song <[email protected]>

[ELF] Change some DenseMap<StringRef, *> to DenseMap<CachedHashStringRef, *>. NFC


# e6b15394 16-Jan-2022 Alexandre Ganea <[email protected]>

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 <[email protected]>

[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 ...


# 43d92798 12-Jan-2022 Fangrui Song <[email protected]>

[ELF] Refactor how .gnu.hash and .hash are discarded

Switch to the D114180 approach which is simpler and allows gnuHashTab/hashTab to
switch to unique_ptr.


Revision tags: llvmorg-13.0.1-rc2
# bf9c8636 12-Jan-2022 Fangrui Song <[email protected]>

[ELF] Support discarding .relr.dyn

db08df0570b6dfaf00d7b1b8555c1d2d4effb224 does not work because part.relrDyn is
a unique_ptr and `reset` destroys the object which may still be referenced.

This co

[ELF] Support discarding .relr.dyn

db08df0570b6dfaf00d7b1b8555c1d2d4effb224 does not work because part.relrDyn is
a unique_ptr and `reset` destroys the object which may still be referenced.

This commit uses the D114180 approach. Also improve the test to check that there
is no R_X86_64_RELATIVE.

show more ...


# db08df05 12-Jan-2022 Fangrui Song <[email protected]>

[ELF] Support discarding .relr.dyn

to prepare for D116838, otherwise for linkerscript/discard-section-err.s,
there will be a null pointer dereference in `part.relrDyn->getParent()->size`
in `finaliz

[ELF] Support discarding .relr.dyn

to prepare for D116838, otherwise for linkerscript/discard-section-err.s,
there will be a null pointer dereference in `part.relrDyn->getParent()->size`
in `finalizeSynthetic(part.relrDyn.get())`.

show more ...


# cb203f3f 28-Dec-2021 Fangrui Song <[email protected]>

[ELF] Change InStruct/Partition pointers to unique_ptr

and remove associated make<XXX> calls.
gnuHash and sysvHash are unchanged, otherwise LinkerScript::discard would
destroy the objects which may

[ELF] Change InStruct/Partition pointers to unique_ptr

and remove associated make<XXX> calls.
gnuHash and sysvHash are unchanged, otherwise LinkerScript::discard would
destroy the objects which may be referenced by input section descriptions.

My x86-64 lld executable is 121+KiB smaller.

show more ...


# 3c94d5d9 27-Dec-2021 Fangrui Song <[email protected]>

[ELF] addOrphanSections: avoid std::function


# a1c2ee01 26-Dec-2021 Fangrui Song <[email protected]>

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

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


# 10316a6f 26-Dec-2021 Fangrui Song <[email protected]>

[ELF] Change InputSectionDescription members from vector to SmallVector

This decreases sizeof(lld::elf::InputSectionDescription) from 264 to 232.


# 9c0a4227 25-Dec-2021 Kazu Hirata <[email protected]>

Use Optional::getValueOr (NFC)


# ad26b0b2 23-Dec-2021 Fangrui Song <[email protected]>

Revert "[ELF] Make Partition/InStruct members unique_ptr and remove associate make<XXX>"

This reverts commit e48b1c8a27f0fbd791edc8e45756b268caadfa66.
This reverts commit d019de23a1d761225fdaf0c4739

Revert "[ELF] Make Partition/InStruct members unique_ptr and remove associate make<XXX>"

This reverts commit e48b1c8a27f0fbd791edc8e45756b268caadfa66.
This reverts commit d019de23a1d761225fdaf0c47394ba58143aea9a.

The changes caused memory leaks (non-final classes cannot use unique_ptr).

show more ...


# e48b1c8a 23-Dec-2021 Fangrui Song <[email protected]>

[ELF] Make Partition members unique_ptr and remove associate make<XXX>

See D116143 for benefits. My lld executable (x86-64) is 103+KiB smaller.


12345678910>>...36