On Jul 25, 2017, at 6:37 AM, Kevan Hashemi <hashemi@brandeis.edu> wrote:

Hello Again,

Failure to produce a stand-alone executable turns out to be a simple oversight on my part: I forgot to link to the main object when making the program. Apologies.

So, I now have GPC fully-functional on MacOS 10.12.6, but the odd step I have to take is to avoid using the default Clang editor and instead use this one:

kevan$ /Library/Developer/CommandLineTools/usr/libexec/as/i386/as -v
Apple Inc version cctools-898, GNU assembler version 1.38

This file has "modified" date April 12, 2017, so it's certainly not one I had lying around before my update.

Also: when I call gcc, it turns out I'm calling the linker installed with the latest version of Xcode:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld

If there's a way to tell gpc to use the gnu assembler directly, I can omit the intermediate -S assembler step in my Makefile, which would be nice. But I'm up and running now, which is a great relief. I set aside a week to figure this out, and it took only a day.

I think the gcc approved way of doing that is to is to use an external specs-file with the -specs=specs-file gcc/gpc command line parameter option to override the built-in assembler invoking driver spec.

I've never tried it so take the following with a big grain of salt.

First start off by seeing what the current built-in specs look like with gpc -dumpspecs

In the resulting output, there is an "*invoke_as:" spec which looks to be a promising avenue to override using the system default "as" assembler tool (i.e., the default Clang assembler) with the desired GNU assembler.

If I got it right from spec file from an old Mac OS gpc346u4 build project, the spec you're looking for looks like:

*invoke_as: %{!S:-o %|.s | as %(asm_options) %m.s %A }

Copy that into a new file that you'll use for the -specs= parameter option. In the new file, change the "as" in the "as %(asm_options) %m.s %A }" line to the full path specified GNU assembler you want invoked for assembling - since you say it works try "/Library/Developer/CommandLineTools/usr/libexec/as/i386/as" (without the quote marks) so the full changed line is:

/Library/Developer/CommandLineTools/usr/libexec/as/i386/as %(asm_options) %m.s %A }

Hopefully something like that will do the deed.  If it does and since you're working with a pre gcc 4 version, there appears to be a fairly easy way to hack the gpc installation so you don't have to keep using the  -specs= parameter option.

Gale Paeper
gpaeper@empirenet.com