NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-powerpc/43010: ld error building powerpc64 libposix.so.0.1



>Number:         43010
>Category:       port-powerpc
>Synopsis:       ld error building powerpc64 libposix.so.0.1
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    port-powerpc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 19 11:50:00 +0000 2010
>Originator:     Dennis Ferguson
>Release:        very recent 5.99.24
>Organization:
>Environment:
NetBSD acer.hk.akit-ferguson.com 5.99.24 NetBSD 5.99.24 (GENERIC) #0: Sun Mar 
14 17:25:30 HKT 2010  
dennis%acer.hk.akit-ferguson.com@localhost:/usr/obj/sys/arch/amd64/compile/GENERIC
 amd64
>Description:
When building a shared libposix.so for macppc64 the following
error is emitted by ld:

#     build  libposix/libposix.so.0.1
rm -f libposix.so.0.1
/usr/src/obj/tooldir.Darwin-10.2.0-i386/bin/powerpc64--netbsd-gcc  
-Wl,-nostdlib -B/usr/src/obj/destdir.macppc/usr/lib/ 
-B/usr/src/obj/destdir.macppc/usr/lib/  -Wl,-x -shared 
-Wl,-soname,libposix.so.0 -Wl,--warn-shared-textrel -o libposix.so.0.1  
-Wl,--whole-archive libposix_pic.a  -Wl,--no-whole-archive     
-Wl,-rpath-link,/usr/src/obj/destdir.macppc/lib:/usr/src/obj/destdir.macppc/usr/lib
  -L/usr/src/obj/destdir.macppc/lib  -Wl,--fatal-warnings   
-L/usr/src/obj/destdir.macppc/usr/lib
/usr/src/obj/tooldir.Darwin-10.2.0-i386/lib/gcc/powerpc64--netbsd/4.1.3/../../../../powerpc64--netbsd/bin/ld:
 libposix_pic.a(rename.pico)(.text+0xc): unresolvable R_PPC64_REL24 relocation 
against symbol `.__cerror'
/usr/src/obj/tooldir.Darwin-10.2.0-i386/lib/gcc/powerpc64--netbsd/4.1.3/../../../../powerpc64--netbsd/bin/ld:
 final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status

*** Failed target:  libposix.so.0.1

>How-To-Repeat:
Do a:

    MACHINE=macppc64 ./build.sh distribution
>Fix:
I think the problem is with the assembler system call
procedures defined in the cpp macros in
lib/libc/arch/powerpc64/SYS.h.  In particular I think
instructions which branch to arbitrary locations may
need to be followed by a nop to give the loader room
to write the glue instructions needed for long branches
(which aren't needed for system calls in libc, since
the cerror target is in the same module, but are needed
for libposix since cerror is over in libc).

In any case, this patch allows the build to continue:

Index: SYS.h
===================================================================
RCS file: /cvsroot/src/lib/libc/arch/powerpc64/SYS.h,v
retrieving revision 1.1
diff -u -r1.1 SYS.h
--- SYS.h       1 Jul 2006 16:37:20 -0000       1.1
+++ SYS.h       19 Mar 2010 09:07:58 -0000
@@ -19,6 +19,7 @@
 #define _SYSCALL(x,y)          .text                           ;\
                                .align  2                       ;\
                        2:      b       PIC_PLT(_C_LABEL(__cerror));\
+                               nop                             ;\
                                _SYSCALL_NOERROR(x,y)           ;\
                                bso     2b
 
@@ -31,7 +32,8 @@
 
 #define PSEUDO(x,y)            _SYSCALL_NOERROR(x,y)           ;\
                                bnslr                           ;\
-                               b       PIC_PLT(_C_LABEL(__cerror))
+                               b       PIC_PLT(_C_LABEL(__cerror));\
+                               nop
 
 #define RSYSCALL_NOERROR(x)    PSEUDO_NOERROR(x,x)
 



Home | Main Index | Thread Index | Old Index