Opened 12 years ago
Closed 6 years ago
#37206 closed defect (fixed)
pcc: does it actually work on today's machines/OS?
Reported by: | akimd (Akim Demaille) | Owned by: | MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.1.2 |
Keywords: | Cc: | cooljeanius (Eric Gallager), MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) | |
Port: | pcc |
Description
Hi,
I'm running 10.8.2 on an i7, and I can't compile the simplest C program using pcc. It looks very much like the ASM syntax it uses is not the one accepted by the asm it actually runs.
$ cat /tmp/foo.c int main() { return 0; } $ pcc /tmp/foo.c /tmp/ctm.nHsLTr:5:suffix or operands invalid for `push' /tmp/ctm.nHsLTr:12:suffix or operands invalid for `pop' /tmp/ctm.nHsLTr:22:unknown section type: non_lazy_symbol_pointers /tmp/ctm.nHsLTr:22:Rest of line ignored. 1st junk character valued 32 ( ). $ pcc -v pcc 1.0.0.RELEASE 20110221 for i386-apple-darwin12.2.1, root@erebus.local no input files $ pcc -h ld: warning: directory not found for option '-L/opt/local/lib/pcc/i386-apple-darwin12.2.1/1.0.0.RELEASE/lib/' ld: file not found: /opt/local/lib/pcc/i386-apple-darwin12.2.1/1.0.0.RELEASE/lib/crt1.o
The last lines seem to show that there is also something weird in the installation. There is no /opt/local/lib/pcc at all.
Sorry if I missed something :(
Change History (12)
comment:1 Changed 12 years ago by akimd (Akim Demaille)
comment:2 Changed 12 years ago by Veence (Vincent)
Salut Akim :)
The standard ‘as’ used by pcc (and various gcc) is outdated. It corresponds to gcc-4.2, latest version published under the GPL v2. You won’t get any AVX instructions out of it, for example. Maybe pcc uses a syntax adapted to more recent versions of gas? Is there a -s option to see the actual ASM output file?
Bonne journée ! Vincent
comment:3 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | mww@… openmaintainer@… removed |
---|---|
Owner: | changed from macports-tickets@… to mww@… |
comment:4 Changed 12 years ago by jmroot (Joshua Root)
Sounds like the kind of errors you get trying to run x86_64 asm through an i386 assembler (or perhaps vice versa?).
comment:5 Changed 12 years ago by akimd (Akim Demaille)
@vince: Bonjour !
@jmr: yes, I do agree, the problem is with the assembly language. I am not knowledgeable in assembly language, yet I expected (i) pcc to generate i386 assembly (it's documented to support it, but not x86_64), and (ii) a x86_64 assembler to support i386 assembly language. So I expected this to work.
FWIW
$ less foo.s .text .align 4 .globl _main _main: pushl %ebp movl %esp,%ebp subl $8,%esp subl $16,%esp L11: call Lmain$pb Lmain$pb: popl %eax movl %eax,-4(%ebp) L13: movl $0,-8(%ebp) jmp L12 L12: movl -8(%ebp),%eax leave ret .section __IMPORT,__pointers,non_lazy_symbol_pointers .ident "PCC: pcc 1.0.0.RELEASE (darwin)" $ as foo.s foo.s:5:suffix or operands invalid for `push' foo.s:12:suffix or operands invalid for `pop' foo.s:22:unknown section type: non_lazy_symbol_pointers foo.s:22:Rest of line ignored. 1st junk character valued 32 ( ).
Same result with both as (/usr/bin and /opt/local/bin). I could not find a MacPort package for gas.
comment:6 follow-up: 8 Changed 12 years ago by Veence (Vincent)
Akim,
There is no gas package because GNU binutils will not work on MacOS out of the box, and nobody has been able to figure out the patches needed to get gas producing Mach-O correct binaries.
Try llvm-mc instead, given that llvm-mc might use a syntax slightly different from GAS.
Bonne chance ! Vincent
comment:7 Changed 12 years ago by akimd (Akim Demaille)
Thanks Vince, but I couldn't have llvm-mc do something useful. Thanks to you, I found llvm's as though, and it does not work any better (well, in a way it does: there are less errors ;).
$ llvm-as-mp-3.2 foo.s /opt/local/libexec/llvm-3.2/bin/llvm-as: foo.s:1:2: error: expected top-level entity .text ^
Is there really any use for pcc in the MacPorts? It does not seem to work. On the other hand, it's a pity that there is no available port for tcc, which seems more maintained.
comment:8 Changed 10 years ago by cooljeanius (Eric Gallager)
Replying to vince@…:
Akim,
There is no gas package because GNU binutils will not work on MacOS out of the box, and nobody has been able to figure out the patches needed to get gas producing Mach-O correct binaries.
Actually there is a port for GNU binutils, but it does not install the gas
part of it it though. I have tried some things to get it to work, but have not quite figured it out yet. Also the binutils port has other issues, specifically:
Replying to akim.demaille@…:
On the other hand, it's a pity that there is no available port for tcc, which seems more maintained.
I opened #38196 for that.
comment:10 Changed 8 years ago by mf2k (Frank Schima)
Owner: | mww@… deleted |
---|---|
Status: | new → assigned |
See #53012.
comment:11 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Cc: | MarcusCalhoun-Lopez added |
---|
comment:12 Changed 6 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Owner: | set to MarcusCalhoun-Lopez |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
I should have shown this: