diff --git a/lib/Object/ELFYAML.cpp b/lib/Object/ELFYAML.cpp index f44b93718bc..7cfada893ad 100644 --- a/lib/Object/ELFYAML.cpp +++ b/lib/Object/ELFYAML.cpp @@ -592,7 +592,7 @@ void MappingTraits::mapping(IO &IO, } else IO.mapRequired("Type", Rel.Type); - IO.mapOptional("Addend", Rel.Addend); + IO.mapOptional("Addend", Rel.Addend, (int64_t)0); } void MappingTraits::mapping(IO &IO, ELFYAML::Object &Object) { diff --git a/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml b/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml index b8fb68113c7..c27e888a47c 100644 --- a/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml +++ b/test/Object/AArch64/yaml2obj-elf-aarch64-rel.yaml @@ -10,11 +10,9 @@ # CHECK-NEXT: - Offset: 0x0000000000000000 # CHECK-NEXT: Symbol: main # CHECK-NEXT: Type: R_AARCH64_ABS64 -# CHECK-NEXT: Addend: 0 # CHECK-NEXT: - Offset: 0x0000000000000008 # CHECK-NEXT: Symbol: main # CHECK-NEXT: Type: R_AARCH64_TLSGD_ADR_PREL21 -# CHECK-NEXT: Addend: 0 FileHeader: Class: ELFCLASS64 diff --git a/test/Object/Mips/elf-mips64-rel.yaml b/test/Object/Mips/elf-mips64-rel.yaml index c9f049570a7..8b595099b9e 100644 --- a/test/Object/Mips/elf-mips64-rel.yaml +++ b/test/Object/Mips/elf-mips64-rel.yaml @@ -29,21 +29,17 @@ # YAML-NEXT: - Offset: 0x0000000000000020 # YAML-NEXT: Symbol: .rodata # YAML-NEXT: Type: R_MIPS_GOT_PAGE -# YAML-NEXT: Addend: 0 # YAML-NEXT: - Offset: 0x0000000000000024 # YAML-NEXT: Symbol: .rodata # YAML-NEXT: Type: R_MIPS_GOT_OFST -# YAML-NEXT: Addend: 0 # YAML-NEXT: - Offset: 0x0000000000000028 # YAML-NEXT: Symbol: printf # YAML-NEXT: Type: R_MIPS_CALL16 -# YAML-NEXT: Addend: 0 # YAML-NEXT: - Offset: 0x0000000000000030 # YAML-NEXT: Symbol: printf # YAML-NEXT: Type: R_MIPS_GPREL16 # YAML-NEXT: Type2: R_MIPS_LO16 # YAML-NEXT: SpecSym: RSS_GP0 -# YAML-NEXT: Addend: 0 --- FileHeader: diff --git a/test/Object/obj2yaml.test b/test/Object/obj2yaml.test index 1c79e98fdc3..e654dcdccf5 100644 --- a/test/Object/obj2yaml.test +++ b/test/Object/obj2yaml.test @@ -210,27 +210,21 @@ ELF-MIPSEL-NEXT: Relocations: ELF-MIPSEL-NEXT: - Offset: 0x0000000000000000 ELF-MIPSEL-NEXT: Symbol: _gp_disp ELF-MIPSEL-NEXT: Type: R_MIPS_HI16 -ELF-MIPSEL-NEXT: Addend: 0 ELF-MIPSEL-NEXT: - Offset: 0x0000000000000004 ELF-MIPSEL-NEXT: Symbol: _gp_disp ELF-MIPSEL-NEXT: Type: R_MIPS_LO16 -ELF-MIPSEL-NEXT: Addend: 0 ELF-MIPSEL-NEXT: - Offset: 0x0000000000000018 ELF-MIPSEL-NEXT: Symbol: '$.str' ELF-MIPSEL-NEXT: Type: R_MIPS_GOT16 -ELF-MIPSEL-NEXT: Addend: 0 ELF-MIPSEL-NEXT: - Offset: 0x000000000000001C ELF-MIPSEL-NEXT: Symbol: '$.str' ELF-MIPSEL-NEXT: Type: R_MIPS_LO16 -ELF-MIPSEL-NEXT: Addend: 0 ELF-MIPSEL-NEXT: - Offset: 0x0000000000000020 ELF-MIPSEL-NEXT: Symbol: puts ELF-MIPSEL-NEXT: Type: R_MIPS_CALL16 -ELF-MIPSEL-NEXT: Addend: 0 ELF-MIPSEL-NEXT: - Offset: 0x000000000000002C ELF-MIPSEL-NEXT: Symbol: SomeOtherFunction ELF-MIPSEL-NEXT: Type: R_MIPS_CALL16 -ELF-MIPSEL-NEXT: Addend: 0 ELF-MIPSEL-NEXT: - Name: .data ELF-MIPSEL-NEXT: Type: SHT_PROGBITS ELF-MIPSEL-NEXT: Flags: [ SHF_WRITE, SHF_ALLOC ] @@ -328,7 +322,6 @@ ELF-MIPS64EL-NEXT: Relocations: ELF-MIPS64EL-NEXT: - Offset: 0 ELF-MIPS64EL-NEXT: Symbol: zed ELF-MIPS64EL-NEXT: Type: R_MIPS_64 -ELF-MIPS64EL-NEXT: Addend: 0 ELF-MIPS64EL-NEXT: - Name: .bss ELF-MIPS64EL-NEXT: Type: SHT_NOBITS ELF-MIPS64EL-NEXT: Flags: [ SHF_WRITE, SHF_ALLOC ] @@ -398,7 +391,6 @@ ELF-X86-64-NEXT: Relocations: ELF-X86-64-NEXT: - Offset: 0x000000000000000D ELF-X86-64-NEXT: Symbol: .rodata.str1.1 ELF-X86-64-NEXT: Type: R_X86_64_32S -ELF-X86-64-NEXT: Addend: 0 ELF-X86-64-NEXT: - Offset: 0x0000000000000012 ELF-X86-64-NEXT: Symbol: puts ELF-X86-64-NEXT: Type: R_X86_64_PC32