[OpenSIPS-Users] Compiling for arm v7

Răzvan Crainea razvan at opensips.org
Wed Jan 5 08:25:20 UTC 2022


Hi, Micael!

It is not the compiler that generates the swp/swpb instructions, but our 
locking code for backwards compatibility ARM versions. It is using it 
because it does not properly detect the target architecture (armv7), but 
a generic (older) ARM version.
I see that in your environment you are exporting the CPU variable, which 
is not actually really used in the build.
I'd suggest you try to export the `CC_ARCH` variable (`CC_ARCH=armv7`) - 
this should set the proper CPU type.

Let us know how this goes.

Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 1/3/22 18:18, Bogdan-Andrei Iancu wrote:
> Hi Micael and Happy New Year ;)
> 
> This is more an cross-compiling issue. The arm v6 and 7 obsoleted the 
> swp/swpb instructions - this is what the warning are saying. The problem 
> is that your compiler is generating asm code with those instruction; and 
> the warnings are reported by assembler (which knows that those 
> instructions are not valid).
> 
> I'm not a cross-compiling export (not even closer :P), but I guess you 
> are passing some wrong compiling flags, leading to this conflict here.
> 
> Best regards,
> 
> Bogdan-Andrei Iancu
> 
> OpenSIPS Founder and Developer
>    https://www.opensips-solutions.com
> OpenSIPS eBootcamp 2021
>    https://opensips.org/training/OpenSIPS_eBootcamp_2021/
> 
> On 1/1/22 11:48 AM, Micael wrote:
>> Hi all,
>>
>> (Happy New Year!)
>>
>> I am trying to cross compile 3.2.4 for armv7. Now, I'm new to opensips,
>> so I have no previous experience to fall back on..
>>
>> In short: I have issues, getting this warning when compiling
>> "swp{b} use is deprecated for ARMv6 and ARMv7"
>>
>>
>> What I have done is:
>> export 
>> CC_EXTRA_OPTS="--sysroot=/opt/toolchains/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/arm-none-linux-gnueabihf/libc 
>>
>> -I /volt001/tmp/sysroots-components/cortexa8hf-neon/openssl/usr/include"
>>
>>
>> export LD_EXTRA_OPTS="-L 
>> /volt001/tmp/sysroots-components/cortexa8hf-neon/openssl/usr/lib"
>>
>> export 
>> CC="/opt/toolchains/gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-gcc 
>> -marm -march=armv7-a -mthumb-interwork -mfloat-abi=hard -mfpu=neon"
>>
>> export CPU=armv7a
>>
>>
>> I then had to remove the following section in Makefile.defs, otherwise 
>> it would add strongarm1100 as cpu.
>>
>> ---8<---------8<------
>> ifeq    ($(CC_CLASS), 4.x)
>>         CFLAGS+=-mcpu=strongarm1100 -ftree-vectorize
>> else
>>     #if gcc 3.0+
>> ifeq    ($(CC_CLASS), 3.x)
>>         CFLAGS+= -mcpu=strongarm1100
>> else
>> ifeq    ($(CC_CLASS), 2.9x) #older gcc version (2.9[1-5])
>> $(warning             Old gcc detected ($(CC_SHORTVER)), use  gcc 3.0.x \
>>     for better results)
>>
>>                     CFLAGS+=
>> else
>>                 #really old version
>> $(warning            You are using an old and unsupported gcc \
>>                      version ($(CC_SHORTVER)), compile at your own risk!)
>>
>> endif            # CC_CLASS, 2.9x
>> endif            # CC_CLASS, 3.x
>> ---8<---------8<------
>>
>>
>>
>>
>>
>>
>> Once I have done that, everything compiles, but with one and the same 
>> warning (lots, and lots of them);
>>
>>
>> e.g.:
>>
>> Compiling ip_addr.c
>> /tmp/ccj7cheW.s: Assembler messages:
>> /tmp/ccj7cheW.s:1857: swp{b} use is deprecated for ARMv6 and ARMv7
>> /tmp/ccj7cheW.s:1892: swp{b} use is deprecated for ARMv6 and ARMv7
>> /tmp/ccj7cheW.s:1928: swp{b} use is deprecated for ARMv6 and ARMv7
>> /tmp/ccj7cheW.s:2171: swp{b} use is deprecated for ARMv6 and ARMv7
>> /tmp/ccj7cheW.s:2206: swp{b} use is deprecated for ARMv6 and ARMv7
>> /tmp/ccj7cheW.s:2242: swp{b} use is deprecated for ARMv6 and ARMv7
>> Compiling ipc.c
>> Compiling main.c
>> Compiling map.c
>> /tmp/cc6q8n3v.s: Assembler messages:
>> /tmp/cc6q8n3v.s:6001: swp{b} use is deprecated for ARMv6 and ARMv7
>> /tmp/cc6q8n3v.s:6036: swp{b} use is deprecated for ARMv6 and ARMv7
>> /tmp/cc6q8n3v.s:6072: swp{b} use is deprecated for ARMv6 and ARMv7
>> Compiling md5.c
>> Compiling md5utils.c
>>
>>
>> I guess I must not be the only one compiling for arm, so I hope 
>> someone can point me closer to whats wrong.
>>
>>
>> Any help appreciated,
>>   Micael
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list