[PATCH] D28552: [ELF] - Ignore R_386_NONE.

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 05:46:37 PST 2017


LGTM assuming at least bfd or gold do this too.

Cheers,
Rafael

George Rimar via Phabricator <reviews at reviews.llvm.org> writes:

> grimar created this revision.
> grimar added reviewers: ruiu, rafael.
> grimar added subscribers: llvm-commits, grimar, evgeny777.
>
> R_X86_64_NONE is ignored starting from r288485,
> I guess we want to do the same for R_386_NONE ?
> Currently we error out this relocation as not supported and
> ignoring seems to be correct behavior.
>
>
> https://reviews.llvm.org/D28552
>
> Files:
>   ELF/Target.cpp
>   test/ELF/relocation-none-i686.test
>
>
> Index: test/ELF/relocation-none-i686.test
> ===================================================================
> --- test/ELF/relocation-none-i686.test
> +++ test/ELF/relocation-none-i686.test
> @@ -0,0 +1,23 @@
> +# RUN: yaml2obj %s -o %t.o
> +# RUN: ld.lld %t.o -o %t.out
> +
> +# Test that we can handle R_386_NONE.
> +
> +!ELF
> +FileHeader:
> +  Class:           ELFCLASS32
> +  Data:            ELFDATA2LSB
> +  Type:            ET_REL
> +  Machine:         EM_386
> +Sections:
> +  - Name:            .text
> +    Type:            SHT_PROGBITS
> +    Flags:           [ SHF_ALLOC ]
> +  - Name:            .rel.text
> +    Type:            SHT_RELA
> +    Link:            .symtab
> +    Info:            .text
> +    Relocations:
> +      - Offset:          0x0000000000000000
> +        Symbol:          ''
> +        Type:            R_386_NONE
> Index: ELF/Target.cpp
> ===================================================================
> --- ELF/Target.cpp
> +++ ELF/Target.cpp
> @@ -383,6 +383,8 @@
>      return R_TLS;
>    case R_386_TLS_LE_32:
>      return R_NEG_TLS;
> +  case R_386_NONE:
> +    return R_HINT;
>    default:
>      error("do not know how to handle relocation " + toString(Type) + " (" +
>            Twine(Type) + ")");
>
>
> Index: test/ELF/relocation-none-i686.test
> ===================================================================
> --- test/ELF/relocation-none-i686.test
> +++ test/ELF/relocation-none-i686.test
> @@ -0,0 +1,23 @@
> +# RUN: yaml2obj %s -o %t.o
> +# RUN: ld.lld %t.o -o %t.out
> +
> +# Test that we can handle R_386_NONE.
> +
> +!ELF
> +FileHeader:
> +  Class:           ELFCLASS32
> +  Data:            ELFDATA2LSB
> +  Type:            ET_REL
> +  Machine:         EM_386
> +Sections:
> +  - Name:            .text
> +    Type:            SHT_PROGBITS
> +    Flags:           [ SHF_ALLOC ]
> +  - Name:            .rel.text
> +    Type:            SHT_RELA
> +    Link:            .symtab
> +    Info:            .text
> +    Relocations:
> +      - Offset:          0x0000000000000000
> +        Symbol:          ''
> +        Type:            R_386_NONE
> Index: ELF/Target.cpp
> ===================================================================
> --- ELF/Target.cpp
> +++ ELF/Target.cpp
> @@ -383,6 +383,8 @@
>      return R_TLS;
>    case R_386_TLS_LE_32:
>      return R_NEG_TLS;
> +  case R_386_NONE:
> +    return R_HINT;
>    default:
>      error("do not know how to handle relocation " + toString(Type) + " (" +
>            Twine(Type) + ")");


More information about the llvm-commits mailing list