Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Dec 2006 18:08:11 +0300
From:      Alexander Shiryaev <coumarin@gmail.com>
To:        Dan Nelson <dnelson@allantgroup.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: ICC 9 in FreeBSD 6
Message-ID:  <45855D5B.6060001@gmail.com>
In-Reply-To: <20061217034557.GB43992@dan.emsphone.com>
References:  <45847990.8060605@gmail.com> <20061217034557.GB43992@dan.emsphone.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------080705030901010005080205
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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.

--------------080705030901010005080205
Content-Type: text/plain;
 name="mcpcom"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="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)

--------------080705030901010005080205--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45855D5B.6060001>