summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdw/dwarf_entry_breakpoints.c24
-rw-r--r--libdw/dwarf_getscopevar.c9
-rw-r--r--libdw/libdw_visit_scopes.c6
-rw-r--r--libdwfl/dwfl_module.c8
-rw-r--r--libdwfl/relocate.c18
-rw-r--r--libelf/elf_begin.c6
6 files changed, 60 insertions, 11 deletions
diff --git a/libdw/dwarf_entry_breakpoints.c b/libdw/dwarf_entry_breakpoints.c
index 578464f3..f6baaf6f 100644
--- a/libdw/dwarf_entry_breakpoints.c
+++ b/libdw/dwarf_entry_breakpoints.c
@@ -60,11 +60,19 @@ dwarf_entry_breakpoints (die, bkpts)
Dwarf_Die *die;
Dwarf_Addr **bkpts;
{
+#ifdef __clang__
+ __block int nbkpts = 0;
+#else
int nbkpts = 0;
+#endif
*bkpts = NULL;
/* Add one breakpoint location to the result vector. */
+#ifdef __clang__
+ int (^add_bkpt) (Dwarf_Addr) = ^int (Dwarf_Addr pc)
+#else
inline int add_bkpt (Dwarf_Addr pc)
+#endif
{
Dwarf_Addr *newlist = realloc (*bkpts, ++nbkpts * sizeof newlist[0]);
if (newlist == NULL)
@@ -77,14 +85,18 @@ dwarf_entry_breakpoints (die, bkpts)
newlist[nbkpts - 1] = pc;
*bkpts = newlist;
return nbkpts;
- }
+ };
/* Fallback result, break at the entrypc/lowpc value. */
+#ifdef __clang__
+ int (^entrypc_bkpt) (void) = ^int (void)
+#else
inline int entrypc_bkpt (void)
+#endif
{
Dwarf_Addr pc;
return INTUSE(dwarf_entrypc) (die, &pc) < 0 ? -1 : add_bkpt (pc);
- }
+ };
/* Fetch the CU's line records to look for this DIE's addresses. */
Dwarf_Die cudie = CUDIE (die->cu);
@@ -102,8 +114,14 @@ dwarf_entry_breakpoints (die, bkpts)
/* Search a contiguous PC range for prologue-end markers.
If DWARF, look for proper markers.
Failing that, if ADHOC, look for the ad hoc convention. */
+#ifdef __clang__
+ int (^search_range) (Dwarf_Addr, Dwarf_Addr,
+ bool, bool) = ^int (Dwarf_Addr low, Dwarf_Addr high,
+ bool dwarf, bool adhoc)
+#else
inline int search_range (Dwarf_Addr low, Dwarf_Addr high,
bool dwarf, bool adhoc)
+#endif
{
size_t l = 0, u = nlines;
while (l < u)
@@ -136,7 +154,7 @@ dwarf_entry_breakpoints (die, bkpts)
}
__libdw_seterrno (DWARF_E_INVALID_DWARF);
return -1;
- }
+ };
/* Search each contiguous address range for DWARF prologue_end markers. */
diff --git a/libdw/dwarf_getscopevar.c b/libdw/dwarf_getscopevar.c
index 4e5b429e..5288fcf4 100644
--- a/libdw/dwarf_getscopevar.c
+++ b/libdw/dwarf_getscopevar.c
@@ -91,9 +91,14 @@ dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
{
/* Match against the given file name. */
size_t match_file_len = match_file == NULL ? 0 : strlen (match_file);
- bool lastfile_matches = false;
const char *lastfile = NULL;
+#ifdef __clang__
+ __block bool lastfile_matches = false;
+ bool (^file_matches) (Dwarf_Files *, size_t) = ^bool (Dwarf_Files *files, size_t idx)
+#else
+ bool lastfile_matches = false;
inline bool file_matches (Dwarf_Files *files, size_t idx)
+#endif
{
if (idx >= files->nfiles)
return false;
@@ -108,7 +113,7 @@ dwarf_getscopevar (Dwarf_Die *scopes, int nscopes,
|| file[len - match_file_len - 1] == '/'));
}
return lastfile_matches;
- }
+ };
/* Start with the innermost scope and move out. */
for (int out = 0; out < nscopes; ++out)
diff --git a/libdw/libdw_visit_scopes.c b/libdw/libdw_visit_scopes.c
index 9c7c3789..fd7f402f 100644
--- a/libdw/libdw_visit_scopes.c
+++ b/libdw/libdw_visit_scopes.c
@@ -109,11 +109,15 @@ __libdw_visit_scopes (depth, root, previsit, postvisit, arg)
if (INTUSE(dwarf_child) (&root->die, &child.die) != 0)
return -1;
+#ifdef __clang__
+ int (^recurse) (void) = ^int(void)
+#else
inline int recurse (void)
+#endif
{
return __libdw_visit_scopes (depth + 1, &child,
previsit, postvisit, arg);
- }
+ };
do
{
diff --git a/libdwfl/dwfl_module.c b/libdwfl/dwfl_module.c
index d7e54138..4d9779bd 100644
--- a/libdwfl/dwfl_module.c
+++ b/libdwfl/dwfl_module.c
@@ -138,7 +138,13 @@ dwfl_report_module (Dwfl *dwfl, const char *name,
{
Dwfl_Module **tailp = &dwfl->modulelist, **prevp = tailp;
+#ifdef __clang__
+ __block int val = 0;
+ Dwfl_Module* (^use) (Dwfl_Module *) = ^Dwfl_Module* (Dwfl_Module *mod)
+#else
+ int val = 0;
inline Dwfl_Module *use (Dwfl_Module *mod)
+#endif
{
mod->next = *tailp;
*tailp = mod;
@@ -150,7 +156,7 @@ dwfl_report_module (Dwfl *dwfl, const char *name,
}
return mod;
- }
+ };
for (Dwfl_Module *m = *prevp; m != NULL; m = *(prevp = &m->next))
{
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;
diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
index 9d06f929..2dcb567f 100644
--- a/libelf/elf_begin.c
+++ b/libelf/elf_begin.c
@@ -1022,7 +1022,11 @@ elf_begin (fildes, cmd, ref)
return NULL;
}
+#ifdef __clang__
+ Elf * (^lock_dup_elf) (void) = ^Elf*(void)
+#else
Elf *lock_dup_elf ()
+#endif
{
/* We need wrlock to dup an archive. */
if (ref->kind == ELF_K_AR)
@@ -1033,7 +1037,7 @@ elf_begin (fildes, cmd, ref)
/* Duplicate the descriptor. */
return dup_elf (fildes, cmd, ref);
- }
+ };
switch (cmd)
{