mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
Our code assumes all input sections in an output SHF_LINK_ORDER section has SHF_LINK_ORDER flag. We do not check that and that can cause a crash. That happens because we call std::stable_sort(Sections.begin(), Sections.end(), compareByFilePosition);, where compareByFilePosition predicate does not expect to see null when calls getLinkOrderDep. The same might happen when sections refer to non-regular sections. Test cases demonstrate the issues, patch fixes them. Differential revision: https://reviews.llvm.org/D44193 llvm-svn: 327006
18 lines
433 B
ArmAsm
18 lines
433 B
ArmAsm
# REQUIRES: x86
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
|
|
# RUN: not ld.lld %t.o -o %t 2>&1 | FileCheck %s
|
|
|
|
# CHECK: error: incompatible section flags for .bar
|
|
# CHECK-NEXT: >>> {{.*}}section-metadata-err3.s.tmp.o:(.bar): 0x2
|
|
# CHECK-NEXT: >>> output section .bar: 0x82
|
|
|
|
.section .foo,"a",@progbits
|
|
.quad 0
|
|
|
|
.section .bar,"ao",@progbits,.foo,unique,1
|
|
.quad 0
|
|
|
|
.section .bar,"a",@progbits,unique,2
|
|
.quad 1
|