-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-objcopy][ELF] Disable huge section offset
By default, GNU objcopy issues a warning for large offsets in ELF files. To align with this behavior, we introduce an option to define a maximum file offset for a section. This allows us to skip creating excessively large files by specifying a threshold beyond which the file offset will trigger an error.
- Loading branch information
Showing
7 changed files
with
61 additions
and
9 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
27 changes: 27 additions & 0 deletions
27
llvm/test/tools/llvm-objcopy/ELF/disable-huge-section-offset.yaml
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,27 @@ | ||
# RUN: yaml2obj %s --docnum=1 -o %t | ||
# RUN: not llvm-objcopy -O binary %t %t2 --set-max-huge-section-offset=2000000000 2>&1 | FileCheck %s | ||
|
||
# CHECK: writing section .high_addr at huge file offset | ||
|
||
--- !ELF | ||
FileHeader: | ||
Class: ELFCLASS32 | ||
Data: ELFDATA2LSB | ||
Type: ET_EXEC | ||
Machine: EM_MIPS | ||
Sections: | ||
- Name: .text | ||
Type: SHT_PROGBITS | ||
Flags: [ SHF_ALLOC, SHF_EXECINSTR ] | ||
Address: 0x1000 | ||
Content: "00112233445566778899AABBCCDDEEFF" | ||
- Name: .data | ||
Type: SHT_PROGBITS | ||
Flags: [ SHF_ALLOC, SHF_WRITE ] | ||
Address: 0x2000 | ||
Content: "112233445566778899AABBCCDDEEFF00" | ||
- Name: .high_addr | ||
Type: SHT_PROGBITS | ||
Flags: [ SHF_ALLOC, SHF_WRITE ] | ||
Address: 0x80001000 | ||
Content: "2233445566778899AABBCCDDEEFF0011" |
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