-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixup overflow on macOS Apple Silicon #537
Comments
Thank you for the report and the neatly-packaged repro case. (Note to others who'd like to reproduce: do I cannot reproduce the problem on my Mac M1 using CompCert 3.14:
Debugging support for macOS/ARM64 is broken indeed, but the command above produces an a.out that runs. Tool versions:
|
I am using the very latest O/S and versions, some version numbers are the same as you, some not. My jonathan@Jonathans-MacBook-Pro testcase % ccomp --version |
TKCOMPILER=ccomp |
To reproduce, one has to export the variables in the last post into the environment before calling
|
ccomp bombs if a function is declared without a type. other compilers default to int as the return type. i don't know if this is the correct ansi behaviour but it does prevent some dubious programs from compiling. |
And for less verbose warnings an additional |
The linker problem looks like the two functions are located too far away from each other. Therefore the 12 bit immediate offset overflows. |
Absolutely, but a formally correct compiler should generate code that can cope with that situation, by generating suitable relocation information. |
Let's get two points out of the way first, so that we won't discuss them further:
|
With the full instructions, I am able to reproduce the issue. Actually, I'm getting a more informative message for the link-time error:
|
This message leads to the following explanation for the problem. CompCert generates |
Proposed fix at #538. More testing is welcome. |
Have an absinthe on me!
[image0.jpeg]
Sent from my iPhone
On 19 Nov 2024, at 14:41, Xavier Leroy ***@***.***> wrote:
Proposed fix at #538<#538>. More testing is welcome.
—
Reply to this email directly, view it on GitHub<#537 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AE6VVM3EZJZU6XIRV45BBH32BNEYZAVCNFSM6AAAAABR5XGURSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOBVHEYDIMZRGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
During compilation of NAIF spice library on macOS Apple Silicon, linker is called via clang
and encounters a fixup overflow:
testcase.zip
% ccomp -g -Iinclude mars.c lib/cspice.a -lm
In file included from :425:
:16:9: warning: redefining builtin macro [-Wbuiltin-macro-redefined]
16 | #define STDC_NO_THREADS 1
| ^
1 warning generated.
ld: invalid use of ADRP/imm12 in '_t_getc' to '_ungetc'
final section layout:
__PAGEZERO addr=0x00000000, size=0x100000000, fileOffset=0x00000000
__TEXT addr=0x100000000, size=0x00154000, fileOffset=0x00000000
__text addr=0x1000029a0, size=0x0011b8d4, fileOffset=0x000029a0
__stubs addr=0x10011e274, size=0x000002a0, fileOffset=0x0011e274
__cstring addr=0x10011e514, size=0x000277e6, fileOffset=0x0011e514
__const addr=0x100145d00, size=0x000007c8, fileOffset=0x00145d00
__unwind_info addr=0x1001464c8, size=0x00001ff0, fileOffset=0x001464c8
__eh_frame addr=0x1001484b8, size=0x0000bb48, fileOffset=0x001484b8
__DATA_CONST addr=0x100154000, size=0x00004000, fileOffset=0x00154000
__got addr=0x100154000, size=0x000001d8, fileOffset=0x00154000
__DATA addr=0x100158000, size=0x05b34000, fileOffset=0x00158000
__data addr=0x100158000, size=0x000b018d, fileOffset=0x00158000
__bss addr=0x100208190, size=0x05a7e550, fileOffset=0x00000000
__common addr=0x105c866e0, size=0x00001a78, fileOffset=0x00000000
__LINKEDIT addr=0x105c8c000, size=0x00054000, fileOffset=0x0020c000
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ccomp: error: linker command failed with exit code 1 (use -v to see invocation)
1 error detected.
The text was updated successfully, but these errors were encountered: