File: output-limit.yaml

package info (click to toggle)
llvm-toolchain-14 1%3A14.0.6-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,496,180 kB
  • sloc: cpp: 5,593,972; ansic: 986,872; asm: 585,869; python: 184,223; objc: 72,530; lisp: 31,119; f90: 27,793; javascript: 9,780; pascal: 9,762; sh: 9,482; perl: 7,468; ml: 5,432; awk: 3,523; makefile: 2,538; xml: 953; cs: 573; fortran: 567
file content (53 lines) | stat: -rw-r--r-- 1,727 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## Check that yaml2obj limits the output size by default to 10 MB.
## Check it is possible to change this limit using the
## --max-size command line option.

## One of the often cases to reach the limit is to create a section with a
## large portion of data. Check this case is handled properly.

## 0x9FFEC0 = 0xA00000 (10 MB) - sizeof(Elf_Ehdr) - sizeof(Elf_Shdr) * 4.
# RUN: yaml2obj %s -DSIZE=0x9FFEC0 --docnum=1 -o /dev/null 2>&1
# RUN: not yaml2obj %s -DSIZE=0x9FFEC1 --docnum=1 -o /dev/null 2>&1 | \
# RUN:  FileCheck %s --check-prefix=ERROR

# ERROR: error: the desired output size is greater than permitted. Use the --max-size option to change the limit

## We use 0xA00008 instead of 0xA00001 here because the section header table
## offset is aligned to 8 bytes, so we need to request 7 more bytes for it.
# RUN: yaml2obj %s -DSIZE=0x9FFEC1 --docnum=1 --max-size=0xA00008 -o /dev/null

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_REL
Sections:
  - Name: .section
    Type: SHT_PROGBITS
    Size: [[SIZE]]
  - Name: .strtab
    Type: SHT_PROGBITS
    Size: 0x0
  - Name: .shstrtab
    Type: SHT_PROGBITS
    Size: 0x0

## Another possible case is when an alignment gap inserted
## is too large because of overaligning. Check it is also handled properly.
# RUN: not yaml2obj %s --docnum=2 -o /dev/null 2>&1 | FileCheck %s --check-prefix=ERROR

--- !ELF
FileHeader:
  Class: ELFCLASS64
  Data:  ELFDATA2LSB
  Type:  ET_REL
Sections:
  - Name: .foo
    Type: SHT_PROGBITS
  - Name:         .bar
    Type:         SHT_PROGBITS
    AddressAlign: 0xA00100
    Size: 0x0

## Check that we can drop the limit with the use of --max-size=0.
# RUN: yaml2obj --max-size=0 %s --docnum=2 -o /dev/null