From nobody@FreeBSD.org  Thu Jan 13 22:26:12 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 3EF2716A4CE
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 13 Jan 2005 22:26:12 +0000 (GMT)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 044C343D1D
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 13 Jan 2005 22:26:12 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j0DMQBqj075950
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 13 Jan 2005 22:26:11 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j0DMQBdx075949;
	Thu, 13 Jan 2005 22:26:11 GMT
	(envelope-from nobody)
Message-Id: <200501132226.j0DMQBdx075949@www.freebsd.org>
Date: Thu, 13 Jan 2005 22:26:11 GMT
From: Jonathan Dama <jd@caltech.edu>
To: freebsd-gnats-submit@FreeBSD.org
Subject: gcc fails to invoke ld properly, ld fails to examine ldconfig -32's libraries
X-Send-Pr-Version: www-2.3

>Number:         76224
>Category:       amd64
>Synopsis:       gcc fails to invoke ld properly, ld fails to examine ldconfig -32's libraries
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-amd64
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 13 22:30:35 GMT 2005
>Closed-Date:    Fri Jan 14 00:20:20 GMT 2005
>Last-Modified:  Fri Jan 14 00:20:20 GMT 2005
>Originator:     Jonathan Dama
>Release:        FreeBSD-5.3/amd64
>Organization:
Caltech VLSI Group
>Environment:
FreeBSD carbon.async.caltech.edu 5.3-STABLE FreeBSD 5.3-STABLE #0: Mon Jan 10 11:53:44 PST 2005     root@carbon.async.caltech.edu:/usr/obj/usr/src/sys/CRUNCHER  amd64

>Description:
Though /usr/bin/ld reports that it can make elf_i386_fbsd, cc -m32 simple-c-file.c does not properly build

gcc does not translate -m32 to mean that ld must be envoked with /usr/lib32 bits instead of /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o

also mistakenly gives: -dynamic-linker /libexec/ld-elf.so.1 and -L/usr/lib instead of -dynamic-linker /libexec/ld-elf32.so.1 and -L/usr/lib32


>How-To-Repeat:
Following simple test program (main.c):
#include <stdio.h>
int main() { printf("Hello world\n"); return 0; }

Run:
jd@carbon:~/tmp/cdemo>cc -m32 -v -o test main.c

Result:
Using built-in specs.
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 3.4.2 [FreeBSD] 20040728
 /usr/libexec/cc1 -quiet -v -D_LONGLONG main.c -quiet -dumpbase main.c -m32 -aux
base main -version -o /var/tmp//ccGKzqtl.s
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include
End of search list.
GNU C version 3.4.2 [FreeBSD] 20040728 (amd64-fbsdproj-freebsd)
        compiled by GNU C version 3.4.2 [FreeBSD] 20040728.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
 /usr/bin/as -V -Qy --32 -o /var/tmp//ccdmrhyt.o /var/tmp//ccGKzqtl.s
GNU assembler version 2.15 [FreeBSD] 2004-05-23 (x86_64-obrien-freebsd) using BF
D version 2.15 [FreeBSD] 2004-05-23
 /usr/bin/ld -m elf_i386_fbsd -V -dynamic-linker /libexec/ld-elf.so.1 -o test /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib -melf_i386_fbsd /var/tmp//ccdmrhyt.o -lgcc -lc -lgcc /usr/lib/crtend.o /usr/lib/crtn.o
GNU ld version 2.15 [FreeBSD] 2004-05-23
  Supported emulations:
   elf_i386_fbsd
   elf_x86_64_fbsd
/usr/bin/ld: skipping incompatible /usr/lib/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc      
>Fix:
      
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: obrien 
State-Changed-When: Fri Jan 14 00:19:46 GMT 2005 
State-Changed-Why:  
Know issue. 
We don't yet support building 32-bit apps on a a 64-bit system. 
We only barely support *running* them at this point. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=76224 
>Unformatted:
