-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[AArch64] Add support for SHF_AARCH64_PURECODE ELF section flag (1/3) #125687
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6ff1cc4
[AArch64] Add support for SHF_AARCH64_PURECODE ELF section flag (1/3)
Il-Capitano f528eb7
Address review feedback from #125689
Il-Capitano 25c34c0
Change formatting of `ElfAArch64SectionFlags`
Il-Capitano 2c47c28
Add tests for `llvm-readobj` and `llvm-objcopy`
Il-Capitano 835a800
Address review feedback
Il-Capitano 810e38d
Bugfix in `llvm-readelf` Key to Flags output
Il-Capitano bcb5275
Update arch-specific section flag test
Il-Capitano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,39 @@ | ||
; RUN: llc -mtriple=aarch64 -mattr=+execute-only %s -o - | FileCheck %s | ||
|
||
$test_comdat = comdat any | ||
|
||
; CHECK: .section .text,"axy",@progbits,unique,0 | ||
; CHECK-NOT: .section | ||
; CHECK-NOT: .text | ||
; CHECK: .globl test_section_for_global | ||
; CHECK: .type test_section_for_global,@function | ||
define void @test_section_for_global() { | ||
entry: | ||
ret void | ||
} | ||
|
||
; CHECK: .section .text.test_comdat,"axGy",@progbits,test_comdat,comdat,unique,0 | ||
; CHECK-NOT: .section | ||
; CHECK-NOT: .text | ||
; CHECK: .weak test_comdat | ||
; CHECK: .type test_comdat,@function | ||
define linkonce_odr void @test_comdat() comdat { | ||
entry: | ||
ret void | ||
} | ||
|
||
; CHECK: .section .test,"axy",@progbits | ||
; CHECK-NOT: .section | ||
; CHECK-NOT: .text | ||
; CHECK: .globl test_explicit_section_for_global | ||
; CHECK: .type test_explicit_section_for_global,@function | ||
define void @test_explicit_section_for_global() section ".test" { | ||
entry: | ||
ret void | ||
} | ||
|
||
; CHECK: .rodata,"a",@progbits | ||
; CHECK-NOT: .section | ||
; CHECK-NOT: .text | ||
; CHECK: .globl test_rodata | ||
@test_rodata = constant i32 0, align 4 |
27 changes: 27 additions & 0 deletions
27
llvm/test/MC/ELF/AArch64/execute-only-populated-text-section.s
This file contains hidden or 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,27 @@ | ||
// RUN: llvm-mc -filetype=obj -triple aarch64-unknown-linux-gnu %s -o - \ | ||
// RUN: | llvm-readobj -S --symbols - | FileCheck %s | ||
|
||
.text | ||
ret | ||
|
||
.section .text.foo,"axy" | ||
ret | ||
|
||
// CHECK: Section { | ||
// CHECK: Name: .text | ||
// CHECK-NEXT: Type: SHT_PROGBITS (0x1) | ||
// CHECK-NEXT: Flags [ (0x6) | ||
// CHECK-NEXT: SHF_ALLOC (0x2) | ||
// CHECK-NEXT: SHF_EXECINSTR (0x4) | ||
// CHECK-NEXT: ] | ||
// CHECK: } | ||
|
||
// CHECK: Section { | ||
// CHECK: Name: .text.foo | ||
// CHECK-NEXT: Type: SHT_PROGBITS (0x1) | ||
// CHECK-NEXT: Flags [ (0x20000006) | ||
// CHECK-NEXT: SHF_AARCH64_PURECODE (0x20000000) | ||
// CHECK-NEXT: SHF_ALLOC (0x2) | ||
// CHECK-NEXT: SHF_EXECINSTR (0x4) | ||
// CHECK-NEXT: ] | ||
// CHECK: } |
This file contains hidden or 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,55 @@ | ||
// RUN: llvm-mc -filetype=obj -triple aarch64-unknown-linux-gnu %s -o - \ | ||
// RUN: | llvm-readobj -S --symbols - | FileCheck %s --check-prefix=READOBJ | ||
// RUN: llvm-mc -filetype=obj -triple aarch64-unknown-linux-gnu %s -o - \ | ||
// RUN: | llvm-readelf -S --symbols - | FileCheck %s --check-prefix=READELF | ||
|
||
.section .text,"axy",@progbits,unique,0 | ||
.globl foo | ||
.p2align 2 | ||
.type foo,@function | ||
foo: | ||
.cfi_startproc | ||
ret | ||
.Lfunc_end0: | ||
.size foo, .Lfunc_end0-foo | ||
.cfi_endproc | ||
|
||
// READOBJ: Section { | ||
// READOBJ: Name: .text | ||
// READOBJ-NEXT: Type: SHT_PROGBITS (0x1) | ||
// READOBJ-NEXT: Flags [ (0x20000006) | ||
// READOBJ-NEXT: SHF_AARCH64_PURECODE (0x20000000) | ||
// READOBJ-NEXT: SHF_ALLOC (0x2) | ||
// READOBJ-NEXT: SHF_EXECINSTR (0x4) | ||
// READOBJ-NEXT: ] | ||
// READOBJ-NEXT: Address: | ||
// READOBJ-NEXT: Offset: | ||
// READOBJ-NEXT: Size: 0 | ||
// READOBJ: } | ||
|
||
// READOBJ: Section { | ||
// READOBJ: Name: .text | ||
// READOBJ-NEXT: Type: SHT_PROGBITS (0x1) | ||
// READOBJ-NEXT: Flags [ (0x20000006) | ||
// READOBJ-NEXT: SHF_AARCH64_PURECODE (0x20000000) | ||
// READOBJ-NEXT: SHF_ALLOC (0x2) | ||
// READOBJ-NEXT: SHF_EXECINSTR (0x4) | ||
// READOBJ-NEXT: ] | ||
// READOBJ-NEXT: Address: | ||
// READOBJ-NEXT: Offset: | ||
// READOBJ-NEXT: Size: 4 | ||
// READOBJ: } | ||
|
||
// READOBJ: Symbol { | ||
// READOBJ: Name: foo | ||
// READOBJ-NEXT: Value: | ||
// READOBJ-NEXT: Size: 4 | ||
// READOBJ-NEXT: Binding: Global | ||
// READOBJ-NEXT: Type: Function | ||
// READOBJ-NEXT: Other: | ||
// READOBJ-NEXT: Section: .text | ||
// READOBJ: } | ||
|
||
// READELF: Section Headers: | ||
// READELF: .text PROGBITS {{[0-9a-f]+}} {{[0-9a-f]+}} 000000 {{[0-9a-f]+}} AXy {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} | ||
// READELF: .text PROGBITS {{[0-9a-f]+}} {{[0-9a-f]+}} 000004 {{[0-9a-f]+}} AXy {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} |
This file contains hidden or 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,27 @@ | ||
// RUN: llvm-mc -filetype=obj -triple aarch64-unknown-linux-gnu %s -o - \ | ||
// RUN: | llvm-readobj -S --symbols - | FileCheck %s | ||
|
||
.text | ||
.ascii "test" | ||
|
||
.section .text.foo,"axy" | ||
ret | ||
|
||
// CHECK: Section { | ||
// CHECK: Name: .text | ||
// CHECK-NEXT: Type: SHT_PROGBITS (0x1) | ||
// CHECK-NEXT: Flags [ (0x6) | ||
// CHECK-NEXT: SHF_ALLOC (0x2) | ||
// CHECK-NEXT: SHF_EXECINSTR (0x4) | ||
// CHECK-NEXT: ] | ||
// CHECK: } | ||
|
||
// CHECK: Section { | ||
// CHECK: Name: .text.foo | ||
// CHECK-NEXT: Type: SHT_PROGBITS (0x1) | ||
// CHECK-NEXT: Flags [ (0x20000006) | ||
// CHECK-NEXT: SHF_AARCH64_PURECODE (0x20000000) | ||
// CHECK-NEXT: SHF_ALLOC (0x2) | ||
// CHECK-NEXT: SHF_EXECINSTR (0x4) | ||
// CHECK-NEXT: ] | ||
// CHECK: } |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.