* [PATCH bpf-next] selftests/bpf: Fix build of callx tests with GCC
@ 2026-09-24 18:21 Alexei Starovoitov
2026-09-24 19:50 ` Ihor Solodrai
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2026-09-24 18:21 UTC (permalink / raw)
To: bpf; +Cc: daniel, andrii, eddyz87, memxor
From: Alexei Starovoitov <ast@kernel.org>
GCC doesn't support indirect calls in BPF:
progs/verifier_callx.c: In function 'apply_op':
progs/verifier_callx.c:977:1: error: indirect call in function, which are not supported by eBPF
progs/verifier_callx_rodata.c: In function 'use_shape':
progs/verifier_callx_rodata.c:746:1: error: indirect call in function, which are not supported by eBPF
Build verifier_callx, verifier_callx_rodata and callx_rodata progs
with clang only. Skip callx_rodata_lskel test when progs are built
with GCC.
Fixes: e9b22d50796d ("selftests/bpf: Add tests for callx")
Fixes: b018e998e645 ("selftests/bpf: Add tests for callx through pointers in read-only data")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
.../bpf/prog_tests/callx_rodata_lskel.c | 6 ++++
.../selftests/bpf/progs/callx_rodata.c | 28 +++++++++++++++++--
.../selftests/bpf/progs/verifier_callx.c | 3 +-
.../bpf/progs/verifier_callx_rodata.c | 3 +-
4 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
index 96f6179f0492..6a43b880d730 100644
--- a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
+++ b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
@@ -35,6 +35,12 @@ void test_callx_rodata_lskel(void)
if (!ASSERT_OK_PTR(skel, "open"))
return;
+ /* gcc doesn't support indirect calls */
+ if (skel->rodata->skip) {
+ test__skip();
+ goto out;
+ }
+
skel->rodata->bias = 7;
if (!ASSERT_OK(callx_rodata_lskel__load(skel), "load"))
diff --git a/tools/testing/selftests/bpf/progs/callx_rodata.c b/tools/testing/selftests/bpf/progs/callx_rodata.c
index 07ae2d1b6b8e..e3f8335f80f8 100644
--- a/tools/testing/selftests/bpf/progs/callx_rodata.c
+++ b/tools/testing/selftests/bpf/progs/callx_rodata.c
@@ -1,16 +1,21 @@
// SPDX-License-Identifier: GPL-2.0
/* callx through pointers to functions in .rodata, loaded by light skeleton */
+#include <stdbool.h>
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
-typedef int (*op_fn)(int);
-
/* set by user space before the programs are loaded, it's in .rodata too */
const volatile int bias = 1;
int op_idx;
+#ifdef __clang__
+
+const volatile bool skip = false;
+
+typedef int (*op_fn)(int);
+
static __noinline int add_bias(int x)
{
return x + bias;
@@ -41,6 +46,25 @@ int both_ops(void *ctx)
return ops[1](ops[0](4));
}
+#else
+
+/* gcc doesn't support indirect calls */
+const volatile bool skip = true;
+
+SEC("socket")
+int select_op(void *ctx)
+{
+ return 0;
+}
+
+SEC("socket")
+int both_ops(void *ctx)
+{
+ return 0;
+}
+
+#endif
+
/* no callx here */
SEC("socket")
int read_bias(void *ctx)
diff --git a/tools/testing/selftests/bpf/progs/verifier_callx.c b/tools/testing/selftests/bpf/progs/verifier_callx.c
index ea3d3f97da31..bc31d0221f6a 100644
--- a/tools/testing/selftests/bpf/progs/verifier_callx.c
+++ b/tools/testing/selftests/bpf/progs/verifier_callx.c
@@ -6,7 +6,8 @@
#include "bpf_misc.h"
#include "../../../include/linux/filter.h"
-#if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)
+/* gcc doesn't support indirect calls */
+#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && defined(__clang__)
#define CALLX_INSN(DST, SRC, OFF, IMM) \
BPF_RAW_INSN(BPF_JMP | BPF_CALL | BPF_X, DST, SRC, OFF, IMM)
diff --git a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
index 65d34769c8bf..db3169a1ddf6 100644
--- a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
+++ b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
@@ -6,7 +6,8 @@
#include "bpf_misc.h"
#include "../../../include/linux/filter.h"
-#if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)
+/* gcc doesn't support indirect calls */
+#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && defined(__clang__)
/*
* Read-only data with pointers to functions, where the compiler puts tables
--
2.55.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Fix build of callx tests with GCC
2026-09-24 18:21 [PATCH bpf-next] selftests/bpf: Fix build of callx tests with GCC Alexei Starovoitov
@ 2026-09-24 19:50 ` Ihor Solodrai
2026-09-24 20:00 ` patchwork-bot+netdevbpf
2026-09-25 6:50 ` Vineet Gupta
2 siblings, 0 replies; 5+ messages in thread
From: Ihor Solodrai @ 2026-09-24 19:50 UTC (permalink / raw)
To: Alexei Starovoitov, bpf; +Cc: daniel, andrii, eddyz87, memxor
On 9/24/26 11:21 AM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> GCC doesn't support indirect calls in BPF:
>
> progs/verifier_callx.c: In function 'apply_op':
> progs/verifier_callx.c:977:1: error: indirect call in function, which are not supported by eBPF
> progs/verifier_callx_rodata.c: In function 'use_shape':
> progs/verifier_callx_rodata.c:746:1: error: indirect call in function, which are not supported by eBPF
>
> Build verifier_callx, verifier_callx_rodata and callx_rodata progs
> with clang only. Skip callx_rodata_lskel test when progs are built
> with GCC.
>
> Fixes: e9b22d50796d ("selftests/bpf: Add tests for callx")
> Fixes: b018e998e645 ("selftests/bpf: Add tests for callx through pointers in read-only data")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Tested-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Confirmed the patch fixes the GCC BPF selftests build:
https://github.com/kernel-patches/vmtest/actions/runs/36043955840/job/107785910578
> ---
> .../bpf/prog_tests/callx_rodata_lskel.c | 6 ++++
> .../selftests/bpf/progs/callx_rodata.c | 28 +++++++++++++++++--
> .../selftests/bpf/progs/verifier_callx.c | 3 +-
> .../bpf/progs/verifier_callx_rodata.c | 3 +-
> 4 files changed, 36 insertions(+), 4 deletions(-)
>
> [...]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Fix build of callx tests with GCC
2026-09-24 18:21 [PATCH bpf-next] selftests/bpf: Fix build of callx tests with GCC Alexei Starovoitov
2026-09-24 19:50 ` Ihor Solodrai
@ 2026-09-24 20:00 ` patchwork-bot+netdevbpf
2026-09-25 6:50 ` Vineet Gupta
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-24 20:00 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: bpf, daniel, andrii, eddyz87, memxor
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Thu, 24 Sep 2026 18:21:04 +0000 you wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> GCC doesn't support indirect calls in BPF:
>
> progs/verifier_callx.c: In function 'apply_op':
> progs/verifier_callx.c:977:1: error: indirect call in function, which are not supported by eBPF
> progs/verifier_callx_rodata.c: In function 'use_shape':
> progs/verifier_callx_rodata.c:746:1: error: indirect call in function, which are not supported by eBPF
>
> [...]
Here is the summary with links:
- [bpf-next] selftests/bpf: Fix build of callx tests with GCC
https://git.kernel.org/bpf/bpf-next/c/7cd1f73b37ea
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Fix build of callx tests with GCC
@ 2026-09-25 6:50 ` Vineet Gupta
0 siblings, 0 replies; 5+ messages in thread
From: Vineet Gupta @ 2026-09-25 6:50 UTC (permalink / raw)
To: Alexei Starovoitov, bpf; +Cc: daniel, andrii, eddyz87, memxor
On 9/24/26 11:21 AM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> GCC doesn't support indirect calls in BPF:
>
> progs/verifier_callx.c: In function 'apply_op':
> progs/verifier_callx.c:977:1: error: indirect call in function, which are not supported by eBPF
> progs/verifier_callx_rodata.c: In function 'use_shape':
> progs/verifier_callx_rodata.c:746:1: error: indirect call in function, which are not supported by eBPF
GCC supports them under -mxbpf but unfortunately even that is broken.
> Build verifier_callx, verifier_callx_rodata and callx_rodata progs
> with clang only. Skip callx_rodata_lskel test when progs are built
> with GCC.
Can we do this slightly differently.
Following on same theme have been queued up in bpf-next
2026-08-24 48b69cc8825d selftests/bpf: Enable some of the blocked cpuv4
instruction tests for bpf-gcc
2026-08-24 8928f5ffdb65 selftests/bpf: Report placeholder tests as SKIP,
not OK
2026-08-24 b0eeb9e0f548 selftests/bpf: Name the remaining placeholder
programs dummy_test
>
> Fixes: e9b22d50796d ("selftests/bpf: Add tests for callx")
> Fixes: b018e998e645 ("selftests/bpf: Add tests for callx through pointers in read-only data")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---
> .../bpf/prog_tests/callx_rodata_lskel.c | 6 ++++
> .../selftests/bpf/progs/callx_rodata.c | 28 +++++++++++++++++--
> .../selftests/bpf/progs/verifier_callx.c | 3 +-
> .../bpf/progs/verifier_callx_rodata.c | 3 +-
> 4 files changed, 36 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
> index 96f6179f0492..6a43b880d730 100644
> --- a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
> +++ b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
> @@ -35,6 +35,12 @@ void test_callx_rodata_lskel(void)
> if (!ASSERT_OK_PTR(skel, "open"))
> return;
>
> + /* gcc doesn't support indirect calls */
> + if (skel->rodata->skip) {
> + test__skip();
> + goto out;
> + }
> +
We now have common skipping machinery using __skip, see further below.
> skel->rodata->bias = 7;
>
> if (!ASSERT_OK(callx_rodata_lskel__load(skel), "load"))
> diff --git a/tools/testing/selftests/bpf/progs/callx_rodata.c b/tools/testing/selftests/bpf/progs/callx_rodata.c
> index 07ae2d1b6b8e..e3f8335f80f8 100644
> --- a/tools/testing/selftests/bpf/progs/callx_rodata.c
> +++ b/tools/testing/selftests/bpf/progs/callx_rodata.c
> @@ -1,16 +1,21 @@
> // SPDX-License-Identifier: GPL-2.0
> /* callx through pointers to functions in .rodata, loaded by light skeleton */
>
> +#include <stdbool.h>
> #include <linux/bpf.h>
> #include <bpf/bpf_helpers.h>
>
> -typedef int (*op_fn)(int);
> -
> /* set by user space before the programs are loaded, it's in .rodata too */
> const volatile int bias = 1;
>
> int op_idx;
>
> +#ifdef __clang__
It unfortunatete that this doesn't have a compiler feature test macro
__BPF_FEATURE_* in clang or gcc. It seems we have existing
CAN_USE_BPF_ST and CAN_USE_GOTOL, maybe we can define CAN_USE_CALLX in
bpf_misc.h and use that as a gate, keeps one place for all such
__clang/gcc workaround definitions instead of them scattered all over. I
have a few pending patches which clean things up.
> +
> +const volatile bool skip = false;
> +
> +typedef int (*op_fn)(int);
> +
> static __noinline int add_bias(int x)
> {
> return x + bias;
> @@ -41,6 +46,25 @@ int both_ops(void *ctx)
> return ops[1](ops[0](4));
> }
>
> +#else
> +
> +/* gcc doesn't support indirect calls */
> +const volatile bool skip = true;
> +
> +SEC("socket")
> +int select_op(void *ctx)
> +{
> + return 0;
> +}
> +
> +SEC("socket")
> +int both_ops(void *ctx)
> +{
> + return 0;
> +}
> +
> +#endif
> +
This can be rewritten using exising skipping machinery as shown in
bpf-next patch: 8928f5ffdb65 ("selftests/bpf: Report placeholder tests
as SKIP, not OK")
#ifdef CAN_USE_CALLX
llvm_code
#else
__skip("gcc doesnt support callx")
int dummy_test(void *ctx)
{
return 0;
}
#endif
This avoids the explicit skipping logic.
> /* no callx here */
> SEC("socket")
> int read_bias(void *ctx)
> diff --git a/tools/testing/selftests/bpf/progs/verifier_callx.c b/tools/testing/selftests/bpf/progs/verifier_callx.c
> index ea3d3f97da31..bc31d0221f6a 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_callx.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_callx.c
> @@ -6,7 +6,8 @@
> #include "bpf_misc.h"
> #include "../../../include/linux/filter.h"
>
> -#if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)
> +/* gcc doesn't support indirect calls */
> +#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && defined(__clang__)
>
> #define CALLX_INSN(DST, SRC, OFF, IMM) \
> BPF_RAW_INSN(BPF_JMP | BPF_CALL | BPF_X, DST, SRC, OFF, IMM)
> diff --git a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
> index 65d34769c8bf..db3169a1ddf6 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
> @@ -6,7 +6,8 @@
> #include "bpf_misc.h"
> #include "../../../include/linux/filter.h"
>
> -#if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)
> +/* gcc doesn't support indirect calls */
> +#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && defined(__clang__)
Instead of __clang scattered all over, CAN_USE_CALLX in bpf_misc.h so
its one stop shop to clean things up in future.
BTW this is
Thx,
-Vineet
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH bpf-next] selftests/bpf: Fix build of callx tests with GCC
@ 2026-09-25 6:50 ` Vineet Gupta
0 siblings, 0 replies; 5+ messages in thread
From: Vineet Gupta @ 2026-09-25 6:50 UTC (permalink / raw)
To: bpf; +Cc: daniel, andrii, eddyz87, memxor
On 9/24/26 11:21 AM, Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
>
> GCC doesn't support indirect calls in BPF:
>
> progs/verifier_callx.c: In function 'apply_op':
> progs/verifier_callx.c:977:1: error: indirect call in function, which are not supported by eBPF
> progs/verifier_callx_rodata.c: In function 'use_shape':
> progs/verifier_callx_rodata.c:746:1: error: indirect call in function, which are not supported by eBPF
GCC supports them under -mxbpf but unfortunately even that is broken.
> Build verifier_callx, verifier_callx_rodata and callx_rodata progs
> with clang only. Skip callx_rodata_lskel test when progs are built
> with GCC.
Can we do this slightly differently.
Following on same theme have been queued up in bpf-next
2026-08-24 48b69cc8825d selftests/bpf: Enable some of the blocked cpuv4
instruction tests for bpf-gcc
2026-08-24 8928f5ffdb65 selftests/bpf: Report placeholder tests as SKIP,
not OK
2026-08-24 b0eeb9e0f548 selftests/bpf: Name the remaining placeholder
programs dummy_test
>
> Fixes: e9b22d50796d ("selftests/bpf: Add tests for callx")
> Fixes: b018e998e645 ("selftests/bpf: Add tests for callx through pointers in read-only data")
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---
> .../bpf/prog_tests/callx_rodata_lskel.c | 6 ++++
> .../selftests/bpf/progs/callx_rodata.c | 28 +++++++++++++++++--
> .../selftests/bpf/progs/verifier_callx.c | 3 +-
> .../bpf/progs/verifier_callx_rodata.c | 3 +-
> 4 files changed, 36 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
> index 96f6179f0492..6a43b880d730 100644
> --- a/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
> +++ b/tools/testing/selftests/bpf/prog_tests/callx_rodata_lskel.c
> @@ -35,6 +35,12 @@ void test_callx_rodata_lskel(void)
> if (!ASSERT_OK_PTR(skel, "open"))
> return;
>
> + /* gcc doesn't support indirect calls */
> + if (skel->rodata->skip) {
> + test__skip();
> + goto out;
> + }
> +
We now have common skipping machinery using __skip, see further below.
> skel->rodata->bias = 7;
>
> if (!ASSERT_OK(callx_rodata_lskel__load(skel), "load"))
> diff --git a/tools/testing/selftests/bpf/progs/callx_rodata.c b/tools/testing/selftests/bpf/progs/callx_rodata.c
> index 07ae2d1b6b8e..e3f8335f80f8 100644
> --- a/tools/testing/selftests/bpf/progs/callx_rodata.c
> +++ b/tools/testing/selftests/bpf/progs/callx_rodata.c
> @@ -1,16 +1,21 @@
> // SPDX-License-Identifier: GPL-2.0
> /* callx through pointers to functions in .rodata, loaded by light skeleton */
>
> +#include <stdbool.h>
> #include <linux/bpf.h>
> #include <bpf/bpf_helpers.h>
>
> -typedef int (*op_fn)(int);
> -
> /* set by user space before the programs are loaded, it's in .rodata too */
> const volatile int bias = 1;
>
> int op_idx;
>
> +#ifdef __clang__
It unfortunatete that this doesn't have a compiler feature test macro
__BPF_FEATURE_* in clang or gcc. It seems we have existing
CAN_USE_BPF_ST and CAN_USE_GOTOL, maybe we can define CAN_USE_CALLX in
bpf_misc.h and use that as a gate, keeps one place for all such
__clang/gcc workaround definitions instead of them scattered all over. I
have a few pending patches which clean things up.
> +
> +const volatile bool skip = false;
> +
> +typedef int (*op_fn)(int);
> +
> static __noinline int add_bias(int x)
> {
> return x + bias;
> @@ -41,6 +46,25 @@ int both_ops(void *ctx)
> return ops[1](ops[0](4));
> }
>
> +#else
> +
> +/* gcc doesn't support indirect calls */
> +const volatile bool skip = true;
> +
> +SEC("socket")
> +int select_op(void *ctx)
> +{
> + return 0;
> +}
> +
> +SEC("socket")
> +int both_ops(void *ctx)
> +{
> + return 0;
> +}
> +
> +#endif
> +
This can be rewritten using exising skipping machinery as shown in
bpf-next patch: 8928f5ffdb65 ("selftests/bpf: Report placeholder tests
as SKIP, not OK")
#ifdef CAN_USE_CALLX
llvm_code
#else
__skip("gcc doesnt support callx")
int dummy_test(void *ctx)
{
return 0;
}
#endif
This avoids the explicit skipping logic.
> /* no callx here */
> SEC("socket")
> int read_bias(void *ctx)
> diff --git a/tools/testing/selftests/bpf/progs/verifier_callx.c b/tools/testing/selftests/bpf/progs/verifier_callx.c
> index ea3d3f97da31..bc31d0221f6a 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_callx.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_callx.c
> @@ -6,7 +6,8 @@
> #include "bpf_misc.h"
> #include "../../../include/linux/filter.h"
>
> -#if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)
> +/* gcc doesn't support indirect calls */
> +#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && defined(__clang__)
>
> #define CALLX_INSN(DST, SRC, OFF, IMM) \
> BPF_RAW_INSN(BPF_JMP | BPF_CALL | BPF_X, DST, SRC, OFF, IMM)
> diff --git a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
> index 65d34769c8bf..db3169a1ddf6 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_callx_rodata.c
> @@ -6,7 +6,8 @@
> #include "bpf_misc.h"
> #include "../../../include/linux/filter.h"
>
> -#if defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)
> +/* gcc doesn't support indirect calls */
> +#if (defined(__TARGET_ARCH_x86) || defined(__TARGET_ARCH_arm64)) && defined(__clang__)
Instead of __clang scattered all over, CAN_USE_CALLX in bpf_misc.h so
its one stop shop to clean things up in future.
BTW this is
Thx,
-Vineet
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-09-25 6:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24 18:21 [PATCH bpf-next] selftests/bpf: Fix build of callx tests with GCC Alexei Starovoitov
2026-09-24 19:50 ` Ihor Solodrai
2026-09-24 20:00 ` patchwork-bot+netdevbpf
2026-09-25 6:50 ` Vineet Gupta
2026-09-25 6:50 ` Vineet Gupta
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.