www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - If you have osx arm64 and gcc (not clang) installed...

reply Walter Bright <newshound2 digitalmars.com> writes:
Can you please compile this program:
```C
#include <stdio.h>

extern int foo(int *pi);

int main() { int i = 7; return foo(&i); }
```
with:

gcc -c -femit-dwarf-unwind=always test.c


and pls send me the resulting .o file. The reason I ask is because it turns out 
that gcc on the Mac is actually clang, and clang won't emit the dwarf eh_frame 
stuff. I need an example to make sure I'm doing it right.
Apr 07
next sibling parent reply Derek Fawcus <dfawcus+dlang employees.org> writes:
On Tuesday, 7 April 2026 at 22:56:37 UTC, Walter Bright wrote:
 Can you please compile this program:
 ```C
 #include <stdio.h>

 extern int foo(int *pi);

 int main() { int i = 7; return foo(&i); }
 ```
 with:

 gcc -c -femit-dwarf-unwind=always test.c


 and pls send me the resulting .o file. The reason I ask is 
 because it turns out that gcc on the Mac is actually clang, and 
 clang won't emit the dwarf eh_frame stuff. I need an example to 
 make sure I'm doing it right.
Do you specifically want what gcc on osx on ARM64 would produce, or gcc on ARM64? I have an ARM mac to hand, and have an ARM64 Linux VM within it, containing gcc. So I could compile under the latter. You could also, just install UTM and then an ARM64 debian VM within it. Alternately, there is a guide for compiling gcc 13 from scratch for ARM online, intended specifically for the osx scenario. You could follow that. I did for a non ARM device simply as I wanted a copy of gcc-13 which wasn't packaged for my Linux system.
Apr 08
parent Walter Bright <newshound2 digitalmars.com> writes:
On 4/8/2026 10:23 AM, Derek Fawcus wrote:
 Do you specifically want what gcc on osx on ARM64 would produce, or gcc on
ARM64?
OSX does things differently. It has to be an osx specific compiler.
 I have an ARM mac to hand, and have an ARM64 Linux VM within it, containing 
 gcc.  So I could compile under the latter.  You could also, just install UTM
and 
 then an ARM64 debian VM within it.
 
 Alternately, there is a guide for compiling gcc 13 from scratch for ARM
online, 
 intended specifically for the osx scenario.  You could follow that.  I did
for a 
 non ARM device simply as I wanted a copy of gcc-13 which wasn't packaged for
my 
 Linux system.
 
Thank you for the information! I managed to pry the gcc ARM64 prolog bytes out of chatgpt.
Apr 08
prev sibling next sibling parent Brian Callahan <bcallah openbsd.org> writes:
On Tuesday, 7 April 2026 at 22:56:37 UTC, Walter Bright wrote:
 Can you please compile this program:
 ```C
 #include <stdio.h>

 extern int foo(int *pi);

 int main() { int i = 7; return foo(&i); }
 ```
 with:

 gcc -c -femit-dwarf-unwind=always test.c


 and pls send me the resulting .o file. The reason I ask is 
 because it turns out that gcc on the Mac is actually clang, and 
 clang won't emit the dwarf eh_frame stuff. I need an example to 
 make sure I'm doing it right.
GCC 15.2.0 of macOS/aarch64 doesn't have that flag: gcc: error: unrecognized command-line option ‘-femit-dwarf-unwind=always’ I'll have my MacBook Neo on me this weekend, and I'll bring a USB key with a full binary package of GCC 15.2.0 (gcc, g++, gdc, whatever other frontends you want) for macOS/aarch64 for you. ~Brian
Apr 08
prev sibling parent reply jfourkiotis <john.fourkiotis gmail.com> writes:
On Tuesday, 7 April 2026 at 22:56:37 UTC, Walter Bright wrote:
 Can you please compile this program:
 ```C
 #include <stdio.h>

 extern int foo(int *pi);

 int main() { int i = 7; return foo(&i); }
 ```
 with:

 gcc -c -femit-dwarf-unwind=always test.c


 and pls send me the resulting .o file. The reason I ask is 
 because it turns out that gcc on the Mac is actually clang, and 
 clang won't emit the dwarf eh_frame stuff. I need an example to 
 make sure I'm doing it right.
Do you still need it ?
Apr 13
parent Walter Bright <newshound2 digitalmars.com> writes:
On 4/13/2026 10:02 AM, jfourkiotis wrote:
 Do you still need it ?
Thanks everyone for the help! I have it implemented and working now.
Apr 16