Message ID | 20220926204710.860923-1-adelva@google.com |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
Series | examples: standalone: Fix build with LLVM toolchain | expand |
On Mon, Sep 26, 2022 at 08:47:10PM +0000, Alistair Delva wrote: > When building the standalone example with llvm, the link step fails: > > examples/standalone/libstubs.o: In function `dummy': > include/_exports.h:10: undefined reference to `jt' > include/_exports.h:11: undefined reference to `jt' > include/_exports.h:12: undefined reference to `jt' > include/_exports.h:13: undefined reference to `jt' > include/_exports.h:14: undefined reference to `jt' > examples/standalone/libstubs.o:include/_exports.h:15: > more undefined references to `jt' follow > > Indeed, the standalone libstubs.o does use the jt symbol, but it was > marked 'static' in stubs.c. It's strange how gcc builds are working. > > Signed-off-by: Alistair Delva <adelva@google.com> > Cc: Rick Chen <rick@andestech.com> > Cc: Simon Glass <sjg@chromium.org> > Cc: Tom Rini <trini@konsulko.com> > Cc: Nick Desaulniers <ndesaulniers@google.com> Applied to u-boot/master, thanks!
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c index ce05f41b0c..65115570e8 100644 --- a/examples/standalone/stubs.c +++ b/examples/standalone/stubs.c @@ -14,7 +14,7 @@ struct cmd_tbl; * from flash memory. The global_data address is passed as argv[-1] * to the application program. */ -static struct jt_funcs *jt; +struct jt_funcs *jt; gd_t *global_data; #define EXPORT_FUNC(f, a, x, ...) \
When building the standalone example with llvm, the link step fails: examples/standalone/libstubs.o: In function `dummy': include/_exports.h:10: undefined reference to `jt' include/_exports.h:11: undefined reference to `jt' include/_exports.h:12: undefined reference to `jt' include/_exports.h:13: undefined reference to `jt' include/_exports.h:14: undefined reference to `jt' examples/standalone/libstubs.o:include/_exports.h:15: more undefined references to `jt' follow Indeed, the standalone libstubs.o does use the jt symbol, but it was marked 'static' in stubs.c. It's strange how gcc builds are working. Signed-off-by: Alistair Delva <adelva@google.com> Cc: Rick Chen <rick@andestech.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Nick Desaulniers <ndesaulniers@google.com> --- examples/standalone/stubs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)