tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Enabling MKCOMPAT for *arm*



Hey folks,

I tried to get a shark build to create the old abi compat libraries and
came up with the patch attached.

It partly works but fails like this:

/ssd/hosts/shark/usr/lib/oabi/libgcc.a(_divsi3.o): In function `__divsi3':
:(.text+0x0): multiple definition of `__aeabi_idiv'
libc_pic.a(divsi3.pico):(.text+0x0): first defined here
/ssd/hosts/shark/usr/lib/oabi/libgcc.a(_divsi3.o): In function `__divsi3':
:(.text+0x0): multiple definition of `__divsi3'
libc_pic.a(divsi3.pico):(.text+0x0): first defined here
/ssd/hosts/shark/usr/lib/oabi/libgcc.a(_udivsi3.o): In function `__aeabi_uidiv':
:(.text+0x0): multiple definition of `__udivsi3'
libc_pic.a(udivsi3.pico):(.text+0x0): first defined here
/ssd/hosts/shark/usr/lib/oabi/libgcc.a(_udivsi3.o): In function `__aeabi_uidiv':
:(.text+0x0): multiple definition of `__aeabi_uidiv'
libc_pic.a(udivsi3.pico):(.text+0x0): first defined here
/ssd/tools/lib/gcc/armv4--netbsdelf-eabi/4.8.4/../../../../armv4--netbsdelf-eabi/bin/ld: warning: dynamic relocation to `_libc_arm_fpu_present' in readonly section `.text'
/ssd/tools/lib/gcc/armv4--netbsdelf-eabi/4.8.4/../../../../armv4--netbsdelf-eabi/bin/ld: warning: creating a DT_TEXTREL in a shared object.


I am not sure how to deal with that, ideas welcome.

In the patch there is a strange change to bsd.own.mk:

-.if !empty(MACHINE_ARCH:M*arm*)
+.if !empty(MACHINE_ARCH:M*arm*) && "${MLIBDIR}" != "oabi"
 # Flags to pass to CC for using the old APCS ABI on ARM for compat or stand.
 ARM_APCS_FLAGS=        -mabi=apcs-gnu -mfloat-abi=soft
 ARM_APCS_FLAGS+=${${ACTIVE_CC} == "clang":? -target ${MACHINE_GNU_ARCH}--netbsd


I am not quite sure what ARM_APCS_FLAGS is for, but it gets in the way when
building old-abi objects:

armv4--netbsdelf-eabi-gcc -nodefaultlibs -Wl,-x -shared -Wl,-soname,libgcc_s.so.1 -Wl,--warn-shared-textrel -Wl,-Map=libgcc_s.so.1.map  -Wl,-m,armelf_nbsd -mabi=apcs-gnu -mfloat-abi=soft ...

and we end up with:

ld: error: Source object libgcc_s_pic.a(_dvmd_tls.pico) has EABI version 0, but target libgcc_s.so.1.0 has EABI version 5


The "${MLIBDIR}" != "oabi" looks hackish but seems to work. Better suggestions
welcome.

Martin


Index: compat/archdirs.mk
===================================================================
RCS file: /cvsroot/src/compat/archdirs.mk,v
retrieving revision 1.8
diff -u -r1.8 archdirs.mk
--- compat/archdirs.mk	19 Sep 2014 17:38:46 -0000	1.8
+++ compat/archdirs.mk	20 May 2015 12:44:40 -0000
@@ -10,16 +10,12 @@
 ARCHDIR_SUBDIR=	amd64/i386
 .endif
 
-.if (${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "armeb")
-ARCHDIR_SUBDIR=	arm/eabi
-.endif
-
-.if (${MACHINE_ARCH} == "earm" || ${MACHINE_ARCH} == "earmeb")
-ARCHDIR_SUBDIR=	arm/oabi
-.endif
-
-.if (${MACHINE_ARCH} == "earmhf" || ${MACHINE_ARCH} == "earmhfeb")
+.if !empty(MACHINE_ARCH:Mearmhf*) || !empty(MACHINE_ARCH:Mearmv?hf*)
 ARCHDIR_SUBDIR=	arm/oabi arm/eabi
+.elif !empty(MACHINE_ARCH:Mearm*)
+ARCHDIR_SUBDIR=	arm/oabi
+.elif !empty(MACHINE_ARCH:Marm)
+ARCHDIR_SUBDIR=	arm/eabi
 .endif
 
 .if (${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el")
Index: share/mk/bsd.own.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.own.mk,v
retrieving revision 1.848
diff -u -r1.848 bsd.own.mk
--- share/mk/bsd.own.mk	12 May 2015 08:25:28 -0000	1.848
+++ share/mk/bsd.own.mk	20 May 2015 12:44:40 -0000
@@ -817,7 +817,7 @@
 MACHINE_GNU_PLATFORM?=${MACHINE_GNU_ARCH}--netbsd
 .endif
 
-.if !empty(MACHINE_ARCH:M*arm*)
+.if !empty(MACHINE_ARCH:M*arm*) && "${MLIBDIR}" != "oabi"
 # Flags to pass to CC for using the old APCS ABI on ARM for compat or stand.
 ARM_APCS_FLAGS=	-mabi=apcs-gnu -mfloat-abi=soft
 ARM_APCS_FLAGS+=${${ACTIVE_CC} == "clang":? -target ${MACHINE_GNU_ARCH}--netbsdelf -B ${TOOLDIR}/${MACHINE_GNU_PLATFORM}/bin :}
@@ -898,7 +898,18 @@
     || ${MACHINE_ARCH} == "riscv64"
 MKCOMPAT?=	yes
 .elif !empty(MACHINE_ARCH:Mearm*)
+# These ports switched from "arm" to "earm", so provide compat libs
+.if ${MACHINE} == "cats" \
+    || ${MACHINE} == "evbarm" \
+    || ${MACHINE} == "hpcarm" \
+    || ${MACHINE} == "iyonix" \
+    || ${MACHINE} == "netwinder" \
+    || ${MACHINE} == "shark" \
+    || ${MACHINE} == "zaurus"
+MKCOMPAT?=	yes
+.else
 MKCOMPAT?=	no
+.endif
 .else
 # Don't let this build where it really isn't supported.
 MKCOMPAT:=	no


Home | Main Index | Thread Index | Old Index