NetBSD-Bugs archive

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

port-powerpc/43010: ld error building powerpc64

>Number:         43010
>Category:       port-powerpc
>Synopsis:       ld error building powerpc64
>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
NetBSD 5.99.24 NetBSD 5.99.24 (GENERIC) #0: Sun Mar 
14 17:25:30 HKT 2010
When building a shared for macppc64 the following
error is emitted by ld:

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

*** Failed target:

Do a:

    MACHINE=macppc64 ./ distribution
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

Home | Main Index | Thread Index | Old Index