-
Notifications
You must be signed in to change notification settings - Fork 15k
[LLD][ELF] Support OVERLAY symbol assignments #159895
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
base: main
Are you sure you want to change the base?
Changes from all 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,32 @@ | ||
| # REQUIRES: x86 | ||
| # RUN: echo 'nop; .section .small, "a"; .long 0; .section .big1, "a"; .quad 1; .section .big2, "a"; .quad 2;' \ | ||
| # RUN: | llvm-mc -filetype=obj -triple=x86_64 - -o %t.o | ||
| # RUN: ld.lld %t.o --script %s -o %t | ||
|
|
||
| SECTIONS { | ||
| OVERLAY 0x1000 : AT ( 0x4000 ) { | ||
| .out.big { | ||
| *(.big1) | ||
| . = ALIGN(0x100); | ||
| *(.big2) | ||
|
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. also define a symbol |
||
| } | ||
| .out.small { *(.small) } | ||
| } | ||
| } | ||
|
|
||
| ## A variant of overlay.test with explicit program header assingment. | ||
| ## Check that we generate two program headers consistent with the overlay | ||
|
|
||
| # RUN: llvm-readelf -S -l %t | FileCheck %s | ||
|
|
||
| # CHECK: Section Headers: | ||
| # CHECK: Name Type Address Off Size | ||
| # CHECK: .out.big PROGBITS 0000000000001000 001000 000108 | ||
| # CHECK-NEXT: .out.small PROGBITS 0000000000001000 002000 000004 | ||
|
|
||
|
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. just one blank line |
||
|
|
||
| # CHECK: Program Headers: | ||
| # CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align | ||
| # CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000004000 0x000108 0x000108 R 0x1000 | ||
| # CHECK-NEXT: LOAD 0x002000 0x0000000000001000 0x0000000000004108 0x000004 0x000004 R 0x1000 | ||
|
|
||
|
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. delete blank lines at the end |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use
RUN: rm -rf %t && split-file %s %t && cd %tpattern to prepare the input assembly file.You can use
#--- a.sfor assembly and#--- 1.ldsfor the linker script.