Revert "Only restrict order if both sections are in the script."

This reverts commit r282015. It broke some bots.

llvm-svn: 282021
This commit is contained in:
Rafael Espindola 2016-09-20 21:28:19 +00:00
parent e90797794f
commit bf04708e11
4 changed files with 7 additions and 23 deletions

View File

@ -664,12 +664,12 @@ template <class ELFT> int LinkerScript<ELFT>::getSectionIndex(StringRef Name) {
}
// A compartor to sort output sections. Returns -1 or 1 if
// A and B are mentioned in linker script. Otherwise, returns 0.
// A or B are mentioned in linker script. Otherwise, returns 0.
template <class ELFT>
int LinkerScript<ELFT>::compareSections(StringRef A, StringRef B) {
int I = getSectionIndex(A);
int J = getSectionIndex(B);
if (I == INT_MAX || J == INT_MAX)
if (I == INT_MAX && J == INT_MAX)
return 0;
return I < J ? -1 : 1;
}

View File

@ -14,8 +14,8 @@
# TEXTORPHAN: Sections:
# TEXTORPHAN-NEXT: Idx Name
# TEXTORPHAN-NEXT: 0
# TEXTORPHAN-NEXT: 1 .text
# TEXTORPHAN-NEXT: 2 .writable
# TEXTORPHAN-NEXT: 1 .writable
# TEXTORPHAN-NEXT: 2 .text
# WRITABLEORPHAN: Sections:
# WRITABLEORPHAN-NEXT: Idx Name

View File

@ -6,13 +6,13 @@
# RUN: llvm-readobj -t %t1 | FileCheck %s
# CHECK: Name: foo1
# CHECK-NEXT: Value: 0x288
# CHECK-NEXT: Value: 0x200
# CHECK: Name: foo2
# CHECK-NEXT: Value: 0x290
# CHECK-NEXT: Value: 0x208
# CHECK: Name: foo3
# CHECK-NEXT: Value: 0x294
# CHECK-NEXT: Value: 0x20C
.section .foo.1,"a"
.long 1

View File

@ -1,16 +0,0 @@
# REQUIRES: x86
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t
# RUN: echo "SECTIONS { foo : {*(foo)} }" > %t.script
# RUN: ld.lld -o %t1 --script %t.script %t -shared
# RUN: llvm-readobj -elf-output-style=GNU -s %t1 | FileCheck %s
# CHECK: .dynsym {{.*}} A
# CHECK-NEXT: .hash {{.*}} A
# CHECK-NEXT: .dynstr {{.*}} A
# CHECK-NEXT: .text {{.*}} AX
# CHECK-NEXT: .dynamic {{.*}} WA
# CHECK-NEXT: foo {{.*}} WA
.section foo, "aw"
.byte 0