[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openbsd-arm
Subject:    armv7 cross compilation issues (patch)
From:       Krystian Lewandowski <k.lewandowski () icloud ! com>
Date:       2024-01-21 21:16:13
Message-ID: B8540C37-90BB-4B01-9A36-76E276296FB0 () icloud ! com
[Download RAW message or body]

Hi,
I tried to cross compile latest armv7 src and I experienced a few
problems.

Maybe I was doing something wrong or maybe the patch will make sense -
below are the changes I had to apply to make it build calling:

make -f Makefile.cross TARGET=... CROSSDIR=... cross-dirs
make -f Makefile.cross TARGET=... CROSSDIR=... cross-tools
make -f Makefile.cross TARGET=... CROSSDIR=... cross-distrib

Unfortunately, its completely untested - I dont have any supported armv7
board yet but Ill try to get one.

The first issue was:
===> ld.so/ldconfig
/home/krle/devel/OpenBSD/build/dest.armv7/usr/arm-unknown-openbsd7.4/bin/cc   -static \
-pie -o ldconfig ldconfig.o shlib.o etc.o sod.o ldconfig_path.o  \
arm-unknown-openbsd7.4-ld: error: duplicate symbol: __umodsi3
> > > defined at umodsi3.S:32 \
> > > (/home/krle/devel/OpenBSD/src/gnu/lib/libcompiler_rt/../../llvm/compiler-rt/lib/builtins/arm/umodsi3.S:32)
> > >  umodsi3.o:(__umodsi3) in archive \
> > > /home/krle/devel/OpenBSD/build/dest.armv7/usr/lib/libcompiler_rt.a defined at \
> > > divsi3.S:26 (/home/krle/devel/OpenBSD/src/lib/libc/arch/arm/gen/divsi3.S:26) \
> > > divsi3.o:(.text+0x0) in archive \
> > > /home/krle/devel/OpenBSD/build/dest.armv7/usr/lib/libc.a

arm-unknown-openbsd7.4-ld: error: duplicate symbol: __modsi3
> > > defined at modsi3.S:41 \
> > > (/home/krle/devel/OpenBSD/src/gnu/lib/libcompiler_rt/../../llvm/compiler-rt/lib/builtins/arm/modsi3.S:41)
> > >  modsi3.o:(__modsi3) in archive \
> > > /home/krle/devel/OpenBSD/build/dest.armv7/usr/lib/libcompiler_rt.a defined at \
> > > divsi3.S:35 (/home/krle/devel/OpenBSD/src/lib/libc/arch/arm/gen/divsi3.S:35) \
> > > divsi3.o:(.text+0x18) in archive \
> > > /home/krle/devel/OpenBSD/build/dest.armv7/usr/lib/libc.a
arm-unknown-openbsd7: error: linker command failed with exit code 1 (use -v to see \
                invocation)
*** Error 1 in libexec/ld.so/ldconfig (<bsd.prog.mk>:126 'ldconfig')
*** Error 2 in libexec/ld.so (<bsd.subdir.mk>:48 'all')
*** Error 2 in libexec (<bsd.subdir.mk>:48 'all')
*** Error 2 in /home/krle/devel/OpenBSD/src (Makefile.cross:373 'cross-bin')

The other was a linker issue - linking against host platform libraries.
Probably wont even show up if platform and target match. 
LDADD was used where DPADD should be used?

Maybe it should go to tech@ but Id like to verify the issue exists at
all and its not PEBCAK case.

BR,
-- 
Krystian Lewandowski

Index: gnu/lib/libcompiler_rt/Makefile
===================================================================
RCS file: /cvs/src/gnu/lib/libcompiler_rt/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- gnu/lib/libcompiler_rt/Makefile 28 Dec 2021 15:45:17 -0000 1.6
+++ gnu/lib/libcompiler_rt/Makefile 21 Jan 2024 17:44:53 -0000
@@ -96,7 +96,6 @@ GEN_SRCS= absvdi2 \
  lshrdi3 \
  lshrti3 \
  moddi3 \
- modsi3 \
  modti3 \
  muldc3 \
  muldi3 \
@@ -142,7 +141,6 @@ GEN_SRCS= absvdi2 \
  udivmodti4 \
  udivti3 \
  umoddi3 \
- umodsi3 \
  umodti3
   .if ${RTARCH} != "arm"
@@ -160,12 +158,14 @@ GEN_SRCS+= adddf3 \
  fixunssfdi \
  floatsidf \
  floatsisf \
+ modsi3 \
  muldf3 \
  mulsf3 \
  subdf3 \
  subsf3 \
  truncdfsf2 \
- udivsi3
+ udivsi3 \
+ umodsi3
 .endif
   .if ${RTARCH} == "i386"
Index: usr.sbin/radiusd/radiusd_bsdauth/Makefile
===================================================================
RCS file: /cvs/src/usr.sbin/radiusd/radiusd_bsdauth/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- usr.sbin/radiusd/radiusd_bsdauth/Makefile 21 Jul 2015 04:06:04 -0000 1.1
+++ usr.sbin/radiusd/radiusd_bsdauth/Makefile 21 Jan 2024 17:45:08 -0000
@@ -3,7 +3,7 @@ PROG= radiusd_bsdauth
 BINDIR= /usr/libexec/radiusd
 SRCS= radiusd_bsdauth.c radiusd_module.c imsg_subr.c
 LDADD+= -lradius -lcrypto -lutil
-LDADD+= ${LIBRADIUS} ${LIBCRYPTO} ${LIBUTIL}
+DPADD= ${LIBRADIUS} ${LIBCRYPTO} ${LIBUTIL}
 NOMAN= #
   .include <bsd.prog.mk>
Index: usr.sbin/radiusd/radiusd_radius/Makefile
===================================================================
RCS file: /cvs/src/usr.sbin/radiusd/radiusd_radius/Makefile,v
retrieving revision 1.1
diff -u -p -r1.1 Makefile
--- usr.sbin/radiusd/radiusd_radius/Makefile 21 Jul 2015 04:06:04 -0000 1.1
+++ usr.sbin/radiusd/radiusd_radius/Makefile 21 Jan 2024 17:45:08 -0000
@@ -4,7 +4,7 @@ BINDIR= /usr/libexec/radiusd
 SRCS= radiusd_radius.c radiusd_module.c util.c imsg_subr.c log.c
 CFLAGS+= -DUSE_LIBEVENT
 LDADD+= -lradius -lcrypto -lutil -levent
-LDADD+= ${LIBRADIUS} ${LIBCRYPTO} ${LIBUTIL} ${LIBEVENT}
+DPADD+= ${LIBRADIUS} ${LIBCRYPTO} ${LIBUTIL} ${LIBEVENT}
 NOMAN= #
   .include <bsd.prog.mk>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic