Skip to content

Commit c9d4923

Browse files
James-A-Clarkacmel
authored andcommitted
perf dwarf-aux: Fix build with HAVE_DWARF_CFI_SUPPORT
check_allowed_ops() is used from both HAVE_DWARF_GETLOCATIONS_SUPPORT and HAVE_DWARF_CFI_SUPPORT sections, so move it into the right place so that it's available when either are defined. This shows up when doing a static cross compile for arm64: $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LDFLAGS="-static" \ EXTRA_PERFLIBS="-lexpat" util/dwarf-aux.c:1723:6: error: implicit declaration of function 'check_allowed_ops' Fixes: 55442cc ("perf dwarf-aux: Check allowed DWARF Ops") Reviewed-by: Ian Rogers <[email protected]> Signed-off-by: James Clark <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 3536c25 commit c9d4923

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

tools/perf/util/dwarf-aux.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,34 @@ static int offset_from_dwarf_op(Dwarf_Op *op)
12171217
}
12181218
return -1;
12191219
}
1220+
1221+
static bool check_allowed_ops(Dwarf_Op *ops, size_t nops)
1222+
{
1223+
/* The first op is checked separately */
1224+
ops++;
1225+
nops--;
1226+
1227+
/*
1228+
* It needs to make sure if the location expression matches to the given
1229+
* register and offset exactly. Thus it rejects any complex expressions
1230+
* and only allows a few of selected operators that doesn't change the
1231+
* location.
1232+
*/
1233+
while (nops) {
1234+
switch (ops->atom) {
1235+
case DW_OP_stack_value:
1236+
case DW_OP_deref_size:
1237+
case DW_OP_deref:
1238+
case DW_OP_piece:
1239+
break;
1240+
default:
1241+
return false;
1242+
}
1243+
ops++;
1244+
nops--;
1245+
}
1246+
return true;
1247+
}
12201248
#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT || HAVE_DWARF_CFI_SUPPORT */
12211249

12221250
#ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT
@@ -1397,34 +1425,6 @@ static bool match_var_offset(Dwarf_Die *die_mem, struct find_var_data *data,
13971425
return true;
13981426
}
13991427

1400-
static bool check_allowed_ops(Dwarf_Op *ops, size_t nops)
1401-
{
1402-
/* The first op is checked separately */
1403-
ops++;
1404-
nops--;
1405-
1406-
/*
1407-
* It needs to make sure if the location expression matches to the given
1408-
* register and offset exactly. Thus it rejects any complex expressions
1409-
* and only allows a few of selected operators that doesn't change the
1410-
* location.
1411-
*/
1412-
while (nops) {
1413-
switch (ops->atom) {
1414-
case DW_OP_stack_value:
1415-
case DW_OP_deref_size:
1416-
case DW_OP_deref:
1417-
case DW_OP_piece:
1418-
break;
1419-
default:
1420-
return false;
1421-
}
1422-
ops++;
1423-
nops--;
1424-
}
1425-
return true;
1426-
}
1427-
14281428
/* Only checks direct child DIEs in the given scope. */
14291429
static int __die_find_var_reg_cb(Dwarf_Die *die_mem, void *arg)
14301430
{

0 commit comments

Comments
 (0)