Recent

Author Topic: XCode 8.3 and "pointer not aligned at address" warning  (Read 13261 times)

mayevski

  • New member
  • *
  • Posts: 8
XCode 8.3 and "pointer not aligned at address" warning
« on: May 23, 2017, 02:43:57 pm »
Hello,

We have built a static library for iOS using FPC for iOS, version 3.0.

When the customer is compiling the iOS application using XCode 8.3 and our static library, they get plenty (about 20K) of warnings similar to this one:

Quote
Warning:pointer not aligned at address 0x1016BC5B6 (_RTTI_$SYSTEM_$$_openchararray + 22 from /Users/sbrzeski/Documents/Code/SDKiOS-5/output/OneginiSDKiOS/libsbb.a(system.o))
Warning:pointer not aligned at address 0x1016BC5DF (_RTTI_$SYSTEM_$$_char_pointer + 15 from /Users/sbrzeski/Documents/Code/SDKiOS-5/output/OneginiSDKiOS/libsbb.a(system.o))
Warning:pointer not aligned at address 0x1016BC603 (_RTTI_$SYSTEM_$$_widechar_pointer + 19 from /Users/sbrzeski/Documents/Code/SDKiOS-5/output/OneginiSDKiOS/libsbb.a(system.o))
Warning:pointer not aligned at address 0x1016BC797 (_RTTI_$SYSTEM_$$_pvmt + 7 from /Users/sbrzeski/Documents/Code/SDKiOS-5/output/OneginiSDKiOS/libsbb.a(system.o))

What exactly options we (or they) need to use to get rid of this message? Our developer has tried to use " {$CODEALIGN 8} " directive as described in the documentation, but this produces the following error:  "Error: Illegal alignment directive"

Is there something that we are missing here?

Sincerely yours
Eugene Mayevski

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: XCode 8.3 and "pointer not aligned at address" warning
« Reply #1 on: May 24, 2017, 01:56:11 am »
Is there something that we are missing here?

This looks like a new Xcode warning. A quick search reveals reports elsewhere of these warnings. For example, the D language compiler:

https://issues.dlang.org/show_bug.cgi?id=17289#c18

There may not be anything you can do since an upstream fix is probably needed. Check the bugtracker at left and see if this has already been reported for FPC. If not, file a bug report. Once fixed, you'll probably need to build the compiler from trunk.


mayevski

  • New member
  • *
  • Posts: 8
Re: XCode 8.3 and "pointer not aligned at address" warning
« Reply #2 on: May 24, 2017, 12:12:16 pm »
Thank you. I assumed that the CODEALIGN directive would be enough, if only it worked :).

mischi

  • Full Member
  • ***
  • Posts: 170
Re: XCode 8.3 and "pointer not aligned at address" warning
« Reply #3 on: May 24, 2017, 01:25:43 pm »
I have reported this already:

https://bugs.freepascal.org/view.php?id=31696

To the best of my knowledge, passing -w (no warnings) to the linker is the only option. I am not aware of an option, which specifically switches off this particular warning.

mayevski

  • New member
  • *
  • Posts: 8
Re: XCode 8.3 and "pointer not aligned at address" warning
« Reply #4 on: May 24, 2017, 01:32:20 pm »
Thank you for reply. Please see my comments below.

I have reported this already:

https://bugs.freepascal.org/view.php?id=31696

To the best of my knowledge, passing -w (no warnings) to the linker is the only option. I am not aware of an option, which specifically switches off this particular warning.

Interesting - I tried to use the Search function and didn't find your report.

Did you try CODEALIGN option? It is expected to address exactly this issue (but it didn't work for us, as I mentioned).

mischi

  • Full Member
  • ***
  • Posts: 170
Re: XCode 8.3 and "pointer not aligned at address" warning
« Reply #5 on: May 24, 2017, 11:07:51 pm »
The warnings are caused by parts of the rtl with the runtime type information (RTTI) is handled. CODEALIGN will only affect the code of your program. My guess is that you would need to compile the rtl with CODEALIGN if you want to get rid of the warning.

That's why i switched of all warnings of the linker.

mayevski

  • New member
  • *
  • Posts: 8
Re: XCode 8.3 and "pointer not aligned at address" warning
« Reply #6 on: May 25, 2017, 07:54:36 am »
The warnings are caused by parts of the rtl with the runtime type information (RTTI) is handled. CODEALIGN will only affect the code of your program. My guess is that you would need to compile the rtl with CODEALIGN if you want to get rid of the warning.

That's why i switched of all warnings of the linker.

Thank you for the details. I recommended our customer to do the same (turn off warning), but for certain reasons, this is not an option for them. So we'll need to wait for FPC update.

molly

  • Hero Member
  • *****
  • Posts: 2330
Re: XCode 8.3 and "pointer not aligned at address" warning
« Reply #7 on: May 25, 2017, 08:13:00 am »
pardon my intrusion and ignorance.

Quote
"Error: Illegal alignment directive"
Strange, but perhaps recompiling rtl with -Oa (and specifying the PROC and JUMP parameters, and their preferred alignment size) might be able to help you out ?

mischi

  • Full Member
  • ***
  • Posts: 170
Re: XCode 8.3 and "pointer not aligned at address" warning
« Reply #8 on: May 25, 2017, 09:03:39 am »
Thank you for the details. I recommended our customer to do the same (turn off warning), but for certain reasons, this is not an option for them. So we'll need to wait for FPC update.
As much as I know about the parties (apple & fpc) involved, there is a problem, that no party is willing to move from its point of view. Ignoring the warning (post process the output?) or recompiling the rtl with alignment are the only options at the moment and I do not see this to change.

 

TinyPortal © 2005-2018