Index: contrib/gcc/config/rs6000/freebsd.h =================================================================== --- contrib/gcc/config/rs6000/freebsd.h (revision 216342) +++ contrib/gcc/config/rs6000/freebsd.h (working copy) @@ -37,6 +37,13 @@ #undef TARGET_AIX #define TARGET_AIX TARGET_64BIT +#ifdef HAVE_LD_NO_DOT_SYMS +/* New ABI uses a local sym for the function entry point. */ +extern int dot_symbols; +#undef DOT_SYMBOLS +#define DOT_SYMBOLS dot_symbols +#endif + #undef FBSD_TARGET_CPU_CPP_BUILTINS #define FBSD_TARGET_CPU_CPP_BUILTINS() \ do \ @@ -196,7 +203,7 @@ #ifdef __powerpc64__ #define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ asm (SECTION_OP "\n" \ -" bl ." #FUNC "\n" \ +" bl " #FUNC "\n" \ " nop\n" \ " .previous"); #endif Index: lib/libc/gen/_thread_init.c =================================================================== --- lib/libc/gen/_thread_init.c (revision 216342) +++ lib/libc/gen/_thread_init.c (working copy) @@ -32,7 +32,7 @@ void _thread_init_stub(void); __weak_reference(_thread_init_stub, _thread_init); -__weak_reference_data(_thread_autoinit_dummy_decl_stub, +__weak_reference(_thread_autoinit_dummy_decl_stub, _thread_autoinit_dummy_decl); int _thread_autoinit_dummy_decl_stub = 0; Index: lib/libc/powerpc64/SYS.h =================================================================== --- lib/libc/powerpc64/SYS.h (revision 216342) +++ lib/libc/powerpc64/SYS.h (working copy) @@ -45,7 +45,7 @@ 2: mflr %r0; \ std %r0,16(%r1); \ stdu %r1,-48(%r1); \ - bl PIC_PLT(CNAME(HIDENAME(cerror))); \ + bl CNAME(HIDENAME(cerror)); \ nop; \ addi %r1,%r1,48; \ ld %r0,16(%r1); \ @@ -56,10 +56,6 @@ .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(.,x)); \ - .set CNAME(__CONCAT(.,x)),CNAME(__CONCAT(.__sys_,x));\ - .weak CNAME(__CONCAT(._,x)); \ - .set CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\ _SYSCALL(x); \ bso 2b @@ -69,14 +65,12 @@ ENTRY(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(._,x)); \ - .set CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\ _SYSCALL(x); \ bnslr; \ mflr %r0; \ std %r0,16(%r1); \ stdu %r1,-48(%r1); \ - bl PIC_PLT(CNAME(HIDENAME(cerror))); \ + bl CNAME(HIDENAME(cerror)); \ nop; \ addi %r1,%r1,48; \ ld %r0,16(%r1); \ @@ -91,17 +85,13 @@ .set CNAME(x),CNAME(__CONCAT(__sys_,x)); \ .weak CNAME(__CONCAT(_,x)); \ .set CNAME(__CONCAT(_,x)),CNAME(__CONCAT(__sys_,x)); \ - .weak CNAME(__CONCAT(.,x)); \ - .set CNAME(__CONCAT(.,x)),CNAME(__CONCAT(.__sys_,x));\ - .weak CNAME(__CONCAT(._,x)); \ - .set CNAME(__CONCAT(._,x)),CNAME(__CONCAT(.__sys_,x));\ _SYSCALL(x); \ bnslr; \ \ mflr %r0; \ std %r0,16(%r1); \ stdu %r1,-48(%r1); \ - bl PIC_PLT(CNAME(HIDENAME(cerror))); \ + bl CNAME(HIDENAME(cerror)); \ nop; \ addi %r1,%r1,48; \ ld %r0,16(%r1); \ Index: lib/libc/powerpc64/gen/setjmp.S =================================================================== --- lib/libc/powerpc64/gen/setjmp.S (revision 216342) +++ lib/libc/powerpc64/gen/setjmp.S (working copy) @@ -95,8 +95,6 @@ .weak CNAME(longjmp) .set CNAME(longjmp),CNAME(__longjmp) - .weak CNAME(.longjmp) - .set CNAME(.longjmp),CNAME(.__longjmp) ENTRY(__longjmp) ld %r9,40 + 0*8(%r3) ld %r10,40 + 1*8(%r3) Index: lib/libc/powerpc64/gen/_ctx_start.S =================================================================== --- lib/libc/powerpc64/gen/_ctx_start.S (revision 216342) +++ lib/libc/powerpc64/gen/_ctx_start.S (working copy) @@ -38,10 +38,10 @@ blrl /* branch to start function */ mr %r3,%r15 /* pass pointer to ucontext as argument */ nop - bl PIC_PLT(CNAME(_ctx_done)) /* branch to ctxt completion func */ + bl CNAME(_ctx_done) /* branch to ctxt completion func */ /* * we should never return from the * above branch. */ nop - bl PIC_PLT(CNAME(abort)) /* abort */ + bl CNAME(abort) /* abort */ Index: lib/libc/powerpc64/sys/brk.S =================================================================== --- lib/libc/powerpc64/sys/brk.S (revision 216342) +++ lib/libc/powerpc64/sys/brk.S (working copy) @@ -63,7 +63,7 @@ mflr %r0 std %r0,16(%r1) stdu %r1,-48(%r1) - bl PIC_PLT(HIDENAME(cerror)) + bl HIDENAME(cerror) nop ld %r1,0(%r1) ld %r0,16(%r1) Index: lib/libc/powerpc64/sys/ptrace.S =================================================================== --- lib/libc/powerpc64/sys/ptrace.S (revision 216342) +++ lib/libc/powerpc64/sys/ptrace.S (working copy) @@ -32,14 +32,14 @@ ENTRY(ptrace) mflr %r0 - stdu %r1,-68(%r1) - std %r0,84(%r1) + std %r0,16(%r1) + stdu %r1,-80(%r1) stw %r3,48(%r1) stw %r4,52(%r1) std %r5,56(%r1) stw %r6,64(%r1) - bl PIC_PLT(CNAME(__error)) + bl CNAME(__error) nop li %r7,0 stw %r7,0(%r3) @@ -47,17 +47,17 @@ lwz %r3,48(%r1) lwz %r4,52(%r1) ld %r5,56(%r1) - ld %r0,84(%r1) lwz %r6,64(%r1) + ld %r1,0(%r1) + ld %r0,16(%r1) mtlr %r0 - ld %r1,0(%r1) li %r0,SYS_ptrace sc bso 1f blr 1: stdu %r1,-48(%r1) /* lr already saved */ - bl PIC_PLT(HIDENAME(cerror)) + bl HIDENAME(cerror) nop ld %r1,0(%r1) ld %r0,16(%r1) Index: lib/libc/powerpc64/sys/sbrk.S =================================================================== --- lib/libc/powerpc64/sys/sbrk.S (revision 216342) +++ lib/libc/powerpc64/sys/sbrk.S (working copy) @@ -58,7 +58,7 @@ mflr %r0 std %r0,16(%r1) stdu %r1,-48(%r1) - bl PIC_PLT(HIDENAME(cerror)) + bl HIDENAME(cerror) nop ld %r1,0(%r1) ld %r0,16(%r1) Index: lib/libc/powerpc64/sys/exect.S =================================================================== --- lib/libc/powerpc64/sys/exect.S (revision 216342) +++ lib/libc/powerpc64/sys/exect.S (working copy) @@ -39,7 +39,7 @@ mflr %r0 std %r0,16(%r1) stdu %r1,-48(%r1) - bl PIC_PLT(HIDENAME(cerror)) + bl HIDENAME(cerror) nop ld %r1,0(%r1) ld %r0,16(%r1) Index: lib/libc/powerpc64/sys/cerror.S =================================================================== --- lib/libc/powerpc64/sys/cerror.S (revision 216342) +++ lib/libc/powerpc64/sys/cerror.S (working copy) @@ -41,11 +41,11 @@ ENTRY(HIDENAME(cerror)) mflr %r0 std %r0,16(%r1) /* save lr */ - stdu %r1,-56(%r1) /* allocate new stack frame */ + stdu %r1,-64(%r1) /* allocate new stack frame */ std %r31,48(%r1) mr %r31,%r3 /* stash errval in callee-saved register */ - bl PIC_PLT(CNAME(__error)) + bl CNAME(__error) nop stw %r31,0(%r3) /* store errval into &errno */ Index: lib/libc/powerpc64/sys/pipe.S =================================================================== --- lib/libc/powerpc64/sys/pipe.S (revision 216342) +++ lib/libc/powerpc64/sys/pipe.S (working copy) @@ -43,7 +43,7 @@ mflr %r0 std %r0,16(%r1) stdu %r1,-48(%r1) - bl PIC_PLT(HIDENAME(cerror)) + bl HIDENAME(cerror) nop ld %r1,0(%r1) ld %r0,16(%r1) Index: lib/csu/powerpc64/crti.S =================================================================== --- lib/csu/powerpc64/crti.S (revision 216342) +++ lib/csu/powerpc64/crti.S (working copy) @@ -32,13 +32,12 @@ .section ".opd","aw" .align 3 _init: - .quad ._init,.TOC.@tocbase,0 + .quad .L._init,.TOC.@tocbase,0 .previous + .type _init,@function .align 4 - .global ._init - .type ._init,@function -._init: +.L._init: stdu 1,-48(1) mflr 0 std 0,64(1) @@ -49,13 +48,12 @@ .section ".opd","aw" .align 3 _fini: - .quad ._fini,.TOC.@tocbase,0 + .quad .L._fini,.TOC.@tocbase,0 .previous + .type _fini,@function .align 4 - .global ._fini - .type ._fini,@function -._fini: +.L._fini: stdu 1,-48(1) mflr 0 std 0,64(1) Index: libexec/rtld-elf/powerpc64/rtld_start.S =================================================================== --- libexec/rtld-elf/powerpc64/rtld_start.S (revision 216342) +++ libexec/rtld-elf/powerpc64/rtld_start.S (working copy) @@ -65,7 +65,7 @@ ld %r4,-0x8000(%r2) /* First TOC entry is TOC base */ subf %r4,%r4,%r2 /* Subtract from real TOC base to get base */ - bl .reloc_non_plt_self /* reloc_non_plt_self(&_DYNAMIC,base) */ + bl reloc_non_plt_self /* reloc_non_plt_self(&_DYNAMIC,base) */ nop /* @@ -80,7 +80,7 @@ addi %r4,%r1,80 /* &exit_proc on stack */ addi %r5,%r1,72 /* &obj_main on stack */ - bl ._rtld /* &_start = _rtld(sp, &exit_proc, &obj_main)*/ + bl _rtld /* &_start = _rtld(sp, &exit_proc, &obj_main)*/ nop ld %r2,8(%r3) ld %r11,16(%r3) @@ -119,7 +119,7 @@ mfcr %r0 std %r0,8(%r1) # save cr - stdu %r1,-48-9*8(%r1) # stack space for 8 regs + header + stdu %r1,-48-10*8(%r1) # stack space for 8 regs + header std %r3,48+0*8(%r1) # save r3-r31 std %r4,48+1*8(%r1) std %r5,48+2*8(%r1) @@ -132,7 +132,7 @@ ld %r3,0(%r11) ld %r4,8(%r11) - bl ._rtld_bind # target addr = _rtld_bind(obj, reloff) + bl _rtld_bind # target addr = _rtld_bind(obj, reloff) nop ld %r2,8(%r3) @@ -150,7 +150,7 @@ ld %r10,48+7*8(%r1) ld %r12,48+8*8(%r1) - addi %r1,%r1,48+9*8 # restore stack + addi %r1,%r1,48+10*8 # restore stack ld %r0,8(%r1) # restore cr mtcr %r0 Index: sys/powerpc/include/profile.h =================================================================== --- sys/powerpc/include/profile.h (revision 216342) +++ sys/powerpc/include/profile.h (working copy) @@ -83,13 +83,12 @@ " .section \".opd\",\"aw\" \n" \ " .align 3 \n" \ "_mcount: \n" \ - " .quad ._mcount,.TOC.@tocbase,0 \n" \ + " .quad .L._mcount,.TOC.@tocbase,0\n" \ " .previous \n" \ + " .type _mcount,@function \n" \ " .align 4 \n" \ - " .globl ._mcount \n" \ - " .type ._mcount,@function \n" \ - "._mcount: \n" \ - " stdu %r1,-(288+120)(%r1) \n" \ + ".L._mcount: \n" \ + " stdu %r1,-(288+128)(%r1) \n" \ " std %r3,48(%r1) \n" \ " std %r4,56(%r1) \n" \ " std %r5,64(%r1) \n" \ @@ -103,7 +102,7 @@ " ld %r3,0(%r1) \n" \ " ld %r3,0(%r3) \n" \ " ld %r3,16(%r3) \n" \ - " bl .__mcount \n" \ + " bl __mcount \n" \ " nop \n" \ " ld %r4,112(%r1) \n" \ " mtlr %r4 \n" \ @@ -115,7 +114,7 @@ " ld %r8,88(%r1) \n" \ " ld %r9,96(%r1) \n" \ " ld %r10,104(%r1) \n" \ - " addi %r1,%r1,(288+120) \n" \ + " addi %r1,%r1,(288+128) \n" \ " blr \n"); #else Index: sys/powerpc/include/asm.h =================================================================== --- sys/powerpc/include/asm.h (revision 216342) +++ sys/powerpc/include/asm.h (working copy) @@ -37,7 +37,7 @@ #include -#ifdef PIC +#if defined(PIC) && !defined(__powerpc64__) #define PIC_PROLOGUE XXX #define PIC_EPILOGUE XXX #define PIC_PLT(x) x@plt @@ -53,11 +53,6 @@ #define PIC_GOT(x) x #endif -#ifdef __powerpc64__ -#undef PIC_PLT -#define PIC_PLT(x) __CONCAT(.,x) -#endif - #define CNAME(csym) csym #define ASMNAME(asmsym) asmsym #ifdef __powerpc64__ @@ -73,8 +68,8 @@ #define _ENTRY(x) \ .text; .align 2; .globl x; .section ".opd","aw"; \ .align 3; x: \ - .quad .x,.TOC.@tocbase,0; .previous; \ - .align 4; .globl .x; .type .x,@function; .x: + .quad .L.x,.TOC.@tocbase,0; .size x,24; .previous; \ + .align 4; .type x,@function; .L.x: #else #define _ENTRY(x) \ .text; .align 4; .globl x; .type x,@function; x: Index: sys/powerpc/aim/locore64.S =================================================================== --- sys/powerpc/aim/locore64.S (revision 216342) +++ sys/powerpc/aim/locore64.S (working copy) @@ -174,7 +174,7 @@ insrdi 9,8,1,0 mtmsrd 9 - bl .OF_initial_setup + bl OF_initial_setup nop lis 4,end@ha @@ -188,14 +188,14 @@ mr 6,20 mr 7,21 - bl .powerpc_init + bl powerpc_init nop mr %r1, %r3 li %r3, 0 std %r3, 0(%r1) - bl .mi_startup + bl mi_startup nop - b .OF_exit + b OF_exit nop /* Index: sys/powerpc/aim/swtch64.S =================================================================== --- sys/powerpc/aim/swtch64.S (revision 216342) +++ sys/powerpc/aim/swtch64.S (working copy) @@ -121,7 +121,7 @@ /* Save FPU context if needed */ andi. %r7, %r7, PCB_FPU beq .L1 - bl .save_fpu + bl save_fpu nop .L1: @@ -130,12 +130,12 @@ /* Save Altivec context if needed */ andi. %r7, %r7, PCB_VEC beq .L2 - bl .save_vec + bl save_vec nop .L2: mr %r3,%r14 /* restore old thread ptr */ - bl .pmap_deactivate /* Deactivate the current pmap */ + bl pmap_deactivate /* Deactivate the current pmap */ nop addi %r1,%r1,48 @@ -161,7 +161,7 @@ stdu %r1,-48(%r1) mr %r3,%r15 /* Get new thread ptr */ - bl .pmap_activate /* Activate the new address space */ + bl pmap_activate /* Activate the new address space */ nop lwz %r6, PCB_FLAGS(%r17) @@ -169,7 +169,7 @@ andi. %r6, %r6, PCB_FPU beq .L3 mr %r3,%r15 /* Pass curthread to enable_fpu */ - bl .enable_fpu + bl enable_fpu nop .L3: @@ -178,7 +178,7 @@ andi. %r6, %r6, PCB_VEC beq .L4 mr %r3,%r15 /* Pass curthread to enable_vec */ - bl .enable_vec + bl enable_vec nop /* thread to restore is in r3 */ @@ -276,7 +276,7 @@ ld %r5,CF_ARG1(%r1) stdu %r1,-48(%r1) - bl .fork_exit + bl fork_exit nop addi %r1,%r1,48+CF_SIZE-FSP /* Allow 8 bytes in front of trapframe to simulate FRAME_SETUP Index: sys/powerpc/aim/trap_subr64.S =================================================================== --- sys/powerpc/aim/trap_subr64.S (revision 216342) +++ sys/powerpc/aim/trap_subr64.S (working copy) @@ -295,14 +295,14 @@ lis %r3,tocbase@ha ld %r2,tocbase@l(%r3) lis %r3,1@l - bl CNAME(.cpudep_ap_early_bootstrap) /* Set PCPU */ + bl CNAME(cpudep_ap_early_bootstrap) /* Set PCPU */ nop - bl CNAME(.pmap_cpu_bootstrap) /* Turn on virtual memory */ + bl CNAME(pmap_cpu_bootstrap) /* Turn on virtual memory */ nop - bl CNAME(.cpudep_ap_bootstrap) /* Set up PCPU and stack */ + bl CNAME(cpudep_ap_bootstrap) /* Set up PCPU and stack */ nop mr %r1,%r3 /* Use new stack */ - bl CNAME(.machdep_ap_bootstrap) /* And away! */ + bl CNAME(machdep_ap_bootstrap) /* And away! */ nop /* Should not be reached */ @@ -510,7 +510,7 @@ lis %r3,tocbase@ha ld %r2,tocbase@l(%r3) addi %r3,%r1,48 - bl CNAME(.powerpc_interrupt) + bl CNAME(powerpc_interrupt) nop .globl CNAME(trapexit) /* backtrace code sentinel */ @@ -538,7 +538,7 @@ lis %r3,tocbase@ha ld %r2,tocbase@l(%r3) addi %r3,%r1,48 - bl CNAME(.ast) + bl CNAME(ast) nop .globl CNAME(asttrapexit) /* backtrace code sentinel #2 */ CNAME(asttrapexit): @@ -587,7 +587,7 @@ lis %r3,tocbase@ha ld %r2,tocbase@l(%r3) addi %r3,%r1,48 - bl CNAME(.db_trap_glue) + bl CNAME(db_trap_glue) nop or. %r3,%r3,%r3 bne dbleave Index: sys/kern/link_elf.c =================================================================== --- sys/kern/link_elf.c (revision 216342) +++ sys/kern/link_elf.c (working copy) @@ -1283,6 +1283,11 @@ if (es->st_name == 0) continue; st_value = es->st_value + (uintptr_t) (void *) ef->address; + #ifdef __powerpc64__ + /* Disentangle function descriptors */ + if (ELF_ST_TYPE(symp->st_info) == STT_FUNC && es->st_size != 0) + st_value = *(uint64_t *)st_value; + #endif if (off >= st_value) { if (off - st_value < diff) { diff = off - st_value; Index: sys/sys/cdefs.h =================================================================== --- sys/sys/cdefs.h (revision 216342) +++ sys/sys/cdefs.h (working copy) @@ -364,20 +364,9 @@ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) #endif #ifdef __STDC__ -#ifdef __powerpc64__ #define __weak_reference(sym,alias) \ __asm__(".weak " #alias); \ - __asm__(".equ " #alias ", " #sym); \ - __asm__(".weak ." #alias); \ - __asm__(".equ ." #alias ", ." #sym) -#else -#define __weak_reference(sym,alias) \ - __asm__(".weak " #alias); \ __asm__(".equ " #alias ", " #sym) -#endif -#define __weak_reference_data(sym,alias)\ - __asm__(".weak " #alias); \ - __asm__(".equ " #alias ", " #sym) #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning." #sym); \ __asm__(".asciz \"" msg "\""); \