[lld] r246234 - [elf2] Add basic relocation support for x86-64.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 07:31:39 PDT 2015


> --- lld/trunk/test/elf2/invalid-relocations.test (added)
> +++ lld/trunk/test/elf2/invalid-relocations.test Thu Aug 27 18:15:56 2015
> @@ -0,0 +1,30 @@
> +# RUN: yaml2obj -format elf %s -o %t
> +# RUN: not lld -flavor gnu2 %t -o %tout 2>&1 | FileCheck %s
> +
> +FileHeader:
> +  Class:           ELFCLASS64
> +  Data:            ELFDATA2LSB
> +  OSABI:           ELFOSABI_GNU
> +  Type:            ET_REL
> +  Machine:         EM_X86_64
> +Sections:
> +  - Name:            .text
> +    Type:            SHT_PROGBITS
> +    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
> +    AddressAlign:    0x0000000000000004
> +    Content:         E800000000
> +  - Name:            .rela.text
> +    Type:            SHT_RELA
> +    Info:            12 # Invalid index
> +    Relocations:
> +      - Offset:          0x0000000000000001
> +        Symbol:          lulz
> +        Type:            R_X86_64_PC32
> +        Addend:          -4
> +Symbols:
> +  Global:
> +    - Name:            lulz
> +      Type:            STT_FUNC
> +      Section:         .text
> +
> +# CHECK: Invalid relocated section index
>

And this for once is a reasonable use of yaml2obj. In the future
please just make sure to delete unnecessary defaults.

Some of the files in test/elf2/Inputs/ could be converted if yaml2obj
supported numeric values in other fields in case you are interested in
implementing that.

It would also be nice to make more fields optional.

Cheers,
Rafael


More information about the llvm-commits mailing list