-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch adds AsNeeded and IsUsed bool fields to SharedFile. AsNeeded bit is set if the DSO is enclosed with --as-needed and --no-as-needed. IsUsed bit is off by default. When we adds a symbol to the symbol table for dynamic linking, we set its SharedFile's IsUsed bit. If AsNeeded is set but IsUsed is not set, we don't want to write that file's SO name to DT_NEEDED field. http://reviews.llvm.org/D13579 llvm-svn: 249998
- Loading branch information
Showing
13 changed files
with
106 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.global bar2 | ||
.type bar2, @function | ||
bar2: | ||
|
||
.global zed2 | ||
zed2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.global baz | ||
.type barz, @function | ||
baz: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// REQUIRES: x86 | ||
// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %s -o %t.o | ||
// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared.s -o %t2.o | ||
// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared2.s -o %t3.o | ||
// RUN: llvm-mc -filetype=obj -triple=i686-unknown-linux %p/Inputs/shared3.s -o %t4.o | ||
// RUN: ld.lld2 -shared %t2.o -soname shared1 -o %t2.so | ||
// RUN: ld.lld2 -shared %t3.o -soname shared2 -o %t3.so | ||
// RUN: ld.lld2 -shared %t4.o -soname shared3 -o %t4.so | ||
|
||
/// Check if --as-needed actually works. | ||
|
||
// RUN: ld.lld2 %t.o %t2.so %t3.so %t4.so -o %t2 | ||
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s | ||
|
||
// RUN: ld.lld2 --as-needed %t.o %t2.so %t3.so %t4.so -o %t2 | ||
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s | ||
|
||
// RUN: ld.lld2 --as-needed %t.o %t2.so --no-as-needed %t3.so %t4.so -o %t2 | ||
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s | ||
|
||
/// GROUP directive is the same as --as-needed. | ||
|
||
// RUN: echo "GROUP(" %t2.so %t3.so %t4.so ")" > %t.script | ||
// RUN: ld.lld2 %t.o %t.script -o %t2 | ||
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s | ||
|
||
// RUN: echo "GROUP(AS_NEEDED(" %t2.so %t3.so %t4.so "))" > %t.script | ||
// RUN: ld.lld2 %t.o %t.script -o %t2 | ||
// RUN: llvm-readobj -dynamic-table %t2 | FileCheck -check-prefix=CHECK2 %s | ||
|
||
// CHECK: NEEDED SharedLibrary (shared1) | ||
// CHECK: NEEDED SharedLibrary (shared2) | ||
// CHECK: NEEDED SharedLibrary (shared3) | ||
|
||
// CHECK2: NEEDED SharedLibrary (shared1) | ||
// CHECK2-NOT: NEEDED SharedLibrary (shared2) | ||
// CHECK2-NOT: NEEDED SharedLibrary (shared3) | ||
|
||
.global _start | ||
_start: | ||
.long bar | ||
.long zed | ||
.weak baz |