forked from OSchip/llvm-project
				
			
		
			
				
	
	
		
			69 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
## Test that we are able to print dynamic relocations with --dyn-relocations
 | 
						|
## even when there are no section headers.
 | 
						|
 | 
						|
# RUN: yaml2obj %s -o %t
 | 
						|
# RUN: llvm-readobj --dyn-relocations %t 2>&1 \
 | 
						|
# RUN:  | FileCheck %s -DFILE=%t --implicit-check-not="warning:" --check-prefix=LLVM-NO-SEC-TABLE
 | 
						|
# RUN: llvm-readelf --dyn-relocations %t 2>&1 \
 | 
						|
# RUN:  | FileCheck %s -DFILE=%t --implicit-check-not="warning:" --check-prefix=GNU-NO-SEC-TABLE
 | 
						|
 | 
						|
# LLVM-NO-SEC-TABLE:      Dynamic Relocations {
 | 
						|
# LLVM-NO-SEC-TABLE-NEXT:   0x0 R_X86_64_NONE foo 0x0
 | 
						|
# LLVM-NO-SEC-TABLE-NEXT: }
 | 
						|
 | 
						|
# GNU-NO-SEC-TABLE:      'RELA' relocation section at offset 0xb0 contains 24 bytes:
 | 
						|
# GNU-NO-SEC-TABLE-NEXT: Offset            Info             Type             Symbol's Value   Symbol's Name + Addend
 | 
						|
# GNU-NO-SEC-TABLE-NEXT: 0000000000000000  0000000100000000 R_X86_64_NONE    0000000000000000 foo + 0
 | 
						|
 | 
						|
--- !ELF
 | 
						|
FileHeader:
 | 
						|
  Class:   ELFCLASS64
 | 
						|
  Data:    ELFDATA2LSB
 | 
						|
  Type:    ET_DYN
 | 
						|
  Machine: EM_X86_64
 | 
						|
## We simulate no section header table by
 | 
						|
## overriding the ELF header properties.
 | 
						|
  SHOff:   0x0
 | 
						|
  SHNum:   0x0
 | 
						|
Sections:
 | 
						|
  - Name:    .rela.dyn
 | 
						|
    Type:    SHT_RELA
 | 
						|
    Relocations:
 | 
						|
      - Type:   R_X86_64_NONE
 | 
						|
        Symbol: 0x1
 | 
						|
  - Name: .dynamic
 | 
						|
    Type: SHT_DYNAMIC
 | 
						|
    Entries:
 | 
						|
      - Tag:   DT_RELA
 | 
						|
        Value: 0x0
 | 
						|
      - Tag:   DT_RELASZ
 | 
						|
        Value: 0x18
 | 
						|
      - Tag:   DT_RELAENT
 | 
						|
        Value: 0x18
 | 
						|
## Offset of .dynsym is 0x138. Offset of PT_LOAD is 0xb0.
 | 
						|
## 0x138 - 0xb0 == 0x88
 | 
						|
      - Tag:   DT_SYMTAB
 | 
						|
        Value: 0x88
 | 
						|
      - Tag:   DT_STRSZ
 | 
						|
        Value: 0x5
 | 
						|
## Offset of .dynstr is 0x168. Offset of PT_LOAD is 0xb0.
 | 
						|
## 0x168 - 0xb0 == 0xb8
 | 
						|
      - Tag:   DT_STRTAB
 | 
						|
        Value: 0xb8
 | 
						|
      - Tag:   DT_NULL
 | 
						|
        Value: 0x0
 | 
						|
  - Name:    .dynsym
 | 
						|
    Type:    SHT_DYNSYM
 | 
						|
DynamicSymbols:
 | 
						|
  - Name: foo
 | 
						|
ProgramHeaders:
 | 
						|
  - Type:  PT_LOAD
 | 
						|
    Sections:
 | 
						|
      - Section: .rela.dyn
 | 
						|
      - Section: .dynamic
 | 
						|
        Section: .dynsym
 | 
						|
        Section: .dynstr
 | 
						|
  - Type:  PT_DYNAMIC
 | 
						|
    Sections:
 | 
						|
      - Section: .dynamic
 |