NetBSD Problem Report #40170

From jmcneill@black.invisible.ca  Sun Dec 14 18:43:10 2008
Return-Path: <jmcneill@black.invisible.ca>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 446FC63B121
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 14 Dec 2008 18:43:10 +0000 (UTC)
Message-Id: <20081214184305.D23C17D8F10@black.invisible.ca>
Date: Sun, 14 Dec 2008 13:43:05 -0500 (EST)
From: jmcneill@invisible.ca
Reply-To: jmcneill@invisible.ca
To: gnats-bugs@gnats.NetBSD.org
Subject: gcc -m32 issues with NEEDED
X-Send-Pr-Version: 3.95

>Number:         40170
>Category:       toolchain
>Synopsis:       gcc -m32 issues with NEEDED
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    mrg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 14 18:45:00 +0000 2008
>Closed-Date:    Sun Jan 18 09:04:07 +0000 2009
>Last-Modified:  Sun Jan 18 09:04:07 +0000 2009
>Originator:     Jared D. McNeill
>Release:        NetBSD 5.99.5
>Organization:

>Environment:


System: NetBSD black.invisible.ca 5.99.5 NetBSD 5.99.5 (GENERIC) #31: Sat Dec 13 21:35:08 EST 2008 jmcneill@black.invisible.ca:/export/home/jmcneill/branches/HEAD/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
	Consider the following test case (where /usr/pkg contains x86_64
	binaries and /usr/pkg32 contains i386 binaries):

	Create an empty file eg:
		echo 'int main(void) { return 0; }' >m32.c

	Then run the following script:

	#!/bin/sh -x
	cc `/usr/pkg/bin/pkg-config --cflags gthread-2.0` \
	    m32.c -o m32-64 `/usr/pkg/bin/pkg-config --libs gthread-2.0`
	cc -m32 `/usr/pkg32/bin/pkg-config --cflags gthread-2.0` \
	    m32.c -o m32-64 `/usr/pkg32/bin/pkg-config --libs gthread-2.0`

	The first command links successfully, however the second fails:

+ '.' '/etc/shrc'
+ '/usr/pkg/bin/pkg-config' '--cflags' 'gthread-2.0'
+ '/usr/pkg/bin/pkg-config' '--libs' 'gthread-2.0'
+ cc '-pthread' '-I/usr/pkg/include/glib/glib-2.0' '-I/usr/pkg/lib/glib-2.0/include' 'm32.c' '-o' m32 '-Wl,-R/usr/pkg/lib' '-pthread' '-L/usr/pkg/lib' '-lgthread-2.0' '-lglib-2.0' '-lintl'
+ '/usr/pkg32/bin/pkg-config' '--cflags' 'gthread-2.0'
+ '/usr/pkg32/bin/pkg-config' '--libs' 'gthread-2.0'
+ cc '-m32' '-pthread' '-I/usr/pkg32/include/glib/glib-2.0' '-I/usr/pkg32/lib/glib-2.0/include' 'm32.c' '-o' m32 '-Wl,-R/usr/pkg32/lib' '-pthread' '-L/usr/pkg32/lib' '-lgthread-2.0' '-lpthread' '-lrt' '-lglib-2.0' '-lintl'
ld: warning: libpcre.so.0, needed by /usr/pkg32/lib/libglib-2.0.so, not found (try using -rpath or -rpath-link)
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_compile2'
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_dfa_exec'
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_fullinfo'
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_get_stringtable_entries'
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_config'
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_get_stringnumber'
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_study'
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_free'
/usr/pkg32/lib/libglib-2.0.so: undefined reference to `pcre_exec'

	However, /usr/pkg32/lib/libpcre.so.0 exists:

libpcre.so.0:     file format elf32-i386
libpcre.so.0
architecture: i386, flags 0x00000150:
HAS_SYMS, DYNAMIC, D_PAGED
start address 0x00000ec0

Program Header:
    LOAD off    0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
         filesz 0x00033bf0 memsz 0x00033bf0 flags r-x
    LOAD off    0x00033bf0 vaddr 0x00034bf0 paddr 0x00034bf0 align 2**12
         filesz 0x000001a0 memsz 0x000001c0 flags rw-
 DYNAMIC off    0x00033c04 vaddr 0x00034c04 paddr 0x00034c04 align 2**2
         filesz 0x000000b8 memsz 0x000000b8 flags rw-
    NOTE off    0x00033bc4 vaddr 0x00033bc4 paddr 0x00033bc4 align 2**2
         filesz 0x00000018 memsz 0x00000018 flags r--
    NOTE off    0x00033bdc vaddr 0x00033bdc paddr 0x00033bdc align 2**2
         filesz 0x00000014 memsz 0x00000014 flags r--

Dynamic Section:
  NEEDED      libc.so.12
  SONAME      libpcre.so.0
  RPATH       /usr/pkg32/lib
  INIT        0xd60
  FINI        0x25380
  HASH        0xd4
  STRTAB      0x7d8
  SYMTAB      0x318
  STRSZ       0x3e9
  SYMENT      0x10
  PLTGOT      0x34d1c
  PLTRELSZ    0xa0
  PLTREL      0x11
  JMPREL      0xcb4
  REL         0xbc4
  RELSZ       0xf0
  RELENT      0x8
  RELCOUNT    0x2

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .hash         00000244  000000d4  000000d4  000000d4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  1 .dynsym       000004c0  00000318  00000318  00000318  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  2 .dynstr       000003e9  000007d8  000007d8  000007d8  2**0
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  3 .rel.dyn      000000f0  00000bc4  00000bc4  00000bc4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  4 .rel.plt      000000a0  00000cb4  00000cb4  00000cb4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  5 .init         0000000f  00000d60  00000d60  00000d60  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  6 .plt          00000150  00000d70  00000d70  00000d70  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  7 .text         000244b4  00000ec0  00000ec0  00000ec0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  8 .fini         0000000a  00025380  00025380  00025380  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  9 .rodata       0000e820  000253a0  000253a0  000253a0  2**5
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 10 .eh_frame     00000004  00033bc0  00033bc0  00033bc0  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 11 .note.netbsd.ident 00000018  00033bc4  00033bc4  00033bc4  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 12 .note.netbsd.pax 00000014  00033bdc  00033bdc  00033bdc  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 13 .ctors        00000008  00034bf0  00034bf0  00033bf0  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 14 .dtors        00000008  00034bf8  00034bf8  00033bf8  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 15 .jcr          00000004  00034c00  00034c00  00033c00  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 16 .dynamic      000000b8  00034c04  00034c04  00033c04  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 17 .got          00000060  00034cbc  00034cbc  00033cbc  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 18 .got.plt      0000005c  00034d1c  00034d1c  00033d1c  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 19 .data         00000018  00034d78  00034d78  00033d78  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 20 .bss          00000020  00034d90  00034d90  00033d90  2**2
                  ALLOC
 21 .comment      000005a8  00000000  00000000  00033d90  2**0
                  CONTENTS, READONLY
SYMBOL TABLE:
000000d4 l    d  .hash	00000000 .hash
00000318 l    d  .dynsym	00000000 .dynsym
000007d8 l    d  .dynstr	00000000 .dynstr
00000bc4 l    d  .rel.dyn	00000000 .rel.dyn
00000cb4 l    d  .rel.plt	00000000 .rel.plt
00000d60 l    d  .init	00000000 .init
00000d70 l    d  .plt	00000000 .plt
00000ec0 l    d  .text	00000000 .text
00025380 l    d  .fini	00000000 .fini
000253a0 l    d  .rodata	00000000 .rodata
00033bc0 l    d  .eh_frame	00000000 .eh_frame
00033bc4 l    d  .note.netbsd.ident	00000000 .note.netbsd.ident
00033bdc l    d  .note.netbsd.pax	00000000 .note.netbsd.pax
00034bf0 l    d  .ctors	00000000 .ctors
00034bf8 l    d  .dtors	00000000 .dtors
00034c00 l    d  .jcr	00000000 .jcr
00034c04 l    d  .dynamic	00000000 .dynamic
00034cbc l    d  .got	00000000 .got
00034d1c l    d  .got.plt	00000000 .got.plt
00034d78 l    d  .data	00000000 .data
00034d90 l    d  .bss	00000000 .bss
00000000 l    d  .comment	00000000 .comment
00000000 l    d  *ABS*	00000000 .shstrtab
00000000 l    d  *ABS*	00000000 .symtab
00000000 l    d  *ABS*	00000000 .strtab
00000000 l    df *ABS*	00000000 crti.c
00000000 l    df *ABS*	00000000 crtbeginS.c
00034bf0 l     O .ctors	00000000 __CTOR_LIST__
00034bf8 l     O .dtors	00000000 __DTOR_LIST__
00033bc0 l     O .eh_frame	00000000 __EH_FRAME_BEGIN__
00034c00 l     O .jcr	00000000 __JCR_LIST__
00034d90 l     O .bss	00000001 completed.3420
00034d7c l     O .data	00000000 p.3418
00000ec0 l     F .text	00000000 __do_global_dtors_aux
00034d94 l     O .bss	00000018 object.3478
00000f40 l     F .text	00000000 frame_dummy
00000000 l    df *ABS*	00000000 crtendS.c
00034bf4 l     O .ctors	00000000 __CTOR_END__
00034bfc l     O .dtors	00000000 __DTOR_END__
00033bc0 l     O .eh_frame	00000000 __FRAME_END__
00034c00 l     O .jcr	00000000 __JCR_END__
00025340 l     F .text	00000000 __do_global_ctors_aux
00000000 l    df *ABS*	00000000 crtn.c
00000000 l    df *ABS*	00000000 pcre_compile.c
000253a0 l     O .rodata	00000096 escapes
00025440 l     O .rodata	00000025 verbnames
00025480 l     O .rodata	00000038 verbs
000254b8 l     O .rodata	00000004 verbcount
000254c0 l     O .rodata	00000054 posix_names
00025514 l     O .rodata	0000000f posix_name_lengths
00025540 l     O .rodata	000000a8 posix_class_maps
00025600 l     O .rodata	00000929 error_texts
00025f40 l     O .rodata	00000100 digitab
00000fa0 l     F .text	0000003c find_error_text
00000fdc l     F .text	000006c3 check_escape
0000169f l     F .text	000001c1 get_ucp
00001860 l     F .text	00000102 is_counted_repeat
00001962 l     F .text	00000145 read_repeat_counts
00001aa7 l     F .text	00000357 find_parens
00001dfe l     F .text	00000138 first_significant_code
00001f36 l     F .text	000004e1 find_fixedlength
00002417 l     F .text	000001a5 find_bracket
000025bc l     F .text	00000163 find_recurse
0000271f l     F .text	000004ac could_be_empty_branch
00002bcb l     F .text	00000056 could_be_empty
00002c21 l     F .text	0000008a check_posix_syntax
00002cab l     F .text	00000096 check_posix_name
00002d41 l     F .text	0000010a adjust_recurse
00002e4b l     F .text	00000062 auto_callout
00002ead l     F .text	0000005f complete_callout
00002f0c l     F .text	0000010f get_othercase_range
0000301b l     F .text	000010ce check_auto_possessive
000040e9 l     F .text	000061b6 compile_branch
0000a29f l     F .text	00000450 compile_regex
0000a6ef l     F .text	000001ee is_anchored
0000a8dd l     F .text	000001bc is_startline
0000aa99 l     F .text	0000027e find_firstassertedchar
00000000 l    df *ABS*	00000000 pcre_config.c
00000000 l    df *ABS*	00000000 pcre_dfa_exec.c
000260a0 l     O .rodata	00000070 coptable
00026110 l     O .rodata	0000000e toptable1
0002611e l     O .rodata	0000000e toptable2
0000b9dc l     F .text	00007d54 internal_dfa_exec
00000000 l    df *ABS*	00000000 pcre_exec.c
0002612c l     O .rodata	00000006 rep_min
00026132 l     O .rodata	00000006 rep_max
00014540 l     F .text	0000029c match_ref
000147dc l     F .text	0000ca98 match
00000000 l    df *ABS*	00000000 pcre_fullinfo.c
00000000 l    df *ABS*	00000000 pcre_get.c
00022bc3 l     F .text	000000f3 get_first_set
00000000 l    df *ABS*	00000000 pcre_globals.c
00000000 l    df *ABS*	00000000 pcre_info.c
00000000 l    df *ABS*	00000000 pcre_maketables.c
00000000 l    df *ABS*	00000000 pcre_newline.c
00000000 l    df *ABS*	00000000 pcre_ord2utf8.c
00000000 l    df *ABS*	00000000 pcre_refcount.c
00000000 l    df *ABS*	00000000 pcre_study.c
00023c90 l     F .text	000000ad set_bit
00023d3d l     F .text	00000ac7 set_start_bits
00000000 l    df *ABS*	00000000 pcre_tables.c
00000000 l    df *ABS*	00000000 pcre_try_flipped.c
00024a50 l     F .text	00000063 byteflip
00000000 l    df *ABS*	00000000 pcre_ucd.c
00000000 l    df *ABS*	00000000 pcre_valid_utf8.c
00000000 l    df *ABS*	00000000 pcre_version.c
00000000 l    df *ABS*	00000000 pcre_xclass.c
00000000 l    df *ABS*	00000000 pcre_chartables.c
0000b90b l     F .text	00000000 .hidden __i686.get_pc_thunk.cx
00034d78 l     O .data	00000000 .hidden __dso_handle
00000f99 l     F .text	00000000 .hidden __i686.get_pc_thunk.bx
00034d1c l     O *ABS*	00000000 .hidden _GLOBAL_OFFSET_TABLE_
00029960 g     O .rodata	00009e00 _pcre_ucd_stage2
00022cb6 g     F .text	0000008f pcre_copy_substring
0000ad5e g     F .text	00000bad pcre_compile2
00013730 g     F .text	00000e0d pcre_dfa_exec
0002377c g     F .text	000001f7 _pcre_is_newline
00000000       F *UND*	00000000 memmove
00034c04 g     O *ABS*	00000000 _DYNAMIC
00026248 g     O .rodata	00000004 _pcre_utf8_table1_size
00026340 g     O .rodata	000002e4 _pcre_utt_names
00022564 g     F .text	00000319 pcre_fullinfo
00000000  w    F *UND*	00000000 __cxa_finalize
00033780 g     O .rodata	00000440 _pcre_default_tables
00023c14 g     F .text	0000007c pcre_refcount
00000000       F *UND*	00000000 malloc
000262c0 g     O .rodata	00000078 _pcre_ucp_gentype
00027760 g     O .rodata	00002200 _pcre_ucd_stage1
00023973 g     F .text	00000211 _pcre_was_newline
00000d60 g       .init	00000000 _init
00022dbb g     F .text	0000012d pcre_get_substring_list
00026230 g     O .rodata	00000018 _pcre_utf8_table1
00022f10 g     F .text	000000b5 pcre_get_substring
00026640 g     O .rodata	000002b8 _pcre_utt
00024e98 g     F .text	00000033 pcre_version
00000000       O *UND*	00000000 _toupper_tab_
00023034 g     F .text	00000028 pcre_free_substring
00000000  w      *UND*	00000000 __deregister_frame_info
00034d80 g     O .data	00000004 pcre_malloc
00026264 g     O .rodata	00000018 _pcre_utf8_table3
00000000       F *UND*	00000000 strncmp
00024ecc g     F .text	0000046e _pcre_xclass
000229e0 g     F .text	000001e3 pcre_get_stringtable_entries
00026280 g     O .rodata	00000040 _pcre_utf8_table4
0002624c g     O .rodata	00000018 _pcre_utf8_table2
0000ad17 g     F .text	00000047 pcre_compile
00034d90 g       *ABS*	00000000 __bss_start
00000000       F *UND*	00000000 memset
00024ab3 g     F .text	000001f7 _pcre_try_flipped
0000b910 g     F .text	000000cc pcre_config
00000000       F *UND*	00000000 strcmp
00025380 g       .fini	00000000 _fini
00023b84 g     F .text	0000008f _pcre_ord2utf8
000268f8 g     O .rodata	00000004 _pcre_utt_size
00022d45 g     F .text	00000076 pcre_copy_named_substring
00022fc5 g     F .text	0000006f pcre_get_named_substring
00034d88 g     O .data	00000004 pcre_stack_malloc
000261c0 g     O .rodata	00000070 _pcre_OP_lengths
00034d90 g       *ABS*	00000000 _edata
00034db0 g       *ABS*	00000000 _end
00022880 g     F .text	00000160 pcre_get_stringnumber
00024804 g     F .text	0000024a pcre_study
00034d8c g     O .data	00000004 pcre_stack_free
00034d84 g     O .data	00000004 pcre_free
00000000       O *UND*	00000000 _tolower_tab_
00034dac g     O .bss	00000004 pcre_callout
00024cac g     F .text	000001ec _pcre_valid_utf8
00000000       O *UND*	00000000 _ctype_
00023148 g     F .text	00000632 pcre_maketables
00000000       F *UND*	00000000 strchr
00000000  w      *UND*	00000000 _Jv_RegisterClasses
00022ee8 g     F .text	00000028 pcre_free_substring_list
00021274 g     F .text	000012ee pcre_exec
00000000  w      *UND*	00000000 __register_frame_info
00026900 g     O .rodata	00000e48 _pcre_ucd_records
00000000       F *UND*	00000000 free
0002305c g     F .text	000000ea pcre_info


>How-To-Repeat:

>Fix:


>Release-Note:

>Audit-Trail:
From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/40170: gcc -m32 issues with NEEDED
Date: Sun, 14 Dec 2008 14:16:37 -0500 (EST)

 Here is a simple regression test to reproduce the issue:

    http://www.invisible.ca/~jmcneill/netbsd/pr40170.tar

 $ sh -x test.sh
 + '.' '/etc/shrc'
 + echo ' ==> building 64-bit executable'
   ==> building 64-bit executable
 + cc '-shared' '-fPIC' '-DPIC' '-o' 'liblib64.so' '-lpthread' 'lib.c'
 + pwd
 + pwd
 + cc '-Wl,-R/export/home/jmcneill/pr40170' 
 '-L/export/home/jmcneill/pr40170' 'prog.c' '-o' prog '-llib64'
 + echo ' ==> building 32-bit executable'
   ==> building 32-bit executable
 + cc '-m32' '-shared' '-fPIC' '-DPIC' '-o' 'liblib32.so' '-lpthread' 
 'lib.c'
 + pwd
 + pwd
 + cc '-m32' '-Wl,-R/export/home/jmcneill/pr40170' 
 '-L/export/home/jmcneill/pr40170' 'prog.c' '-o' prog '-llib32'
 ld: warning: libpthread.so.0, needed by 
 /export/home/jmcneill/pr40170/liblib32.so, not found (try using -rpath or 
 -rpath-link)

From: "Jared D. McNeill" <jmcneill@invisible.ca>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org, 
 netbsd-bugs@netbsd.org
Subject: Re: toolchain/40170: gcc -m32 issues with NEEDED
Date: Sun, 14 Dec 2008 14:25:30 -0500

 ktrace shows more:

 $ grep 'NAMI.*libpthread' ktrace.txt 

    9417      1 ld       NAMI  "/usr/bin/../libdata/libpthread.so.0"
    9417      1 ld       NAMI  "/usr/x86_64--netbsd/lib/libpthread.so.0"
    9417      1 ld       NAMI  "/usr/bin/../libdata/libpthread.so.0"
    9417      1 ld       NAMI  "/usr/x86_64--netbsd/lib/libpthread.so.0"

Responsible-Changed-From-To: toolchain-manager->mrg
Responsible-Changed-By: mrg@NetBSD.org
Responsible-Changed-When: Sun, 14 Dec 2008 23:34:08 +0000
Responsible-Changed-Why:
mine


From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, jmcneill@invisible.ca
Subject: re: toolchain/40170: gcc -m32 issues with NEEDED
Date: Mon, 15 Dec 2008 10:33:55 +1100

 jared pointed out that using -rpath-links /usr/lib/i386 helps and
 i believe that this is the right solution..

 however, i'm not sure how to get that automatically generated when
 using "cc -m32" without some awful hack to the gcc specs.

 any ideas from the peanut gallery?


 .mrg.

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: re: toolchain/40170: gcc -m32 issues with NEEDED
Date: Mon, 15 Dec 2008 12:35:12 +1100

 this patch fixes half of the problem -- making ld have the right
 SEARCH_DIRS for the 32 bit scripts.  it's pretty ugly but i'm not
 sure of a nicer way off hand.

 it leaves the other half of the problem remaining, however, as
 can be demonstrated by the pr40170.tar from jared.


 .mrg.


 Index: gnu/usr.bin/binutils/ld/Makefile
 ===================================================================
 RCS file: /cvsroot/src/gnu/usr.bin/binutils/ld/Makefile,v
 retrieving revision 1.27
 diff -p -r1.27 Makefile
 *** Makefile	13 Oct 2008 22:36:55 -0000	1.27
 --- Makefile	15 Dec 2008 01:32:24 -0000
 *************** ${PROG}.info: configdoc.texi
 *** 74,86 ****
   DPSRCS+=	.depend.${f} e${f}.c
   CLEANFILES+=	.depend.${f} e${f}.c

   e${f}.c: ${DIST}/ld/genscripts.sh ${.CURDIR}/Makefile stringify.sed
   	${_MKTARGET_CREATE}
   	unset MACHINE || true; \
 ! 	LIB_PATH=/usr/lib
   		${HOST_SH} ${DIST}/ld/genscripts.sh ${DIST}/ld ${LIBDIR} "/usr" \
   		${G_target_alias} ${G_target_alias} ${G_target_alias} \
 ! 		${G_EMUL} ${LIBDIR} no ${f} "${G_target_alias}"

   .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64"
   FILES+=		${f}.x ${f}.xbn ${f}.xn ${f}.xr ${f}.xu
 --- 74,97 ----
   DPSRCS+=	.depend.${f} e${f}.c
   CLEANFILES+=	.depend.${f} e${f}.c

 + EMUL_LIB_PATH:=/usr/lib
 + # XXX super hack
 + . if (${MACHINE_ARCH} == "x86_64" && \
 +       (${f} == "elf_i386" || ${f} == "i386nbsd"))
 + EMUL_LIB_PATH:=/usr/lib/i386
 + . endif
 + . if (${MACHINE_ARCH} == "sparc64" && \
 +       (${f} == "elf32_sparc " || ${f} == "sparcnbsd"))
 + EMUL_LIB_PATH:=/usr/lib/sparc
 + . endif
 + 
   e${f}.c: ${DIST}/ld/genscripts.sh ${.CURDIR}/Makefile stringify.sed
   	${_MKTARGET_CREATE}
   	unset MACHINE || true; \
 ! 	LIB_PATH=${EMUL_LIB_PATH} \
   		${HOST_SH} ${DIST}/ld/genscripts.sh ${DIST}/ld ${LIBDIR} "/usr" \
   		${G_target_alias} ${G_target_alias} ${G_target_alias} \
 ! 		${G_EMUL} ${LIBDIR} yes ${f} "${G_target_alias}"

   .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "sparc64"
   FILES+=		${f}.x ${f}.xbn ${f}.xn ${f}.xr ${f}.xu

From: matthew green <mrg@eterna.com.au>
To: 
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org, gnats-bugs@NetBSD.org
Subject: re: toolchain/40170: gcc -m32 issues with NEEDED
Date: Mon, 15 Dec 2008 16:28:28 +1100


    this patch fixes half of the problem -- making ld have the right

 actually, it doesn't.  i've got a better one in progress.

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: mrg@NetBSD.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
	jmcneill@invisible.ca
Subject: Re: toolchain/40170: gcc -m32 issues with NEEDED
Date: Sat, 3 Jan 2009 03:55:48 +0000

 On Sun, Dec 14, 2008 at 11:35:04PM +0000, matthew green wrote:
  >  jared pointed out that using -rpath-links /usr/lib/i386 helps and
  >  i believe that this is the right solution..
  >  
  >  however, i'm not sure how to get that automatically generated when
  >  using "cc -m32" without some awful hack to the gcc specs.

 That's the kind of thing gcc specs are *for*, much as it's a pain. :-/

 -- 
 David A. Holland
 dholland@netbsd.org

From: matthew green <mrg@eterna.com.au>
To: gnats-bugs@NetBSD.org
Cc: gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
    jmcneill@invisible.ca
Subject: re: toolchain/40170: gcc -m32 issues with NEEDED
Date: Mon, 05 Jan 2009 12:31:03 +1100


     On Sun, Dec 14, 2008 at 11:35:04PM +0000, matthew green wrote:
      >  jared pointed out that using -rpath-links /usr/lib/i386 helps and
      >  i believe that this is the right solution..
      >  
      >  however, i'm not sure how to get that automatically generated when
      >  using "cc -m32" without some awful hack to the gcc specs.

     That's the kind of thing gcc specs are *for*, much as it's a pain. :-/


 i have fixes for all these issues in my tree and plan to test and
 push them into -current in the next week or so, and get pullups
 for netbsd-5 as well.


 .mrg.

From: matthew green <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40170 CVS commit: src/gnu/usr.bin/binutils/ld
Date: Tue,  6 Jan 2009 03:08:40 +0000 (UTC)

 Module Name:	src
 Committed By:	mrg
 Date:		Tue Jan  6 03:08:39 UTC 2009

 Modified Files:
 	src/gnu/usr.bin/binutils/ld: Makefile

 Log Message:
 some fixes for PR#40170:
 - set NATIVE=yes in the environment for genscripts.sh
 - set LIB_PATH to /usr/lib/{sparc,i386} for those scripts
 - set use_sysroot to "yes", to enable LIB_PATH to work in genscripts.sh


 To generate a diff of this commit:
 cvs rdiff -r1.27 -r1.28 src/gnu/usr.bin/binutils/ld/Makefile

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Tue, 06 Jan 2009 04:16:59 +0000
State-Changed-Why:
this should be fixed; please confirm.


From: Manuel Bouyer <bouyer@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/40170 CVS commit: [netbsd-5] src
Date: Fri, 16 Jan 2009 22:21:31 +0000 (UTC)

 Module Name:	src
 Committed By:	bouyer
 Date:		Fri Jan 16 22:21:31 UTC 2009

 Modified Files:
 	src/gnu/usr.bin/binutils/ld [netbsd-5]: Makefile
 	src/libexec/ld.elf_so [netbsd-5]: headers.c map_object.c
 	src/libexec/ld.elf_so/arch/i386 [netbsd-5]: Makefile.inc
 	src/libexec/ld.elf_so/arch/sparc [netbsd-5]: Makefile.inc
 	src/rescue [netbsd-5]: Makefile list
 	src/usr.bin/ldd [netbsd-5]: Makefile
 Added Files:
 	src/libexec/ld.elf_so/arch/i386 [netbsd-5]: Makefile.ld32
 	src/libexec/ld.elf_so/arch/sparc [netbsd-5]: Makefile.ld32
 	src/rescue [netbsd-5]: list.ldd
 	src/usr.bin/ldd [netbsd-5]: Makefile.common Makefile.elf dummy.c ldd.c
 	    ldd.h ldd_aout.c ldd_elfxx.c
 	src/usr.bin/ldd/aout [netbsd-5]: Makefile
 	src/usr.bin/ldd/elf32 [netbsd-5]: Makefile
 	src/usr.bin/ldd/elf64 [netbsd-5]: Makefile
 Removed Files:
 	src/usr.bin/ldd/ldd_aout [netbsd-5]: Makefile ldd.c
 	src/usr.bin/ldd/ldd_elf [netbsd-5]: Makefile README ldd.c

 Log Message:
 Pull up following revision(s) (requested by mrg in ticket #265):
 	libexec/ld.elf_so/headers.c: revision 1.27
 	rescue/list: revision 1.35
 	libexec/ld.elf_so/arch/sparc/Makefile.ld32: revision 1.1
 	usr.bin/ldd/Makefile.elf: revision 1.1
 	usr.bin/ldd/Makefile.elf: revision 1.2
 	usr.bin/ldd/ldd_aout/ldd.c: file removal
 	usr.bin/ldd/Makefile.elf: revision 1.3
 	libexec/ld.elf_so/arch/sparc/Makefile.inc: revision 1.12
 	usr.bin/ldd/dummy.c: revision 1.1
 	gnu/usr.bin/binutils/ld/Makefile: revision 1.28
 	usr.bin/ldd/elf32/Makefile: revision 1.1
 	usr.bin/ldd/elf32/Makefile: revision 1.2
 	usr.bin/ldd/ldd.c: revision 1.3
 	usr.bin/ldd/elf32/Makefile: revision 1.3
 	usr.bin/ldd/ldd_elf/Makefile: file removal
 	usr.bin/ldd/ldd.h: revision 1.1
 	usr.bin/ldd/ldd.c: revision 1.4
 	usr.bin/ldd/ldd_aout.c: revision 1.1
 	usr.bin/ldd/Makefile: revision 1.8
 	usr.bin/ldd/Makefile: revision 1.9
 	usr.bin/ldd/ldd_elfxx.c: revision 1.1
 	libexec/ld.elf_so/map_object.c: revision 1.37
 	usr.bin/ldd/ldd_aout/Makefile: file removal
 	usr.bin/ldd/elf64/Makefile: revision 1.1
 	rescue/Makefile: revision 1.22
 	libexec/ld.elf_so/arch/i386/Makefile.ld32: revision 1.1
 	usr.bin/ldd/ldd_elf/ldd.c: file removal
 	usr.bin/ldd/elf64/Makefile: revision 1.2
 	usr.bin/ldd/elf64/Makefile: revision 1.3
 	usr.bin/ldd/aout/Makefile: revision 1.1
 	libexec/ld.elf_so/arch/i386/Makefile.inc: revision 1.12
 	rescue/list.ldd: revision 1.1
 	usr.bin/ldd/ldd_elf/README: file removal
 	usr.bin/ldd/Makefile.common: revision 1.1
 move the defines for RTLD_ARCH_SUBDIR into a sub-sub-makefile so we can
 grab these values via reach-over more easily.
 some fixes for PR#40170:
 - set NATIVE=yes in the environment for genscripts.sh
 - set LIB_PATH to /usr/lib/{sparc,i386} for those scripts
 - set use_sysroot to "yes", to enable LIB_PATH to work in genscripts.sh
 - get rid of building an a.out-happy ldd (but keep supporting a.out
   binaries for the ELF version.)
 - convert a.out, elf32 and elf64 support into convience libraries and
   link them right ones in.  if elf_ldd() fails on 64 bit platforms,
   try elf32_ldd() before aout_ldd().
 now ldd on 64 bit platforms works for 32 bit binaries, aka PR#40199,
 and it seems that all the issues from README are gone too.
 add some (uintptr_t) to some casts, so these compile with ELFSIZE=32
 *and _LP64.  necessary for 32/64 bit combo ldd support.
 - rework this a bunch to make it work inside /rescue/ldd.
 - fix alpha build.
 make sure we set LIBISPRIVATE.
 fixes build issues reported by moof.
 make sure we set LIBISPRIVATE.
 fixes build issues reported by moof.


 To generate a diff of this commit:
 cvs rdiff -r1.27 -r1.27.2.1 src/gnu/usr.bin/binutils/ld/Makefile
 cvs rdiff -r1.26 -r1.26.10.1 src/libexec/ld.elf_so/headers.c
 cvs rdiff -r1.36 -r1.36.4.1 src/libexec/ld.elf_so/map_object.c
 cvs rdiff -r1.11 -r1.11.2.1 src/libexec/ld.elf_so/arch/i386/Makefile.inc
 cvs rdiff -r0 -r1.1.2.2 src/libexec/ld.elf_so/arch/i386/Makefile.ld32
 cvs rdiff -r1.11 -r1.11.2.1 src/libexec/ld.elf_so/arch/sparc/Makefile.inc
 cvs rdiff -r0 -r1.1.2.2 src/libexec/ld.elf_so/arch/sparc/Makefile.ld32
 cvs rdiff -r1.21 -r1.21.10.1 src/rescue/Makefile
 cvs rdiff -r1.33 -r1.33.2.1 src/rescue/list
 cvs rdiff -r0 -r1.1.2.2 src/rescue/list.ldd
 cvs rdiff -r1.7 -r1.7.52.1 src/usr.bin/ldd/Makefile
 cvs rdiff -r0 -r1.1.2.2 src/usr.bin/ldd/Makefile.common \
     src/usr.bin/ldd/dummy.c src/usr.bin/ldd/ldd.h src/usr.bin/ldd/ldd_elfxx.c
 cvs rdiff -r0 -r1.3.2.2 src/usr.bin/ldd/Makefile.elf
 cvs rdiff -r0 -r1.2.12.1 src/usr.bin/ldd/ldd.c
 cvs rdiff -r0 -r1.2.2.2 src/usr.bin/ldd/ldd_aout.c
 cvs rdiff -r0 -r1.1.2.2 src/usr.bin/ldd/aout/Makefile
 cvs rdiff -r0 -r1.4.2.2 src/usr.bin/ldd/elf32/Makefile
 cvs rdiff -r0 -r1.4.2.2 src/usr.bin/ldd/elf64/Makefile
 cvs rdiff -r1.8 -r0 src/usr.bin/ldd/ldd_aout/Makefile
 cvs rdiff -r1.20 -r0 src/usr.bin/ldd/ldd_aout/ldd.c
 cvs rdiff -r1.17 -r0 src/usr.bin/ldd/ldd_elf/Makefile
 cvs rdiff -r1.4 -r0 src/usr.bin/ldd/ldd_elf/README
 cvs rdiff -r1.32 -r0 src/usr.bin/ldd/ldd_elf/ldd.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: feedback->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Sun, 18 Jan 2009 09:04:07 +0000
State-Changed-Why:
fixed and pulled up to -5.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.