Xcode 15 linker error: not 8-byte aligned, which cannot be encoded as a target of LDR/STR

In an old project we just moved on mac ARM + Sonoma + Xcode 15 (fresh install), we get this link error:

'_yytext' from '.../Objects-normal/arm64/html.lexer.o' not 8-byte aligned, which cannot be encoded as a target of LDR/STR in '_PHPyylex' from '.../Objects-normal/arm64/php.lexer.o'

We don't get this error on Xcode 15 on mac Intel, nor with Xcode 14 on mac ARM.

Does anyone know what we could do to fix that? thanks!

Replies

Did you try enabling Rosetta in Xcode? Destinations -> Destinations Architectures ->

This is a bit of a worry. It suggests some sort of type mismatch, where the declared type of the _yytext value doesn’t match the type being used to access it [1]. What types are these using at the C level?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Because the alignment of the type should constraint the offset within and alignment of the sections in html.lexer.o.

That was it! We had two different variable declarations for yytext, one as char* the other as char[size]. Thank you so much Quinn! I would suggest for the linker to provide a more explicit error message ;-)

That was it!

Cool!

I would suggest for the linker to provide a more explicit error message ;-)

You know what my answer is going to be (-:

Seriously though, I’m not sure if the linker is able to provide a better diagnostic here given the information it has available to it. However, I still think it’s worthwhile filing a bug. The folks that work on the linker know this stuff way better than I do, and they might be able to come up with something clever.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"