llvm-project/lld/test/ELF/linkerscript
George Rimar 26fa916deb [ELF] - Do not set output section flags except SHF_{ALLOC,WRITE,EXECINSTR}.
This is PR34546.

Currently LLD creates output sections even if it has no input sections,
but its command contains an assignment.
Committed code just assigns the same flag that was used in previous
live section.
That does not work sometimes. For example if we have following script:

.ARM.exidx : { *(.ARM.exidx*) }
.foo : { _foo = 0; } }
Then first section has SHF_LINK_ORDER flag. But section foo should not.
That was a reason of crash in OutputSection::finalize(). LLD tried to calculate
Link value, calling front() on empty input sections list.
We should only keep access flags and omit all others when creating such sections.

Patch fixes the crash observed.

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

llvm-svn: 315441
2017-10-11 08:13:40 +00:00
..
Inputs Currently lld creates a single section to collect all commons. There is no way 2017-09-08 16:22:43 +00:00
absolute-expr.s Remove string table offsets from tests. 2016-11-01 21:26:28 +00:00
absolute.s Support ABSOLUTE on the right hand side in linker scripts 2017-03-15 03:33:23 +00:00
absolute2.s Consider ForceAbsolute again in moveAbsRight. 2017-09-20 19:24:57 +00:00
addr-zero.s Add a test that now passes. 2017-03-17 13:19:15 +00:00
addr.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
align-empty.s Don't depend on lld creating space for the headers. 2016-09-30 00:06:24 +00:00
align-section-offset.s If user requested section alignment is greater than MaxPageSize, propagate it to segment headers correctly. 2017-07-24 21:27:02 +00:00
align-section.s Don't crash on an empty section with an ALIGN. 2017-07-22 00:00:51 +00:00
align.s Align addresses, not offsets. 2017-09-12 00:06:00 +00:00
alignof.s [ELF] Print file:line for 'undefined section' errors 2016-11-28 09:58:04 +00:00
alternate-sections.s Replace MergeOutputSection with a synthetic section. 2017-02-03 13:06:18 +00:00
arm-exidx-order.s [ELF] - Do not set output section flags except SHF_{ALLOC,WRITE,EXECINSTR}. 2017-10-11 08:13:40 +00:00
arm-exidx-phdrs.s Always create a PT_ARM_EXIDX if needed. 2016-11-28 00:40:21 +00:00
arm-lscript.s Do not track section types of previous sections, always use PROGBITS for dummy sections. 2017-05-24 16:48:31 +00:00
assert.s [ELF] - Make ASSERT() return Dot instead of evaluated value. 2017-02-21 07:33:38 +00:00
at-addr.s [ELF] Don't output headers into a segment if there's no space for them 2017-08-23 18:44:34 +00:00
at.s [ELF] Don't output headers into a segment if there's no space for them 2017-08-23 18:44:34 +00:00
bss-fill.s [ELF] - Do not crash when linkerscript applies fill to .bss. 2017-05-30 05:48:09 +00:00
comdat-gc.s Linkerscript: don't crash when GC .debug_line 2016-09-26 09:04:16 +00:00
common-assign.s [ELF] - Do not crash when assign common symbol's values in script 2017-01-20 09:45:36 +00:00
common-exclude.s Currently lld creates a single section to collect all commons. There is no way 2017-09-08 16:22:43 +00:00
common-filespec.s Currently lld creates a single section to collect all commons. There is no way 2017-09-08 16:22:43 +00:00
common.s Currently lld creates a single section to collect all commons. There is no way 2017-09-08 16:22:43 +00:00
compress-debug-sections.s Update testcases for llvm-dwarfdump command line interface change 2017-09-11 23:34:12 +00:00
constructor.s [ELF] - Committed missing ld.ldd invocation to constructor.s 2017-01-23 16:55:13 +00:00
data-commands-gc.s Check the produced file instead of stderr. 2017-06-28 01:46:31 +00:00
data-commands.s [ELF] Fix test case thinko from r289152 2016-12-09 21:51:37 +00:00
data-segment-relro.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
define.s [ELF] - Linkerscript: implement DEFINED() command. 2016-09-23 13:17:23 +00:00
diagnostic.s [ELF] - Do not report multiple errors for single one in ScriptLexer::setError. 2017-08-23 08:48:39 +00:00
discard-interp.s Don't depend on lld creating space for the headers. 2016-09-30 00:06:24 +00:00
discard-print-gc.s Fix --print-gc-sections with linker scripts. 2017-02-17 19:37:30 +00:00
discard-section-err.s Currently lld creates a single section to collect all commons. There is no way 2017-09-08 16:22:43 +00:00
discard-section-metadata.s Change section flag character for SHF_LINK_ORDER to "o". 2017-04-04 22:35:16 +00:00
discard-section.s Alternative fix for reloc tareting discarded section 2016-10-12 12:31:34 +00:00
dot-is-not-abs.s The expr '.' is not absolute. 2016-10-31 21:36:23 +00:00
double-bss.s Rewrite CommonInputSection as a synthetic input section. 2016-11-05 23:05:47 +00:00
dynamic-sym.s Allow use define symbols to override linker defined ones. 2016-11-17 21:20:16 +00:00
dynamic.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
early-assign-symbol.s Consider only A.Sec in moveAbsRight. 2017-09-20 18:56:08 +00:00
edata-etext.s Change the error message format for undefined symbols. 2017-03-30 19:13:47 +00:00
eh-frame-hdr.s Revert "Add terminator to .eh_frame sections" 2017-02-28 18:55:08 +00:00
eh-frame-reloc-out-of-range.s [ELF] Fix error reporting for synthetic sections 2017-03-14 08:33:45 +00:00
eh-frame.s [ELF] Propely handle .eh_frame in linker scripts 2017-03-10 20:00:42 +00:00
ehdr_start.s [ELF] Define __ehdr_start unconditionally even when using linker script 2017-05-10 16:20:33 +00:00
emit-reloc.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
emit-relocs-discard.s [ELF] - Added support of linkerscript's "/DISCARD/" for --emit-relocs 2017-02-17 19:46:47 +00:00
emit-relocs-ehframe-discard.s [ELF] - Added support of linkerscript's "/DISCARD/" for --emit-relocs 2017-02-17 19:46:47 +00:00
emit-relocs-multiple.s [ELF] - Do not merge relocation sections by name when using --emit-relocs. 2017-06-07 09:20:35 +00:00
empty-load.s Don't create a bogus PT_PHDR if we don't allocate the headers. 2017-01-20 20:46:15 +00:00
empty-tls.s Don't crash if PT_TLS is empty. 2016-07-29 19:24:27 +00:00
entry.s Remove `REQUIRES: shell` hack to workaround an echo issue. 2016-12-09 18:49:37 +00:00
exclude-multiple.s [ELF] - Linkerscript: reimplement readSectionExcludes() 2016-09-21 08:53:21 +00:00
excludefile.s [ELF] Recommit r299635 to pad x86 executable sections with 0xcc 2017-04-07 10:36:42 +00:00
exidx-crash.s Fix REQUIRES line. 2017-07-18 22:14:26 +00:00
expr-invalid-sec.s [ELF] - Linkerscript: improved error reporting. 2017-06-07 08:54:43 +00:00
expr-sections.s Handle & and | of non abs values. 2017-03-17 14:55:36 +00:00
extend-pt-load.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
filename-spec.s Currently lld uses base names of files to match against file patterns in 2017-08-24 22:01:40 +00:00
fill-exec-sections.s [ELF] Recommit r299635 to pad x86 executable sections with 0xcc 2017-04-07 10:36:42 +00:00
fill.s Fix FILL linker script command. 2017-04-13 23:40:00 +00:00
got-write-offset.s [ELF] Fix writing the content of the .got section in a wrong place. 2017-07-14 08:10:45 +00:00
group.s Remove `REQUIRES: shell` hack to workaround an echo issue. 2016-12-09 18:49:37 +00:00
header-addr.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
header-phdr.s Fix header location with PHDR. 2017-09-28 18:12:13 +00:00
huge-temporary-file.s [ELF] - Fix for huge-temporary-file.s 2017-01-17 14:06:44 +00:00
image-base.s [ELF] Set Dot initially to --image-base value when using linker scripts 2017-10-10 10:09:35 +00:00
implicit-program-header.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
include-cycle.s [ELF] Fix issue with test when build path contains '@' 2017-09-11 15:55:54 +00:00
input-order.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
input-sec-dup.s Make tests less dependent on the exact layout. 2016-09-20 15:08:24 +00:00
lazy-symbols.s [ELF] Insert linkerscript symbols directly into symbol table 2017-02-21 22:32:51 +00:00
linkerscript.s [ELF] - Do not report multiple errors for single one in ScriptLexer::setError. 2017-08-23 08:48:39 +00:00
loadaddr.s [ELF] Print file:line for 'undefined section' errors 2016-11-28 09:58:04 +00:00
locationcountererr.s [ELF] - Improve diagnostic messages for move location counter errors. 2017-02-21 14:50:38 +00:00
locationcountererr2.s [ELF] - Allow moving location counter backward in some cases. 2017-07-12 14:50:25 +00:00
memory-at.s [ELF] - Linkerscript: set load address correctly if MEMORY command used. 2017-09-06 09:35:09 +00:00
memory-err.s [ELF] - Don't segfault when accessing location counter inside MEMORY command. 2017-08-17 08:47:21 +00:00
memory.s [ELF, LinkerScript] Memory region name parsing fix 2017-07-26 21:51:09 +00:00
memory2.s [ELF] - Fix calculation of memory region offset. 2017-07-25 08:29:29 +00:00
merge-sections-reloc.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
merge-sections-syms.s Replace MergeOutputSection with a synthetic section. 2017-02-03 13:06:18 +00:00
merge-sections.s [ELF] Filter out non InputSection members from InputSections 2017-05-30 05:17:58 +00:00
multi-sections-constraint.s Make test less dependent on the section order. 2016-09-20 20:48:54 +00:00
multiple-tbss.s Fix VA computation for tbss. 2016-09-22 12:35:44 +00:00
no-pt-load.s Avoid accessing an end() iterator. 2016-11-17 14:18:08 +00:00
no-space.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
noload.s Fix a bug in output section directive. 2017-06-08 19:47:16 +00:00
non-absolute.s [ELF] - Linkerscript: properly mark minus expression with non-absolute flag 2017-02-01 09:01:16 +00:00
non-absolute2.s Handle symbol assignments before the first section switch. 2017-02-06 22:21:46 +00:00
non-alloc-segment.s [LLD][LinkerScript] Allow non-alloc sections to be assigned to segments. 2017-07-03 10:11:25 +00:00
non-alloc.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
numbers.s Make a few tests shorter. NFC. 2017-04-12 22:38:02 +00:00
obj-symbol-value.s Change our linker script expr representation. 2017-03-17 13:05:04 +00:00
openbsd-bootdata.s [ELF] - Teach LLD to recognize PT_OPENBSD_BOOTDATA 2016-12-06 17:57:42 +00:00
openbsd-randomize.s [ELF] Choose default segment when it is not specified 2016-10-19 15:04:49 +00:00
openbsd-wxneeded.s [ELF] - Update testcases after llvm change. 2016-10-18 11:11:03 +00:00
operators.s [ELF] - Do not crash when ALIGN/DATA_SEGMENT_ALIGN expression used with zero value. 2017-07-28 09:27:49 +00:00
orphan-align.s Don't depend on lld creating space for the headers. 2016-09-30 00:06:24 +00:00
orphan-end.s Tweak orphan section placement. 2017-09-19 17:29:58 +00:00
orphan-first-cmd.s [ELF] - Linkerscript: make section with no content to be SHT_PROGBITS by default. 2017-04-14 09:37:00 +00:00
orphan-phdrs.s [LLD] Fix findOrphanPos to consistently ignore "dead" OutputSection's 2017-10-10 10:05:52 +00:00
orphan-report.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
orphan.s ELF: Place relro sections after non-relro sections in r/w segment. 2017-01-10 01:21:30 +00:00
orphans.s Revert "Revert "Only restrict order if both sections are in the script."" 2016-09-20 22:43:15 +00:00
ouputformat.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
out-of-order.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
output-too-large.s [LLD] Mark a number of x86 only tests to require x86 2017-07-18 18:40:50 +00:00
outputarch.s [ELF] - Linkerscript - fix handling of OUTPUT_ARCH command. 2017-02-08 09:59:06 +00:00
outsections-addr.s Make a few tests shorter. NFC. 2017-04-12 22:38:02 +00:00
page-size-align.s Use the correct MaxPageSize. 2016-12-07 20:10:43 +00:00
page-size.s Make a few tests shorter. NFC. 2017-04-12 22:38:02 +00:00
phdr-check.s [ELF] Don't output headers into a segment if there's no space for them 2017-08-23 18:44:34 +00:00
phdrs-flags.s [ELF] Choose default segment when it is not specified 2016-10-19 15:04:49 +00:00
phdrs.s Change which input sections we concatenate 2017-01-05 14:20:35 +00:00
pt_gnu_eh_frame.s [ELF] Fix crash when .eh_frame(_hdr) is discarded 2017-03-14 08:49:09 +00:00
region-alias.s [ELF] - Linkerscript: implement REGION_ALIAS. 2017-09-08 08:23:15 +00:00
repsection-symbol.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
repsection-va.s Make test less dependent on the section order. 2016-09-20 20:48:54 +00:00
rosegment.s Disable --rosegment when we have linker scripts. 2016-09-20 15:22:27 +00:00
searchdir.s Remove `REQUIRES: shell` hack to workaround an echo issue. 2016-12-09 18:49:37 +00:00
section-align.s [ELF] Handle output section alignment in linker scripts 2017-02-07 23:42:31 +00:00
section-metadata.s Fix pr32816. 2017-05-01 20:32:39 +00:00
sections-constraint.s Order writable executable sections before writable ones. 2017-05-26 17:23:25 +00:00
sections-constraint2.s Fix constraint checking in ONLY_IF_RO. 2016-09-16 20:34:02 +00:00
sections-constraint3.s Only process commands in a ONLY_IF_RO if it matches. 2016-09-16 21:05:36 +00:00
sections-constraint4.s [ELF] Linkerscript: fixed bug about commands processing. 2016-09-17 09:50:10 +00:00
sections-constraint5.s Implement ONLY_IF_RO/ONLY_IF_RW like bfd. 2016-09-21 18:33:44 +00:00
sections-gc.s [ELF] - Do not segfault when using --gc-sections with linker script 2017-02-21 15:46:43 +00:00
sections-gc2.s Fully precise gc handling of __start and __stop symbols. 2017-03-06 18:48:18 +00:00
sections-keep.s Include version string into ".comment" section. 2016-11-10 20:20:37 +00:00
sections-padding.s [ELF] Recommit r299635 to pad x86 executable sections with 0xcc 2017-04-07 10:36:42 +00:00
sections-sort.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
sections.s Error on trying to discard .dynamic. 2017-06-16 23:45:35 +00:00
segment-headers.s [ELF] Don't output headers into a segment if there's no space for them 2017-08-23 18:44:34 +00:00
segment-none.s [LLD][LinkerScript] Add support for segment NONE. 2017-06-19 15:28:58 +00:00
segment-start.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
sizeof.s Allow SIZEOF() command on nonexistent section. 2016-11-17 20:27:10 +00:00
sizeofheaders.s Disable --rosegment when we have linker scripts. 2016-09-20 15:22:27 +00:00
sort-constructors.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
sort-init.s [ELF] - Linkerscript: implemented SORT_BY_INIT_PRIORITY. 2016-09-15 19:15:12 +00:00
sort-nested.s Make tests less dependent on the exact layout. 2016-09-20 15:08:24 +00:00
sort-non-script.s [ELF] - Do --hash-style=both by default. 2017-10-06 09:37:44 +00:00
sort.s [ELF] - Accept --sort-section=xxx command form. 2016-12-16 11:59:52 +00:00
sort2.s Don't depend on lld creating space for the headers. 2016-09-30 00:06:24 +00:00
start-end.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
subalign.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
symbol-assignexpr.s [ELF, LinkerScript] Support ! operator in linker script. 2017-08-10 15:25:47 +00:00
symbol-conflict.s The expr '.' is not absolute. 2016-10-31 21:36:23 +00:00
symbol-memoryexpr.s Add memory ORIGIN and LENGTH expression support 2017-05-09 18:24:38 +00:00
symbol-only-flags.s [ELF] - Do not set output section flags except SHF_{ALLOC,WRITE,EXECINSTR}. 2017-10-11 08:13:40 +00:00
symbol-only.s [ELF] - Linkerscript: make section with no content to be SHT_PROGBITS by default. 2017-04-14 09:37:00 +00:00
symbol-ordering-file.s [ELF] - Fix "--symbol-ordering-file doesn't work with linker scripts" 2017-08-04 10:25:29 +00:00
symbol-reserved.s [ELF] Generate symbol assignments for predefined symbols 2017-09-01 02:23:31 +00:00
symbolreferenced.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
symbols-non-alloc.s Set non alloc section address to 0 earlier. 2017-06-13 20:57:43 +00:00
symbols-synthetic.s Revert "Add terminator to .eh_frame sections" 2017-02-28 18:55:08 +00:00
symbols.s [ELF] - Simplify and improve symbols.s testcase. 2017-09-08 09:31:01 +00:00
tbss.s Don't depend on lld creating space for the headers. 2016-09-30 00:06:24 +00:00
ttext-script.s Prefer -Ttext over linker script values. 2017-06-20 01:51:50 +00:00
undef.s Remove useless file prefix. 2016-09-02 20:40:53 +00:00
unused-synthetic.s [ELF] Remove unused synthetic sections from script commands 2017-07-03 15:49:25 +00:00
va.s Start linker scripts at 0. 2016-09-30 00:16:11 +00:00
visibility.s Correctly merge visibility of linkerscript created symbols. 2016-10-31 13:14:53 +00:00
wildcards.s Include version string into ".comment" section. 2016-11-10 20:20:37 +00:00
wildcards2.s Make tests less dependent on the exact layout. 2016-09-20 15:08:24 +00:00