Dan Nelson wrote:
In the last episode (Dec 17), Alexander Shiryaev said:
I'm trying to hack ICC 9.1.045 ia32 (using lang/icc port for ICC 8). I can't compile hello world ;-(

icc  -c main.c
icc   -o main main.o
IPO link: can not find -ldl
iccbin: error: problem during multi-file optimization compilation (code 1)
*** Error code 1

Ouch.  A quick ktrace indicates that message is generated by mcpcom,
which might mean that icc's ipo feature links the final binary itself
without calling ldwrapper, and that means you're not going to get a
FreeBSD binary out of the link stage.  If there's an option to disable
ipo, try adding that to your icc.cfg file as a quick fix.

Since it looks like mcpcom just gets its instructions from its parent
iccbin through a temp file, it should be possible to write an mcpcom
wrapper that opens the tempfile, rewrites its contents (in a manner
similar to what ldwrapper does for the ld commandline), then launches
the real mcpcom binary.


It works!

I attached quickly-written mcpcom wrapper.

Move /usr/local/intel_cc_80/bin/mcpcom to /usr/local/intel_cc_80/bin/mcpcom.x and then copy attached mcpcom to /usr/local/intel_cc_80/bin/


$ make CC=icc CFLAGS=
icc  -c main.c
icc   -o main main.o
mcpcom input: -mIPOPT_cmdline_link="/usr/lib/crt1.o" "/usr/lib/crti.o" "/usr/local/intel_cc_80/lib/crtbegin.o" "-dynamic-linker" "/lib/ld-linux.so.2" "-m" "elf_i386" "-o" "main" "main.o" "-L/usr/local/intel_cc_80/lib" "-L/usr/lib" "-Bstatic" "-limf" "-Bdynamic" "-lm" "-Bstatic" "-lipgo" "-Bdynamic" "-Bstatic" "-lirc" "-Bdynamic" "-lc" "-Bstatic" "-lirc_s" "-Bdynamic" "-ldl" "-lc" "/usr/local/intel_cc_80/lib/crtend.o" "/usr/lib/crtn.o" mcpcom output: -mIPOPT_cmdline_link="/usr/lib/crt1.o" "/usr/lib/crti.o" "/usr/local/intel_cc_80/lib/crtbegin.o" "-dynamic-linker" "/lib/ld-linux.so.2" "-m" "elf_i386" "-o" "main" "main.o" "-L/usr/local/intel_cc_80/lib" "-L/usr/lib" "-Bstatic" "-limf" "-Bdynamic" "-lm" "-Bstatic" "-lipgo" "-Bdynamic" "-Bstatic" "-lirc" "-Bdynamic" "-lc" "-Bstatic" "-lirc_s" "-Bdynamic" "-lc" "/usr/local/intel_cc_80/lib/crtend.o" "/usr/lib/crtn.o" ldwrapper input: /usr/local/intel_cc_80/bin/ldwrapper/ld /usr/lib/crt1.o /usr/lib/crti.o /usr/local/intel_cc_80/lib/crtbegin.o -dynamic-linker /lib/ld-linux.so.2 -m elf_i386 -o main main.o -L/usr/local/intel_cc_80/lib -L/usr/lib -Bstatic -limf -Bdynamic -lm -Bstatic -lipgo -Bdynamic -Bstatic -lirc -Bdynamic -lc -Bstatic -lirc_s -Bdynamic -ldl -lc /usr/local/intel_cc_80/lib/crtend.o /usr/lib/crtn.o ldwrapper output: /usr/local/intel_cc_80/bin/ldwrapper/ld -melf_i386_fbsd /usr/lib/crt1.o /usr/lib/crti.o /usr/local/intel_cc_80/lib/crtbegin.o -dynamic-linker /libexec/ld-elf.so.1 -o main main.o -L/usr/local/intel_cc_80/lib -L/usr/libexec/elf -L/usr/libexec -L/usr/lib -Bstatic -limf -Bdynamic -lm -Bstatic -lipgo -Bdynamic -Bstatic -lirc -Bdynamic -Bstatic -liccfbsd -Bdynamic -lc -Bstatic -lirc_s -Bdynamic -Bstatic -liccfbsd -Bdynamic -lc /usr/local/intel_cc_80/lib/crtend.o /usr/lib/crtn.o

It means ldwrapper works after mcpcom.
#! /usr/bin/env python

import os, sys, re, string

if __name__ == '__main__':
        assert len(sys.argv) == 2
        
        filename = sys.argv[1][1:]
        
        # read all lines from file
        fh = open(filename, 'r')
        lines = fh.readlines()
        fh.close()
        
        out_lines = []
        for line in lines:
                r = re.match('^-mIPOPT_cmdline_link=(.*)', line)
                if r:
                        print "mcpcom input: %s" % line,
                        line = string.replace(line, '"-ldl"', '')
                        print "mcpcom output: %s" % line,
                out_lines.append(line)
        
        # update file
        fh = open(filename, 'w')
        for line in out_lines:
                fh.write(line)
        fh.close()
        
        os.execvp("mcpcom.x", sys.argv)
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to