diff options
author | Koushik Dutta <koushd@gmail.com> | 2013-07-10 11:38:31 -0700 |
---|---|---|
committer | Koushik Dutta <koushd@gmail.com> | 2013-07-10 11:38:31 -0700 |
commit | a7cdbea0f43f3c59bf3137efb9fead4238072d01 (patch) | |
tree | 051059b3e7848c7736346adfa20f46ca43638762 /libdwfl/relocate.c | |
parent | 101941576c52a1270c9c2d63ea95d48729d6cf96 (diff) | |
download | android_external_elfutils-cm-10.1.tar.gz android_external_elfutils-cm-10.1.tar.bz2 android_external_elfutils-cm-10.1.zip |
Add support for clang:cm-10.1.3-RC2cm-10.1.3-RC1cm-10.1.3cm-10.1
elfutils seems to exclusively use a gcc extension, nested functions.
clang does not implement this extension, but does have a similar
feature, blocks.
They both function in essentially the same way: closures in C.
Change-Id: I75aba2a37145ef3942d4f1b2019949cfbbdc55a9
Diffstat (limited to 'libdwfl/relocate.c')
-rw-r--r-- | libdwfl/relocate.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libdwfl/relocate.c b/libdwfl/relocate.c index abacc041..2813d498 100644 --- a/libdwfl/relocate.c +++ b/libdwfl/relocate.c @@ -303,8 +303,14 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, return DWFL_E_LIBELF; /* Apply one relocation. Returns true for any invalid data. */ +#ifdef __clang__ + Dwfl_Error (^relocate) (GElf_Addr, const GElf_Sxword *, + int, int) = ^Dwfl_Error (GElf_Addr offset, const GElf_Sxword *addend, + int rtype, int symndx) +#else Dwfl_Error relocate (GElf_Addr offset, const GElf_Sxword *addend, int rtype, int symndx) +#endif { /* First see if this is a reloc we can handle. If we are skipping it, don't bother resolving the symbol. */ @@ -430,16 +436,22 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, /* We have applied this relocation! */ return DWFL_E_NOERROR; - } + }; /* Fetch the relocation section and apply each reloc in it. */ Elf_Data *reldata = elf_getdata (scn, NULL); if (reldata == NULL) return DWFL_E_LIBELF; +#ifdef __clang__ + __block Dwfl_Error result = DWFL_E_NOERROR; + __block bool first_badreltype = true; + void (^check_badreltype) (void) = ^void (void) +#else Dwfl_Error result = DWFL_E_NOERROR; bool first_badreltype = true; - inline void check_badreltype (void) + inline void check_badreltype(void) +#endif { if (first_badreltype) { @@ -449,7 +461,7 @@ relocate_section (Dwfl_Module *mod, Elf *relocated, const GElf_Ehdr *ehdr, any libebl_CPU.so library. Diagnose that clearly. */ result = DWFL_E_UNKNOWN_MACHINE; } - } + }; size_t nrels = shdr->sh_size / shdr->sh_entsize; size_t complete = 0; |