[ntp:hackers] Compiling NTP on ARM

Martin Burnicki martin.burnicki at meinberg.de
Tue Apr 7 10:58:18 UTC 2015


Harlan Stenn wrote:
> "Gary E. Miller" writes:
>> Yo Harlan!
>>
>> On Tue, 07 Apr 2015 01:09:18 +0000
>> Harlan Stenn <stenn at ntp.org> wrote:
>>
>>> I've heard one person say that building NTP on an ARM throws lots of
>>> harmless but annoying warning messages.
>>
>> I'm just tried on Raspian Wheezy.  Wheezy does not have the option for
>> automake 1.14, so I got nowhere.
>
> I think anything after 1.11.x will work.
>
> You can also use a tarball.

I've just built ntp-4.2.8p2-RC3.tar.gz on my Raspberry Pi, with

./configure --enable-parse-clocks; make

Beside the warnings I get anyway when compiling on my x86_64 Linux 
workstation I get these ones:

./../lib/isc/task.c:332:28: warning: cast increases required alignment 
of target type [-Wcast-align]
./../lib/isc/task.c:1466:12: warning: cast increases required alignment 
of target type [-Wcast-align]
./../lib/isc/task.c:1562:28: warning: cast increases required alignment 
of target type [-Wcast-align]
./../lib/isc/task.c:1571:28: warning: cast increases required alignment 
of target type [-Wcast-align]
./../lib/isc/task.c:1618:28: warning: cast increases required alignment 
of target type [-Wcast-align]
./../lib/isc/task.c:1629:28: warning: cast increases required alignment 
of target type [-Wcast-align]
networking.c:139:15: warning: cast increases required alignment of 
target type [-Wcast-align]
refclock_tsyncpci.c:552:21: warning: cast increases required alignment 
of target type [-Wcast-align]
ntp_io.c:762:16: warning: cast increases required alignment of target 
type [-Wcast-align]
ntp_io.c:3334:11: warning: cast increases required alignment of target 
type [-Wcast-align]
ntp_io.c:4607:12: warning: cast increases required alignment of target 
type [-Wcast-align]


The reason for this is nicely explained here:
http://stackoverflow.com/questions/25762173/why-does-wcast-align-not-warn-about-cast-from-char-to-int-on-x86

So as far as I understand this the compiler (gcc 4.8.3 in my case) just 
emits the warnings telling that the alignment had to be changed from the 
default to something else, but since this is done the generated code 
should work properly.

The only chance I see to fix this is to take care in the source code 
(eventually depending on the target platform) that the variables which 
are cast to meet the requirements of the called functions are by default 
aligned as required in "worst case".

If this is done I'd expect that also the code generated for x86 and 
x86_64 platforms will be "better" with regard to performance, since on 
these platforms misaligned access doesn't cause a trap but is slower 
than aligned access.

Martin
-- 
Martin Burnicki

Senior Software Engineer

MEINBERG Funkuhren GmbH & Co. KG
Email: martin.burnicki at meinberg.de
Phone: +49 (0)5281 9309-14
Fax: +49 (0)5281 9309-30

Lange Wand 9, 31812 Bad Pyrmont, Germany
Amtsgericht Hannover 17HRA 100322
Geschäftsführer/Managing Directors: Günter Meinberg, Werner Meinberg, 
Andre Hartmann, Heiko Gerstung
Web: http://www.meinberg.de


More information about the hackers mailing list