-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[LLD][COFF] Deduplicate common chunks when linking COFF files. #162553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| ; REQUIRES: x86 | ||
| ; RUN: split-file %s %t.dir | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does Still, it may be good style to do a preemptive |
||
| ; RUN: llc %t.dir/t1.ll -o %t.t1.obj --filetype=obj | ||
|
||
| ; RUN: llc %t.dir/t2.ll -o %t.t2.obj --filetype=obj | ||
| ; RUN: lld-link %t.t1.obj %t.t2.obj -entry:main -out:%t.exe | ||
|
||
| ; RUN: llvm-readobj --section-headers %t.exe | FileCheck %s | ||
|
|
||
| ; Make sure that the data section contains just one copy of @a, not two. | ||
| ; CHECK: Name: .data | ||
| ; CHECK-NEXT: VirtualSize: 0x1000 | ||
|
|
||
| ;--- t1.ll | ||
| target triple = "x86_64-pc-windows-msvc" | ||
| @a = common global [4096 x i8] zeroinitializer | ||
|
|
||
| define i32 @usea() { | ||
| %ref_common = load i32, ptr @a | ||
| ret i32 %ref_common | ||
| } | ||
|
|
||
| ;--- t2.ll | ||
| target triple = "x86_64-pc-windows-msvc" | ||
| @a = common global [4096 x i8] zeroinitializer | ||
|
|
||
| define i32 @useb() { | ||
| %ref_common = load i32, ptr @a | ||
| ret i32 %ref_common | ||
| } | ||
|
|
||
| declare i32 @usea() | ||
|
|
||
| define dso_local i32 @main() local_unnamed_addr { | ||
| entry: | ||
| %a = tail call i32 @usea() | ||
| %b = tail call i32 @useb() | ||
| %add = add nsw i32 %a, %b | ||
| ret i32 %add | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.