From owner-freebsd-hackers@FreeBSD.ORG Sun Dec 17 15:07:37 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2A9A616A407 for ; Sun, 17 Dec 2006 15:07:37 +0000 (UTC) (envelope-from coumarin@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.173]) by mx1.FreeBSD.org (Postfix) with ESMTP id 331F343CA8 for ; Sun, 17 Dec 2006 15:07:36 +0000 (GMT) (envelope-from coumarin@gmail.com) Received: by ug-out-1314.google.com with SMTP id o2so1119277uge for ; Sun, 17 Dec 2006 07:07:35 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type; b=ITH56HHCujrPgxQKUIailEtHWqHEg2tsATOPkjQlzi7IOuoh1d3X5MZ5U48WVXk5LiYxFdHzS/gxt4TE0kOahSRZIAltQcGnoWP+kW6ILBmum2KmrvdjMjciC4Qkx/QwKCRVMkhVFC82yLCKoSsIHxJ1kcw2/Z/kRtXgYOradMw= Received: by 10.66.243.2 with SMTP id q2mr4880670ugh.1166368054616; Sun, 17 Dec 2006 07:07:34 -0800 (PST) Received: from ?192.168.8.50? ( [195.209.41.226]) by mx.google.com with ESMTP id o30sm7651653ugd.2006.12.17.07.07.32; Sun, 17 Dec 2006 07:07:34 -0800 (PST) Message-ID: <45855D5B.6060001@gmail.com> Date: Sun, 17 Dec 2006 18:08:11 +0300 From: Alexander Shiryaev User-Agent: Thunderbird 1.5.0.7 (X11/20061109) MIME-Version: 1.0 To: Dan Nelson References: <45847990.8060605@gmail.com> <20061217034557.GB43992@dan.emsphone.com> In-Reply-To: <20061217034557.GB43992@dan.emsphone.com> Content-Type: multipart/mixed; boundary="------------080705030901010005080205" Cc: freebsd-hackers@freebsd.org Subject: Re: ICC 9 in FreeBSD 6 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Dec 2006 15:07:37 -0000 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--