From 233c504cd940d9802226b6a3a092368b86978f5e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 4 May 2011 10:01:24 +0200 Subject: */crt?.S: remove .size directives sed -i -e '/\.size[[:space:]]/d' $(grep -l "\.size" libc/sysdeps/linux/*/crt*.[sSc]) Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/crti.S | 1 - libc/sysdeps/linux/arm/crtn.S | 2 -- libc/sysdeps/linux/avr32/crt1.S | 1 - libc/sysdeps/linux/avr32/crtn.S | 2 -- libc/sysdeps/linux/cris/crt1.S | 2 -- libc/sysdeps/linux/cris/crtn.S | 2 -- libc/sysdeps/linux/frv/crt0.S | 1 - libc/sysdeps/linux/frv/crtn.S | 2 -- libc/sysdeps/linux/h8300/crtn.S | 2 -- libc/sysdeps/linux/i386/crt1.S | 1 - libc/sysdeps/linux/i386/crtn.S | 2 -- libc/sysdeps/linux/microblaze/crtn.S | 2 -- libc/sysdeps/linux/mips/crt1.S | 1 - libc/sysdeps/linux/powerpc/crt1.S | 1 - libc/sysdeps/linux/powerpc/crtn.S | 2 -- libc/sysdeps/linux/sh/crt1.S | 1 - libc/sysdeps/linux/sh/crtn.S | 2 -- libc/sysdeps/linux/sh64/crtn.S | 2 -- libc/sysdeps/linux/sparc/crt1.S | 1 - libc/sysdeps/linux/sparc/crtn.S | 2 -- libc/sysdeps/linux/v850/crtn.S | 2 -- libc/sysdeps/linux/vax/crtn.S | 2 -- libc/sysdeps/linux/x86_64/crt1.S | 1 - libc/sysdeps/linux/x86_64/crtn.S | 2 -- 24 files changed, 39 deletions(-) diff --git a/libc/sysdeps/linux/arm/crti.S b/libc/sysdeps/linux/arm/crti.S index e335b7140..a2d0c03f2 100644 --- a/libc/sysdeps/linux/arm/crti.S +++ b/libc/sysdeps/linux/arm/crti.S @@ -63,7 +63,6 @@ _fini: _call_via_\register: bx \register nop - .size _call_via_\register, . - _call_via_\register .endm @ and calls for the 15 general purpose registers (2 bytes each). diff --git a/libc/sysdeps/linux/arm/crtn.S b/libc/sysdeps/linux/arm/crtn.S index de01b38dc..a4752c186 100644 --- a/libc/sysdeps/linux/arm/crtn.S +++ b/libc/sysdeps/linux/arm/crtn.S @@ -15,7 +15,6 @@ .arm ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc} #endif - .size _init, .-_init .section .fini .global _fini @@ -29,7 +28,6 @@ .arm ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc} #endif - .size _fini, .-_fini @ In fact this is modified to 3.4.4 .ident "GCC: (GNU) 3.3.2 20031005 (Debian prerelease)" diff --git a/libc/sysdeps/linux/avr32/crt1.S b/libc/sysdeps/linux/avr32/crt1.S index ca1fa7a4c..e2a82a528 100644 --- a/libc/sysdeps/linux/avr32/crt1.S +++ b/libc/sysdeps/linux/avr32/crt1.S @@ -80,7 +80,6 @@ __main_addr: ___uClibc_main_addr: .long __uClibc_main #endif - .size _start, . - _start /* * The LSB says we need this. diff --git a/libc/sysdeps/linux/avr32/crtn.S b/libc/sysdeps/linux/avr32/crtn.S index f7d104070..c37f7d201 100644 --- a/libc/sysdeps/linux/avr32/crtn.S +++ b/libc/sysdeps/linux/avr32/crtn.S @@ -4,11 +4,9 @@ .global _init .type _init, @function ldm sp++, r6, pc - .size _init, . - _init .section .fini .align 2 .global _fini .type _fini, @function ldm sp++, r6, pc - .size _fini, . - _fini diff --git a/libc/sysdeps/linux/cris/crt1.S b/libc/sysdeps/linux/cris/crt1.S index b07e36b51..1525a2b76 100644 --- a/libc/sysdeps/linux/cris/crt1.S +++ b/libc/sysdeps/linux/cris/crt1.S @@ -9,7 +9,6 @@ .global __data_start .align 2 .type __data_start, @object - .size __data_start, 4 __data_start: .dword 0 @@ -53,4 +52,3 @@ _start: /* Leave control to the libc */ jsr __uClibc_main nop - .size _start, .-_start diff --git a/libc/sysdeps/linux/cris/crtn.S b/libc/sysdeps/linux/cris/crtn.S index 951ae5449..7b2dce17c 100644 --- a/libc/sysdeps/linux/cris/crtn.S +++ b/libc/sysdeps/linux/cris/crtn.S @@ -9,7 +9,6 @@ move.d [$sp+],$r1 Ret nop - .size _init, .-_init .section .fini .align 1 @@ -20,4 +19,3 @@ move.d [$sp+],$r1 Ret nop - .size _fini, .-_fini diff --git a/libc/sysdeps/linux/frv/crt0.S b/libc/sysdeps/linux/frv/crt0.S index a1d07bb69..a40b67e80 100644 --- a/libc/sysdeps/linux/frv/crt0.S +++ b/libc/sysdeps/linux/frv/crt0.S @@ -113,7 +113,6 @@ _start: /* Crash if somehow `exit' returns anyways. */ jmpl @(gr0,gr0) -.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/frv/crtn.S b/libc/sysdeps/linux/frv/crtn.S index 1d58c0207..bd11901ad 100644 --- a/libc/sysdeps/linux/frv/crtn.S +++ b/libc/sysdeps/linux/frv/crtn.S @@ -32,7 +32,6 @@ Cambridge, MA 02139, USA. */ ld @(sp,gr0), fp addi sp,#16,sp jmpl @(gr5,gr0) - .size _init, .-_init .section .fini,"x" .globl _fini @@ -41,4 +40,3 @@ Cambridge, MA 02139, USA. */ ld @(sp,gr0), fp addi sp,#16,sp jmpl @(gr5,gr0) - .size _fini, .-_fini diff --git a/libc/sysdeps/linux/h8300/crtn.S b/libc/sysdeps/linux/h8300/crtn.S index 89e321868..8f9fa1fac 100644 --- a/libc/sysdeps/linux/h8300/crtn.S +++ b/libc/sysdeps/linux/h8300/crtn.S @@ -14,7 +14,6 @@ ; #NO_APP mov.l @er7+,er6 rts - .size __init, .-__init ; #APP .section .fini @@ -24,7 +23,6 @@ ; #NO_APP mov.l @er7+,er6 rts - .size __fini, .-__fini ; #APP .end diff --git a/libc/sysdeps/linux/i386/crt1.S b/libc/sysdeps/linux/i386/crt1.S index a133cb9e0..7dfeaf1a5 100644 --- a/libc/sysdeps/linux/i386/crt1.S +++ b/libc/sysdeps/linux/i386/crt1.S @@ -129,7 +129,6 @@ _start: #endif hlt /* Crash if somehow `exit' does return. */ -.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/i386/crtn.S b/libc/sysdeps/linux/i386/crtn.S index 191250487..34d5b38e2 100644 --- a/libc/sysdeps/linux/i386/crtn.S +++ b/libc/sysdeps/linux/i386/crtn.S @@ -6,7 +6,6 @@ popl %ebx popl %ebp ret -.size _init,.-_init @@ -16,7 +15,6 @@ popl %ebx popl %ebp ret -.size _fini,.-_fini diff --git a/libc/sysdeps/linux/microblaze/crtn.S b/libc/sysdeps/linux/microblaze/crtn.S index da8c920ef..6f4ef60d3 100644 --- a/libc/sysdeps/linux/microblaze/crtn.S +++ b/libc/sysdeps/linux/microblaze/crtn.S @@ -26,7 +26,6 @@ .end _init $Lfe2: - .size _init,$Lfe2-_init .section .fini .align 2 @@ -40,6 +39,5 @@ $Lfe2: .end _fini $Lfe3: - .size _fini,$Lfe3-_fini /*@TRAILER_BEGINS*/ diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S index 6a804125e..90f69e9c8 100644 --- a/libc/sysdeps/linux/mips/crt1.S +++ b/libc/sysdeps/linux/mips/crt1.S @@ -118,7 +118,6 @@ __start: hlt: /* Crash if somehow `__uClibc_main' returns anyway. */ b hlt -.size __start,.-__start .end __start /* Define a symbol for the first piece of initialized data. */ diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S index 4f1494a8f..de3aa0814 100644 --- a/libc/sysdeps/linux/powerpc/crt1.S +++ b/libc/sysdeps/linux/powerpc/crt1.S @@ -95,7 +95,6 @@ _start: b __uClibc_main #endif -.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/powerpc/crtn.S b/libc/sysdeps/linux/powerpc/crtn.S index ba6d0e0c8..938367caa 100644 --- a/libc/sysdeps/linux/powerpc/crtn.S +++ b/libc/sysdeps/linux/powerpc/crtn.S @@ -9,7 +9,6 @@ addi 1,1,32 mtlr 0 blr - .size _init, .-_init .section .fini .align 2 @@ -20,4 +19,3 @@ addi 1,1,32 mtlr 0 blr - .size _fini, .-_fini diff --git a/libc/sysdeps/linux/sh/crt1.S b/libc/sysdeps/linux/sh/crt1.S index 9707f8316..277c55e69 100644 --- a/libc/sysdeps/linux/sh/crt1.S +++ b/libc/sysdeps/linux/sh/crt1.S @@ -104,7 +104,6 @@ _start: nop #endif - .size _start,.-_start .align 2 #ifdef __PIC__ diff --git a/libc/sysdeps/linux/sh/crtn.S b/libc/sysdeps/linux/sh/crtn.S index 437f8ebc3..e8be7e51f 100644 --- a/libc/sysdeps/linux/sh/crtn.S +++ b/libc/sysdeps/linux/sh/crtn.S @@ -15,7 +15,6 @@ .align 2 .L6: .L7: - .size _init, .-_init .section .fini .hidden _fini @@ -31,6 +30,5 @@ .align 2 .L11: .L12: - .size _fini, .-_fini .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/sh64/crtn.S b/libc/sysdeps/linux/sh64/crtn.S index eb6479a56..501fe9167 100644 --- a/libc/sysdeps/linux/sh64/crtn.S +++ b/libc/sysdeps/linux/sh64/crtn.S @@ -14,7 +14,6 @@ ptabs r18, tr0 addi.l r15, 16, r15 blink tr0, r63 - .size _init, .-_init .section .fini .hidden _fini @@ -28,6 +27,5 @@ ptabs r18, tr0 addi.l r15, 16, r15 blink tr0, r63 - .size _fini, .-_fini .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/sparc/crt1.S b/libc/sysdeps/linux/sparc/crt1.S index f33a714ef..78aaaccce 100644 --- a/libc/sysdeps/linux/sparc/crt1.S +++ b/libc/sysdeps/linux/sparc/crt1.S @@ -123,7 +123,6 @@ _start: illtrap 0 #endif -.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/sparc/crtn.S b/libc/sysdeps/linux/sparc/crtn.S index 24b4bf43c..d64ffd020 100644 --- a/libc/sysdeps/linux/sparc/crtn.S +++ b/libc/sysdeps/linux/sparc/crtn.S @@ -7,7 +7,6 @@ .proc 020 ret restore - .size _init, .-_init .section .fini .align 4 @@ -16,4 +15,3 @@ .proc 020 ret restore - .size _fini, .-_fini diff --git a/libc/sysdeps/linux/v850/crtn.S b/libc/sysdeps/linux/v850/crtn.S index aecb55737..6bb0b39ac 100644 --- a/libc/sysdeps/linux/v850/crtn.S +++ b/libc/sysdeps/linux/v850/crtn.S @@ -8,7 +8,6 @@ .type __init, @function #NO_APP jr __return_r31 - .size __init, .-__init #APP .section .fini @@ -18,7 +17,6 @@ .type __fini, @function #NO_APP jr __return_r31 - .size __fini, .-__fini #APP .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/vax/crtn.S b/libc/sysdeps/linux/vax/crtn.S index 6ca5c4fcd..1153fd50b 100644 --- a/libc/sysdeps/linux/vax/crtn.S +++ b/libc/sysdeps/linux/vax/crtn.S @@ -9,7 +9,6 @@ __gnu_compiled_c: .type _init,@function ret .Lfe2: - .size _init,.Lfe2-_init .section .fini .align 1 @@ -17,5 +16,4 @@ __gnu_compiled_c: .type _fini,@function ret .Lfe3: - .size _fini,.Lfe3-_fini .ident "GCC: (GNU) 2.95.2 19991024 (release) (Linux/VAX CVS)" diff --git a/libc/sysdeps/linux/x86_64/crt1.S b/libc/sysdeps/linux/x86_64/crt1.S index f6c1eb1e7..a21be7583 100644 --- a/libc/sysdeps/linux/x86_64/crt1.S +++ b/libc/sysdeps/linux/x86_64/crt1.S @@ -129,7 +129,6 @@ _start: #endif hlt /* Crash if somehow `exit' does return. */ -.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/x86_64/crtn.S b/libc/sysdeps/linux/x86_64/crtn.S index 5b110d967..9804e0f76 100644 --- a/libc/sysdeps/linux/x86_64/crtn.S +++ b/libc/sysdeps/linux/x86_64/crtn.S @@ -7,7 +7,6 @@ .type _init, %function addq $8, %rsp ret -.size _init,.-_init .section .fini @@ -15,4 +14,3 @@ .type _fini, %function addq $8, %rsp ret -.size _fini, .-_fini -- cgit v1.2.3 From 07464c3e7156f4c8dfcac673c74f19b700b1b3b5 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 5 May 2011 09:19:16 +0200 Subject: Revert "*/crt?.S: remove .size directives" Removing them generally was not a good idea This reverts commit 233c504cd940d9802226b6a3a092368b86978f5e. --- libc/sysdeps/linux/arm/crti.S | 1 + libc/sysdeps/linux/arm/crtn.S | 2 ++ libc/sysdeps/linux/avr32/crt1.S | 1 + libc/sysdeps/linux/avr32/crtn.S | 2 ++ libc/sysdeps/linux/cris/crt1.S | 2 ++ libc/sysdeps/linux/cris/crtn.S | 2 ++ libc/sysdeps/linux/frv/crt0.S | 1 + libc/sysdeps/linux/frv/crtn.S | 2 ++ libc/sysdeps/linux/h8300/crtn.S | 2 ++ libc/sysdeps/linux/i386/crt1.S | 1 + libc/sysdeps/linux/i386/crtn.S | 2 ++ libc/sysdeps/linux/microblaze/crtn.S | 2 ++ libc/sysdeps/linux/mips/crt1.S | 1 + libc/sysdeps/linux/powerpc/crt1.S | 1 + libc/sysdeps/linux/powerpc/crtn.S | 2 ++ libc/sysdeps/linux/sh/crt1.S | 1 + libc/sysdeps/linux/sh/crtn.S | 2 ++ libc/sysdeps/linux/sh64/crtn.S | 2 ++ libc/sysdeps/linux/sparc/crt1.S | 1 + libc/sysdeps/linux/sparc/crtn.S | 2 ++ libc/sysdeps/linux/v850/crtn.S | 2 ++ libc/sysdeps/linux/vax/crtn.S | 2 ++ libc/sysdeps/linux/x86_64/crt1.S | 1 + libc/sysdeps/linux/x86_64/crtn.S | 2 ++ 24 files changed, 39 insertions(+) diff --git a/libc/sysdeps/linux/arm/crti.S b/libc/sysdeps/linux/arm/crti.S index a2d0c03f2..e335b7140 100644 --- a/libc/sysdeps/linux/arm/crti.S +++ b/libc/sysdeps/linux/arm/crti.S @@ -63,6 +63,7 @@ _fini: _call_via_\register: bx \register nop + .size _call_via_\register, . - _call_via_\register .endm @ and calls for the 15 general purpose registers (2 bytes each). diff --git a/libc/sysdeps/linux/arm/crtn.S b/libc/sysdeps/linux/arm/crtn.S index a4752c186..de01b38dc 100644 --- a/libc/sysdeps/linux/arm/crtn.S +++ b/libc/sysdeps/linux/arm/crtn.S @@ -15,6 +15,7 @@ .arm ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc} #endif + .size _init, .-_init .section .fini .global _fini @@ -28,6 +29,7 @@ .arm ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc} #endif + .size _fini, .-_fini @ In fact this is modified to 3.4.4 .ident "GCC: (GNU) 3.3.2 20031005 (Debian prerelease)" diff --git a/libc/sysdeps/linux/avr32/crt1.S b/libc/sysdeps/linux/avr32/crt1.S index e2a82a528..ca1fa7a4c 100644 --- a/libc/sysdeps/linux/avr32/crt1.S +++ b/libc/sysdeps/linux/avr32/crt1.S @@ -80,6 +80,7 @@ __main_addr: ___uClibc_main_addr: .long __uClibc_main #endif + .size _start, . - _start /* * The LSB says we need this. diff --git a/libc/sysdeps/linux/avr32/crtn.S b/libc/sysdeps/linux/avr32/crtn.S index c37f7d201..f7d104070 100644 --- a/libc/sysdeps/linux/avr32/crtn.S +++ b/libc/sysdeps/linux/avr32/crtn.S @@ -4,9 +4,11 @@ .global _init .type _init, @function ldm sp++, r6, pc + .size _init, . - _init .section .fini .align 2 .global _fini .type _fini, @function ldm sp++, r6, pc + .size _fini, . - _fini diff --git a/libc/sysdeps/linux/cris/crt1.S b/libc/sysdeps/linux/cris/crt1.S index 1525a2b76..b07e36b51 100644 --- a/libc/sysdeps/linux/cris/crt1.S +++ b/libc/sysdeps/linux/cris/crt1.S @@ -9,6 +9,7 @@ .global __data_start .align 2 .type __data_start, @object + .size __data_start, 4 __data_start: .dword 0 @@ -52,3 +53,4 @@ _start: /* Leave control to the libc */ jsr __uClibc_main nop + .size _start, .-_start diff --git a/libc/sysdeps/linux/cris/crtn.S b/libc/sysdeps/linux/cris/crtn.S index 7b2dce17c..951ae5449 100644 --- a/libc/sysdeps/linux/cris/crtn.S +++ b/libc/sysdeps/linux/cris/crtn.S @@ -9,6 +9,7 @@ move.d [$sp+],$r1 Ret nop + .size _init, .-_init .section .fini .align 1 @@ -19,3 +20,4 @@ move.d [$sp+],$r1 Ret nop + .size _fini, .-_fini diff --git a/libc/sysdeps/linux/frv/crt0.S b/libc/sysdeps/linux/frv/crt0.S index a40b67e80..a1d07bb69 100644 --- a/libc/sysdeps/linux/frv/crt0.S +++ b/libc/sysdeps/linux/frv/crt0.S @@ -113,6 +113,7 @@ _start: /* Crash if somehow `exit' returns anyways. */ jmpl @(gr0,gr0) +.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/frv/crtn.S b/libc/sysdeps/linux/frv/crtn.S index bd11901ad..1d58c0207 100644 --- a/libc/sysdeps/linux/frv/crtn.S +++ b/libc/sysdeps/linux/frv/crtn.S @@ -32,6 +32,7 @@ Cambridge, MA 02139, USA. */ ld @(sp,gr0), fp addi sp,#16,sp jmpl @(gr5,gr0) + .size _init, .-_init .section .fini,"x" .globl _fini @@ -40,3 +41,4 @@ Cambridge, MA 02139, USA. */ ld @(sp,gr0), fp addi sp,#16,sp jmpl @(gr5,gr0) + .size _fini, .-_fini diff --git a/libc/sysdeps/linux/h8300/crtn.S b/libc/sysdeps/linux/h8300/crtn.S index 8f9fa1fac..89e321868 100644 --- a/libc/sysdeps/linux/h8300/crtn.S +++ b/libc/sysdeps/linux/h8300/crtn.S @@ -14,6 +14,7 @@ ; #NO_APP mov.l @er7+,er6 rts + .size __init, .-__init ; #APP .section .fini @@ -23,6 +24,7 @@ ; #NO_APP mov.l @er7+,er6 rts + .size __fini, .-__fini ; #APP .end diff --git a/libc/sysdeps/linux/i386/crt1.S b/libc/sysdeps/linux/i386/crt1.S index 7dfeaf1a5..a133cb9e0 100644 --- a/libc/sysdeps/linux/i386/crt1.S +++ b/libc/sysdeps/linux/i386/crt1.S @@ -129,6 +129,7 @@ _start: #endif hlt /* Crash if somehow `exit' does return. */ +.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/i386/crtn.S b/libc/sysdeps/linux/i386/crtn.S index 34d5b38e2..191250487 100644 --- a/libc/sysdeps/linux/i386/crtn.S +++ b/libc/sysdeps/linux/i386/crtn.S @@ -6,6 +6,7 @@ popl %ebx popl %ebp ret +.size _init,.-_init @@ -15,6 +16,7 @@ popl %ebx popl %ebp ret +.size _fini,.-_fini diff --git a/libc/sysdeps/linux/microblaze/crtn.S b/libc/sysdeps/linux/microblaze/crtn.S index 6f4ef60d3..da8c920ef 100644 --- a/libc/sysdeps/linux/microblaze/crtn.S +++ b/libc/sysdeps/linux/microblaze/crtn.S @@ -26,6 +26,7 @@ .end _init $Lfe2: + .size _init,$Lfe2-_init .section .fini .align 2 @@ -39,5 +40,6 @@ $Lfe2: .end _fini $Lfe3: + .size _fini,$Lfe3-_fini /*@TRAILER_BEGINS*/ diff --git a/libc/sysdeps/linux/mips/crt1.S b/libc/sysdeps/linux/mips/crt1.S index 90f69e9c8..6a804125e 100644 --- a/libc/sysdeps/linux/mips/crt1.S +++ b/libc/sysdeps/linux/mips/crt1.S @@ -118,6 +118,7 @@ __start: hlt: /* Crash if somehow `__uClibc_main' returns anyway. */ b hlt +.size __start,.-__start .end __start /* Define a symbol for the first piece of initialized data. */ diff --git a/libc/sysdeps/linux/powerpc/crt1.S b/libc/sysdeps/linux/powerpc/crt1.S index de3aa0814..4f1494a8f 100644 --- a/libc/sysdeps/linux/powerpc/crt1.S +++ b/libc/sysdeps/linux/powerpc/crt1.S @@ -95,6 +95,7 @@ _start: b __uClibc_main #endif +.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/powerpc/crtn.S b/libc/sysdeps/linux/powerpc/crtn.S index 938367caa..ba6d0e0c8 100644 --- a/libc/sysdeps/linux/powerpc/crtn.S +++ b/libc/sysdeps/linux/powerpc/crtn.S @@ -9,6 +9,7 @@ addi 1,1,32 mtlr 0 blr + .size _init, .-_init .section .fini .align 2 @@ -19,3 +20,4 @@ addi 1,1,32 mtlr 0 blr + .size _fini, .-_fini diff --git a/libc/sysdeps/linux/sh/crt1.S b/libc/sysdeps/linux/sh/crt1.S index 277c55e69..9707f8316 100644 --- a/libc/sysdeps/linux/sh/crt1.S +++ b/libc/sysdeps/linux/sh/crt1.S @@ -104,6 +104,7 @@ _start: nop #endif + .size _start,.-_start .align 2 #ifdef __PIC__ diff --git a/libc/sysdeps/linux/sh/crtn.S b/libc/sysdeps/linux/sh/crtn.S index e8be7e51f..437f8ebc3 100644 --- a/libc/sysdeps/linux/sh/crtn.S +++ b/libc/sysdeps/linux/sh/crtn.S @@ -15,6 +15,7 @@ .align 2 .L6: .L7: + .size _init, .-_init .section .fini .hidden _fini @@ -30,5 +31,6 @@ .align 2 .L11: .L12: + .size _fini, .-_fini .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/sh64/crtn.S b/libc/sysdeps/linux/sh64/crtn.S index 501fe9167..eb6479a56 100644 --- a/libc/sysdeps/linux/sh64/crtn.S +++ b/libc/sysdeps/linux/sh64/crtn.S @@ -14,6 +14,7 @@ ptabs r18, tr0 addi.l r15, 16, r15 blink tr0, r63 + .size _init, .-_init .section .fini .hidden _fini @@ -27,5 +28,6 @@ ptabs r18, tr0 addi.l r15, 16, r15 blink tr0, r63 + .size _fini, .-_fini .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/sparc/crt1.S b/libc/sysdeps/linux/sparc/crt1.S index 78aaaccce..f33a714ef 100644 --- a/libc/sysdeps/linux/sparc/crt1.S +++ b/libc/sysdeps/linux/sparc/crt1.S @@ -123,6 +123,7 @@ _start: illtrap 0 #endif +.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/sparc/crtn.S b/libc/sysdeps/linux/sparc/crtn.S index d64ffd020..24b4bf43c 100644 --- a/libc/sysdeps/linux/sparc/crtn.S +++ b/libc/sysdeps/linux/sparc/crtn.S @@ -7,6 +7,7 @@ .proc 020 ret restore + .size _init, .-_init .section .fini .align 4 @@ -15,3 +16,4 @@ .proc 020 ret restore + .size _fini, .-_fini diff --git a/libc/sysdeps/linux/v850/crtn.S b/libc/sysdeps/linux/v850/crtn.S index 6bb0b39ac..aecb55737 100644 --- a/libc/sysdeps/linux/v850/crtn.S +++ b/libc/sysdeps/linux/v850/crtn.S @@ -8,6 +8,7 @@ .type __init, @function #NO_APP jr __return_r31 + .size __init, .-__init #APP .section .fini @@ -17,6 +18,7 @@ .type __fini, @function #NO_APP jr __return_r31 + .size __fini, .-__fini #APP .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/vax/crtn.S b/libc/sysdeps/linux/vax/crtn.S index 1153fd50b..6ca5c4fcd 100644 --- a/libc/sysdeps/linux/vax/crtn.S +++ b/libc/sysdeps/linux/vax/crtn.S @@ -9,6 +9,7 @@ __gnu_compiled_c: .type _init,@function ret .Lfe2: + .size _init,.Lfe2-_init .section .fini .align 1 @@ -16,4 +17,5 @@ __gnu_compiled_c: .type _fini,@function ret .Lfe3: + .size _fini,.Lfe3-_fini .ident "GCC: (GNU) 2.95.2 19991024 (release) (Linux/VAX CVS)" diff --git a/libc/sysdeps/linux/x86_64/crt1.S b/libc/sysdeps/linux/x86_64/crt1.S index a21be7583..f6c1eb1e7 100644 --- a/libc/sysdeps/linux/x86_64/crt1.S +++ b/libc/sysdeps/linux/x86_64/crt1.S @@ -129,6 +129,7 @@ _start: #endif hlt /* Crash if somehow `exit' does return. */ +.size _start,.-_start /* Define a symbol for the first piece of initialized data. */ .data diff --git a/libc/sysdeps/linux/x86_64/crtn.S b/libc/sysdeps/linux/x86_64/crtn.S index 9804e0f76..5b110d967 100644 --- a/libc/sysdeps/linux/x86_64/crtn.S +++ b/libc/sysdeps/linux/x86_64/crtn.S @@ -7,6 +7,7 @@ .type _init, %function addq $8, %rsp ret +.size _init,.-_init .section .fini @@ -14,3 +15,4 @@ .type _fini, %function addq $8, %rsp ret +.size _fini, .-_fini -- cgit v1.2.3 From 2297e6e1e075070d6e62dfe7cccfab600de12870 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 5 May 2011 09:27:15 +0200 Subject: x86_64: fix .size of _init/_fini binutils-2.21 barf on .size that do not evaluate to const, so use the section size and not a function that is not visible here. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/x86_64/crtn.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/x86_64/crtn.S b/libc/sysdeps/linux/x86_64/crtn.S index 5b110d967..ec40c21d2 100644 --- a/libc/sysdeps/linux/x86_64/crtn.S +++ b/libc/sysdeps/linux/x86_64/crtn.S @@ -7,7 +7,7 @@ .type _init, %function addq $8, %rsp ret -.size _init,.-_init +.size _init,.-.init .section .fini @@ -15,4 +15,4 @@ .type _fini, %function addq $8, %rsp ret -.size _fini, .-_fini +.size _fini, .-.fini -- cgit v1.2.3 From 5cf382c0f98d1943bcf51ffa8bde6103e1f102ab Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 5 May 2011 09:33:14 +0200 Subject: i386: fix .size of _init/_fini binutils-2.21 barf on .size that do not evaluate to const, so use the section size and not a function that is not visible here. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/i386/crtn.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/i386/crtn.S b/libc/sysdeps/linux/i386/crtn.S index 191250487..ce2608383 100644 --- a/libc/sysdeps/linux/i386/crtn.S +++ b/libc/sysdeps/linux/i386/crtn.S @@ -6,7 +6,7 @@ popl %ebx popl %ebp ret -.size _init,.-_init +.size _init,.-.init @@ -16,7 +16,7 @@ popl %ebx popl %ebp ret -.size _fini,.-_fini +.size _fini,.-.fini -- cgit v1.2.3 From 074930dd7f2a18a7013cdb72cc38136f3be39c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 20 Apr 2011 13:59:15 +0300 Subject: posix_fadvise64: fix x86 implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Commit 73d59554144f429b1cf0d4d7fa7de42bdf59ad92 completely broke the x86 implementation of posix_fadvise64. It moved the first the assembly code retn instruction gets missing depending on the Technically the file has two implementaions for posix_fadvise64, one when __NR_fadvise64_64 is available, and second one if only __NR_fadvise64 is there. Fix the #ifdef's to be proper for that. Signed-off-by: Timo Teräs Signed-off-by: Khem Raj --- libc/sysdeps/linux/i386/posix_fadvise64.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/i386/posix_fadvise64.S b/libc/sysdeps/linux/i386/posix_fadvise64.S index b4aeff1f4..8a8947d7b 100644 --- a/libc/sysdeps/linux/i386/posix_fadvise64.S +++ b/libc/sysdeps/linux/i386/posix_fadvise64.S @@ -22,7 +22,7 @@ #include #include -#if defined __NR_fadvise64_64 +#if defined __NR_fadvise64_64 || defined __NR_fadvise64 /* Was named __libc_posix_fadvise64 for some inexplicable reason. ** google says only uclibc has *__libc*_posix_fadviseXXX, @@ -35,6 +35,7 @@ .global posix_fadvise64 .type posix_fadvise64,%function posix_fadvise64: +#if defined __NR_fadvise64_64 /* Save regs */ pushl %ebp pushl %ebx @@ -91,6 +92,7 @@ overflow: /* Returns 0 on success, else an error code. */ negl %eax +#endif /* Successful; return the syscall's value. */ ret -- cgit v1.2.3 From 3e68c52b941636714d2599ea8adda9520ec2de23 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 10 May 2011 10:03:58 +0200 Subject: */crtn.S: Remove .size directive for _init and _fini These are split across objects so setting size does not (and never did) work since the expression cannot be computed at assembly time. This avoids errors from recent (> 2.21) gas. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/arm/crtn.S | 2 -- libc/sysdeps/linux/avr32/crtn.S | 2 -- libc/sysdeps/linux/cris/crtn.S | 2 -- libc/sysdeps/linux/frv/crtn.S | 2 -- libc/sysdeps/linux/h8300/crtn.S | 2 -- libc/sysdeps/linux/i386/crtn.S | 2 -- libc/sysdeps/linux/microblaze/crtn.S | 2 -- libc/sysdeps/linux/powerpc/crtn.S | 2 -- libc/sysdeps/linux/sh/crtn.S | 2 -- libc/sysdeps/linux/sh64/crtn.S | 2 -- libc/sysdeps/linux/sparc/crtn.S | 2 -- libc/sysdeps/linux/v850/crtn.S | 2 -- libc/sysdeps/linux/vax/crtn.S | 2 -- libc/sysdeps/linux/x86_64/crtn.S | 2 -- 14 files changed, 28 deletions(-) diff --git a/libc/sysdeps/linux/arm/crtn.S b/libc/sysdeps/linux/arm/crtn.S index de01b38dc..a4752c186 100644 --- a/libc/sysdeps/linux/arm/crtn.S +++ b/libc/sysdeps/linux/arm/crtn.S @@ -15,7 +15,6 @@ .arm ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc} #endif - .size _init, .-_init .section .fini .global _fini @@ -29,7 +28,6 @@ .arm ldmdb fp, {r4, r5, r6, r7, r8, r9, sl, fp, sp, pc} #endif - .size _fini, .-_fini @ In fact this is modified to 3.4.4 .ident "GCC: (GNU) 3.3.2 20031005 (Debian prerelease)" diff --git a/libc/sysdeps/linux/avr32/crtn.S b/libc/sysdeps/linux/avr32/crtn.S index f7d104070..c37f7d201 100644 --- a/libc/sysdeps/linux/avr32/crtn.S +++ b/libc/sysdeps/linux/avr32/crtn.S @@ -4,11 +4,9 @@ .global _init .type _init, @function ldm sp++, r6, pc - .size _init, . - _init .section .fini .align 2 .global _fini .type _fini, @function ldm sp++, r6, pc - .size _fini, . - _fini diff --git a/libc/sysdeps/linux/cris/crtn.S b/libc/sysdeps/linux/cris/crtn.S index 951ae5449..7b2dce17c 100644 --- a/libc/sysdeps/linux/cris/crtn.S +++ b/libc/sysdeps/linux/cris/crtn.S @@ -9,7 +9,6 @@ move.d [$sp+],$r1 Ret nop - .size _init, .-_init .section .fini .align 1 @@ -20,4 +19,3 @@ move.d [$sp+],$r1 Ret nop - .size _fini, .-_fini diff --git a/libc/sysdeps/linux/frv/crtn.S b/libc/sysdeps/linux/frv/crtn.S index 1d58c0207..bd11901ad 100644 --- a/libc/sysdeps/linux/frv/crtn.S +++ b/libc/sysdeps/linux/frv/crtn.S @@ -32,7 +32,6 @@ Cambridge, MA 02139, USA. */ ld @(sp,gr0), fp addi sp,#16,sp jmpl @(gr5,gr0) - .size _init, .-_init .section .fini,"x" .globl _fini @@ -41,4 +40,3 @@ Cambridge, MA 02139, USA. */ ld @(sp,gr0), fp addi sp,#16,sp jmpl @(gr5,gr0) - .size _fini, .-_fini diff --git a/libc/sysdeps/linux/h8300/crtn.S b/libc/sysdeps/linux/h8300/crtn.S index 89e321868..8f9fa1fac 100644 --- a/libc/sysdeps/linux/h8300/crtn.S +++ b/libc/sysdeps/linux/h8300/crtn.S @@ -14,7 +14,6 @@ ; #NO_APP mov.l @er7+,er6 rts - .size __init, .-__init ; #APP .section .fini @@ -24,7 +23,6 @@ ; #NO_APP mov.l @er7+,er6 rts - .size __fini, .-__fini ; #APP .end diff --git a/libc/sysdeps/linux/i386/crtn.S b/libc/sysdeps/linux/i386/crtn.S index ce2608383..34d5b38e2 100644 --- a/libc/sysdeps/linux/i386/crtn.S +++ b/libc/sysdeps/linux/i386/crtn.S @@ -6,7 +6,6 @@ popl %ebx popl %ebp ret -.size _init,.-.init @@ -16,7 +15,6 @@ popl %ebx popl %ebp ret -.size _fini,.-.fini diff --git a/libc/sysdeps/linux/microblaze/crtn.S b/libc/sysdeps/linux/microblaze/crtn.S index da8c920ef..6f4ef60d3 100644 --- a/libc/sysdeps/linux/microblaze/crtn.S +++ b/libc/sysdeps/linux/microblaze/crtn.S @@ -26,7 +26,6 @@ .end _init $Lfe2: - .size _init,$Lfe2-_init .section .fini .align 2 @@ -40,6 +39,5 @@ $Lfe2: .end _fini $Lfe3: - .size _fini,$Lfe3-_fini /*@TRAILER_BEGINS*/ diff --git a/libc/sysdeps/linux/powerpc/crtn.S b/libc/sysdeps/linux/powerpc/crtn.S index ba6d0e0c8..938367caa 100644 --- a/libc/sysdeps/linux/powerpc/crtn.S +++ b/libc/sysdeps/linux/powerpc/crtn.S @@ -9,7 +9,6 @@ addi 1,1,32 mtlr 0 blr - .size _init, .-_init .section .fini .align 2 @@ -20,4 +19,3 @@ addi 1,1,32 mtlr 0 blr - .size _fini, .-_fini diff --git a/libc/sysdeps/linux/sh/crtn.S b/libc/sysdeps/linux/sh/crtn.S index 437f8ebc3..e8be7e51f 100644 --- a/libc/sysdeps/linux/sh/crtn.S +++ b/libc/sysdeps/linux/sh/crtn.S @@ -15,7 +15,6 @@ .align 2 .L6: .L7: - .size _init, .-_init .section .fini .hidden _fini @@ -31,6 +30,5 @@ .align 2 .L11: .L12: - .size _fini, .-_fini .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/sh64/crtn.S b/libc/sysdeps/linux/sh64/crtn.S index eb6479a56..501fe9167 100644 --- a/libc/sysdeps/linux/sh64/crtn.S +++ b/libc/sysdeps/linux/sh64/crtn.S @@ -14,7 +14,6 @@ ptabs r18, tr0 addi.l r15, 16, r15 blink tr0, r63 - .size _init, .-_init .section .fini .hidden _fini @@ -28,6 +27,5 @@ ptabs r18, tr0 addi.l r15, 16, r15 blink tr0, r63 - .size _fini, .-_fini .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/sparc/crtn.S b/libc/sysdeps/linux/sparc/crtn.S index 24b4bf43c..d64ffd020 100644 --- a/libc/sysdeps/linux/sparc/crtn.S +++ b/libc/sysdeps/linux/sparc/crtn.S @@ -7,7 +7,6 @@ .proc 020 ret restore - .size _init, .-_init .section .fini .align 4 @@ -16,4 +15,3 @@ .proc 020 ret restore - .size _fini, .-_fini diff --git a/libc/sysdeps/linux/v850/crtn.S b/libc/sysdeps/linux/v850/crtn.S index aecb55737..6bb0b39ac 100644 --- a/libc/sysdeps/linux/v850/crtn.S +++ b/libc/sysdeps/linux/v850/crtn.S @@ -8,7 +8,6 @@ .type __init, @function #NO_APP jr __return_r31 - .size __init, .-__init #APP .section .fini @@ -18,7 +17,6 @@ .type __fini, @function #NO_APP jr __return_r31 - .size __fini, .-__fini #APP .ident "GCC: (GNU) 3.3.2" diff --git a/libc/sysdeps/linux/vax/crtn.S b/libc/sysdeps/linux/vax/crtn.S index 6ca5c4fcd..1153fd50b 100644 --- a/libc/sysdeps/linux/vax/crtn.S +++ b/libc/sysdeps/linux/vax/crtn.S @@ -9,7 +9,6 @@ __gnu_compiled_c: .type _init,@function ret .Lfe2: - .size _init,.Lfe2-_init .section .fini .align 1 @@ -17,5 +16,4 @@ __gnu_compiled_c: .type _fini,@function ret .Lfe3: - .size _fini,.Lfe3-_fini .ident "GCC: (GNU) 2.95.2 19991024 (release) (Linux/VAX CVS)" diff --git a/libc/sysdeps/linux/x86_64/crtn.S b/libc/sysdeps/linux/x86_64/crtn.S index ec40c21d2..9804e0f76 100644 --- a/libc/sysdeps/linux/x86_64/crtn.S +++ b/libc/sysdeps/linux/x86_64/crtn.S @@ -7,7 +7,6 @@ .type _init, %function addq $8, %rsp ret -.size _init,.-.init .section .fini @@ -15,4 +14,3 @@ .type _fini, %function addq $8, %rsp ret -.size _fini, .-.fini -- cgit v1.2.3 From 974d3140577ac740c8db2f1ad9635c4ba591361e Mon Sep 17 00:00:00 2001 From: Filippo Arcidiacono Date: Fri, 6 May 2011 16:49:28 +0200 Subject: libdl: fix local symbol's address handling in dladdr Fix dladdr to correctly handle local function's address so backtrace_symbols print only the function address for these function, instead of showing the name of nearest one. Indeed the dladdr walk through the hash table to find the nearest symbol, that doesn't contain local symbols. Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- ldso/include/dl-defs.h | 8 ++++++++ ldso/libdl/libdl.c | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ldso/include/dl-defs.h b/ldso/include/dl-defs.h index be0a81da3..88ff81593 100644 --- a/ldso/include/dl-defs.h +++ b/ldso/include/dl-defs.h @@ -179,6 +179,14 @@ typedef struct { #define DL_LOOKUP_ADDRESS(ADDRESS) (ADDRESS) #endif +/* On some architectures dladdr can't use st_size of all symbols this way. */ +#define DL_ADDR_SYM_MATCH(SYM_ADDR, SYM, MATCHSYM, ADDR) \ + ((ADDR) >= (SYM_ADDR) \ + && ((((SYM)->st_shndx == SHN_UNDEF || (SYM)->st_size == 0) \ + && (ADDR) == (SYM_ADDR)) \ + || (ADDR) < (SYM_ADDR) + (SYM)->st_size) \ + && (!(MATCHSYM) || MATCHSYM < (SYM_ADDR))) + /* Use this macro to convert a pointer to a function's entry point to * a pointer to function. The pointer is assumed to have already been * relocated. LOADADDR is passed because it may contain additional diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 68cd5797e..b80495e71 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -1067,7 +1067,11 @@ int dladdr(const void *__address, Dl_info * __info) ElfW(Addr) symbol_addr; symbol_addr = (ElfW(Addr)) DL_RELOC_ADDR(pelf->loadaddr, symtab[si].st_value); - if (symbol_addr <= (ElfW(Addr))__address && (!sf || sa < symbol_addr)) { + if ((symtab[si].st_shndx != SHN_UNDEF + || symtab[si].st_value != 0) + && ELF_ST_TYPE(symtab[si].st_info) != STT_TLS + && DL_ADDR_SYM_MATCH(symbol_addr, &symtab[si], sa, + (ElfW(Addr)) __address)) { sa = symbol_addr; sn = si; sf = 1; @@ -1083,7 +1087,11 @@ int dladdr(const void *__address, Dl_info * __info) ElfW(Addr) symbol_addr; symbol_addr = (ElfW(Addr)) DL_RELOC_ADDR(pelf->loadaddr, symtab[si].st_value); - if (symbol_addr <= (ElfW(Addr))__address && (!sf || sa < symbol_addr)) { + if ((symtab[si].st_shndx != SHN_UNDEF + || symtab[si].st_value != 0) + && ELF_ST_TYPE(symtab[si].st_info) != STT_TLS + && DL_ADDR_SYM_MATCH(symbol_addr, &symtab[si], sa, + (ElfW(Addr)) __address)) { sa = symbol_addr; sn = si; sf = 1; -- cgit v1.2.3 From 025ec197fe9d069c6d705e6f7d1509bb9dc1ce56 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 10 May 2011 20:09:36 +0200 Subject: __uc_malloc: Fix memory-leak in error path Signed-off-by: Bernhard Reutner-Fischer --- libc/stdlib/__uc_malloc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libc/stdlib/__uc_malloc.c b/libc/stdlib/__uc_malloc.c index 2a2e223ef..449f014fc 100644 --- a/libc/stdlib/__uc_malloc.c +++ b/libc/stdlib/__uc_malloc.c @@ -39,6 +39,7 @@ void *__uc_malloc(size_t size) return p; if (!__uc_malloc_failed) _exit(1); + free(p); __uc_malloc_failed(size); } } -- cgit v1.2.3 From e48bd60ce9a70d190acfee7db98c0f163a2c5fdb Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 10 May 2011 20:19:46 +0200 Subject: getcwd: Fix memory-leak in error path Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/getcwd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index 75d7a1c8b..87510019e 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -69,7 +69,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path slen++; dp = opendir(path_buf); - if (dp == 0) { + if (!dp) { goto oops; } @@ -78,6 +78,7 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path if (slow_search || this_ino == d->d_ino) { # endif if (slen + strlen(d->d_name) > path_size) { + closedir(dp); goto oops; } strcpy(ptr + 1, d->d_name); -- cgit v1.2.3 From bfbab32be6d74de0717c7f5fbdd90edfd2839169 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 10 May 2011 21:22:25 +0200 Subject: ldso: commentary typo fix Signed-off-by: Bernhard Reutner-Fischer --- ldso/libdl/libdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index b80495e71..52c77b00a 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -672,7 +672,7 @@ void *dlsym(void *vhandle, const char *name) #if defined(USE_TLS) && USE_TLS && defined SHARED if (sym_ref.tpnt) { /* The found symbol is a thread-local storage variable. - Return the address for to the current thread. */ + Return its address for the current thread. */ ret = _dl_tls_symaddr ((struct link_map *)sym_ref.tpnt, (Elf32_Addr)ret); } #endif -- cgit v1.2.3 From afeef5ca3930a22b90bed7717464f117fcca78f0 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 09:37:35 +0200 Subject: buildsys: Turn on strict aliasing for everyone Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Rules.mak b/Rules.mak index 49ca2072a..65fe47c63 100644 --- a/Rules.mak +++ b/Rules.mak @@ -186,6 +186,7 @@ OPTIMIZATION+=$(call check_gcc,-Os,-O2) OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,) # shrinks code by about 0.1% OPTIMIZATION+=$(call check_gcc,-fmerge-all-constants) +OPTIMIZATION+=$(call check_gcc,-fstrict-aliasing) GCC_MAJOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 1) #GCC_MINOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 2) @@ -332,7 +333,6 @@ ifeq ($(TARGET_ARCH),sparc) endif ifeq ($(TARGET_ARCH),arm) - OPTIMIZATION+=-fstrict-aliasing CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+= @@ -385,7 +385,6 @@ ifeq ($(TARGET_ARCH),nios) endif ifeq ($(TARGET_ARCH),sh) - OPTIMIZATION+=-fstrict-aliasing OPTIMIZATION+= $(call check_gcc,-mprefergot,) CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-ml CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mb @@ -401,7 +400,6 @@ endif endif ifeq ($(TARGET_ARCH),sh64) - OPTIMIZATION+=-fstrict-aliasing CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN):=-ml CPU_CFLAGS-$(ARCH_BIG_ENDIAN):=-mb CPU_CFLAGS-$(CONFIG_SH5)+=-m5-32media @@ -546,10 +544,10 @@ endif endif # Add a bunch of extra pedantic annoyingly strict checks -XWARNINGS=$(call qstrip,$(WARNINGS)) +XWARNINGS=$(call qstrip,$(WARNINGS)) XWARNINGS+=$(foreach w,\ -Wstrict-prototypes \ - -fno-strict-aliasing \ + -Wstrict-aliasing \ , $(call check_gcc,$(w),)) ifeq ($(EXTRA_WARNINGS),y) XWARNINGS+=$(foreach w,\ -- cgit v1.2.3 From 7a080cd149c7b25d415d76506510d55b34819fc2 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 6 May 2011 19:07:12 +0200 Subject: libubacktrace: fix config-symbol handling Config symbals that are not set are empty, not 'n'. --- libubacktrace/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libubacktrace/Makefile.in b/libubacktrace/Makefile.in index f75f68b75..e2a4cb64f 100644 --- a/libubacktrace/Makefile.in +++ b/libubacktrace/Makefile.in @@ -45,7 +45,7 @@ lib-so-$(UCLIBC_HAS_BACKTRACE) += $(top_builddir)lib/libubacktrace.so objclean-y += CLEAN_libubacktrace -ifeq ($(DOMULTI),n) +ifeq ($(DOMULTI),) ifeq ($(DOPIC),y) $(top_builddir)lib/libubacktrace.so: $(top_builddir)lib/libubacktrace.a $(libdl.depend) else -- cgit v1.2.3 From 46e3df937b05fa291470e975cd836c5435aa0ecc Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Wed, 11 May 2011 08:40:58 +0200 Subject: Implement accept4 system call. Signed-off-by: Thierry Reding Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/accept.c | 1 + libc/inet/socketcalls.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/libc/inet/accept.c b/libc/inet/accept.c index 0217a6876..b0fd2b2c6 100644 --- a/libc/inet/accept.c +++ b/libc/inet/accept.c @@ -5,4 +5,5 @@ */ #define L_accept +#define L_accept4 #include "socketcalls.c" diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index 42a5a563f..ff5fdaa30 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -31,6 +31,7 @@ extern int __socketcall(int call, unsigned long *args) attribute_hidden; #define SYS_GETSOCKOPT 15 #define SYS_SENDMSG 16 #define SYS_RECVMSG 17 +#define SYS_ACCEPT4 18 #endif #ifdef __UCLIBC_HAS_THREADS_NATIVE__ @@ -560,3 +561,20 @@ int socketpair(int family, int type, int protocol, int sockvec[2]) } #endif #endif + +#ifdef L_accept4 +#ifdef __NR_accept4 +_syscall4(int, accept4, int, sockfd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags) +#elif defined(__NR_socketcall) +int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) +{ + unsigned long args[4]; + + args[0] = sockfd; + args[1] = (unsigned long) addr; + args[2] = (unsigned long) addrlen; + args[3] = flags; + return __socketcall(SYS_ACCEPT4, args); +} +#endif +#endif -- cgit v1.2.3 From 74a2c71153b910ee4773866ee30be84730a4d5b8 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 11:31:45 +0200 Subject: accept4: Implement cancellation .. and add proper prototype, move it into it's own obj and other such cleanups. Signed-off-by: Bernhard Reutner-Fischer --- include/sys/socket.h | 9 ++++ libc/inet/Makefile.in | 6 ++- libc/inet/accept.c | 1 - libc/inet/accept4.c | 8 ++++ libc/inet/socketcalls.c | 56 +++++++++++++++++------- libc/sysdeps/linux/common/bits/kernel-features.h | 12 +++++ libc/sysdeps/linux/common/stubs.c | 4 ++ 7 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 libc/inet/accept4.c diff --git a/include/sys/socket.h b/include/sys/socket.h index 0824fc855..5d38f1105 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -227,6 +227,15 @@ extern int accept (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); libc_hidden_proto(accept) +#ifdef __USE_GNU +/* Similar to 'accept' but takes an additional parameter to specify flags. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int accept4 (int __fd, __SOCKADDR_ARG __addr, + socklen_t *__restrict __addr_len, int __flags); +#endif + /* Shut down all or part of the connection open on socket FD. HOW determines what to shut down: SHUT_RD = No more receptions; diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in index abcf2f7d7..c490adf7e 100644 --- a/libc/inet/Makefile.in +++ b/libc/inet/Makefile.in @@ -44,11 +44,13 @@ CSRC-$(findstring y,$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += \ ## CSRC-y += encodep.c decodep.c formquery.c # multi source socketcalls.c -socketcalls_CSRC += \ +socketcalls_CSRC-y += \ accept.c bind.c connect.c getpeername.c getsockname.c \ getsockopt.c listen.c recv.c recvfrom.c recvmsg.c send.c sendmsg.c \ sendto.c setsockopt.c shutdown.c socket.c socketpair.c -CSRC-$(UCLIBC_HAS_SOCKET) += $(socketcalls_CSRC) opensock.c +# FIXME: GNU / linux specific +socketcalls_CSRC-y += accept4.c +CSRC-$(UCLIBC_HAS_SOCKET) += $(socketcalls_CSRC-y) opensock.c CSRC-$(findstring y,$(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += ethers.c ether_addr.c diff --git a/libc/inet/accept.c b/libc/inet/accept.c index b0fd2b2c6..0217a6876 100644 --- a/libc/inet/accept.c +++ b/libc/inet/accept.c @@ -5,5 +5,4 @@ */ #define L_accept -#define L_accept4 #include "socketcalls.c" diff --git a/libc/inet/accept4.c b/libc/inet/accept4.c new file mode 100644 index 000000000..e2fdd6c2f --- /dev/null +++ b/libc/inet/accept4.c @@ -0,0 +1,8 @@ +/* + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#define L_accept4 +#include "socketcalls.c" diff --git a/libc/inet/socketcalls.c b/libc/inet/socketcalls.c index ff5fdaa30..aae7e93bf 100644 --- a/libc/inet/socketcalls.c +++ b/libc/inet/socketcalls.c @@ -83,6 +83,46 @@ weak_alias(__libc_accept,accept) libc_hidden_weak(accept) #endif +#ifdef L_accept4 +#ifdef __NR_accept4 +# define __NR___sys_accept4 __NR_accept4 +static _syscall4(int, __sys_accept4, int, fd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags) +int accept4(int fd, struct sockaddr *addr, socklen_t * addrlen, int flags) +{ + if (SINGLE_THREAD_P) + return __sys_accept4(fd, addr, addrlen, flags); +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + else { + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __sys_accept4(fd, addr, addrlen, flags); + LIBC_CANCEL_RESET (oldtype); + return result; + } +#endif +} +#elif defined(__NR_socketcall) +int accept4(int fd, struct sockaddr *addr, socklen_t *addrlen, int flags) +{ + unsigned long args[4]; + + args[0] = fd; + args[1] = (unsigned long) addr; + args[2] = (unsigned long) addrlen; + args[3] = flags; + if (SINGLE_THREAD_P) + return __socketcall(SYS_ACCEPT4, args); +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + else { + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __socketcall(SYS_ACCEPT4, args); + LIBC_CANCEL_RESET (oldtype); + return result; + } +#endif +} +#endif +#endif + #ifdef L_bind #ifdef __NR_bind _syscall3(int, bind, int, sockfd, const struct sockaddr *, myaddr, socklen_t, addrlen) @@ -562,19 +602,3 @@ int socketpair(int family, int type, int protocol, int sockvec[2]) #endif #endif -#ifdef L_accept4 -#ifdef __NR_accept4 -_syscall4(int, accept4, int, sockfd, struct sockaddr *, addr, socklen_t *, addrlen, int, flags) -#elif defined(__NR_socketcall) -int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags) -{ - unsigned long args[4]; - - args[0] = sockfd; - args[1] = (unsigned long) addr; - args[2] = (unsigned long) addrlen; - args[3] = flags; - return __socketcall(SYS_ACCEPT4, args); -} -#endif -#endif diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h index 68b881c09..b338e0770 100644 --- a/libc/sysdeps/linux/common/bits/kernel-features.h +++ b/libc/sysdeps/linux/common/bits/kernel-features.h @@ -454,6 +454,18 @@ #define __ASSUME_IEEE_RAISE_EXCEPTION 1 #endif +/* Support for the accept4 syscall was added in 2.6.28. */ +#if __LINUX_KERNEL_VERSION >= 0x02061c \ + && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \ + || defined __sparc__ || defined __s390__) +# define __ASSUME_ACCEPT4 1 +#endif + +/* Support for the accept4 syscall for alpha was added after 2.6.33-rc1. */ +#if __LINUX_KERNEL_VERSION >= 0x020621 && defined __alpha__ +# define __ASSUME_ACCEPT4 1 +#endif + /* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */ #if __LINUX_KERNEL_VERSION >= 0x02061d # define __ASSUME_FUTEX_CLOCK_REALTIME 1 diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 655c64001..d9379874a 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -31,6 +31,10 @@ static int enosys_stub(void) # undef __NR_sync_file_range #endif +#ifndef __NR_accept4 +make_stub(accept4) +#endif + #ifndef __NR_bdflush make_stub(bdflush) #endif -- cgit v1.2.3 From 6af34270fa28a4274576a6d068e6a83346480f2e Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 12:05:20 +0200 Subject: socketcalls: add stubs Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/stubs.c | 94 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index d9379874a..1aa07de36 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -31,6 +31,32 @@ static int enosys_stub(void) # undef __NR_sync_file_range #endif +#ifndef __UCLIBC_HAS_SOCKET__ +# undef __NR_accept +# undef __NR_accept4 +# undef __NR_bind +# undef __NR_connect +# undef __NR_getpeername +# undef __NR_getsockname +# undef __NR_getsockopt +# undef __NR_listen +# undef __NR_recv +# undef __NR_recvfrom +# undef __NR_recvmsg +# undef __NR_send +# undef __NR_sendmsg +# undef __NR_sendto +# undef __NR_setsockopt +# undef __NR_shutdown +# undef __NR_socket +# undef __NR_socketcall +# undef __NR_socketpair +#endif + +#ifndef __NR_accept +make_stub(accept) +#endif + #ifndef __NR_accept4 make_stub(accept4) #endif @@ -39,6 +65,10 @@ make_stub(accept4) make_stub(bdflush) #endif +#ifndef __NR_bind +make_stub(bind) +#endif + #ifndef __NR_capget make_stub(capget) #endif @@ -47,6 +77,10 @@ make_stub(capget) make_stub(capset) #endif +#ifndef __NR_connect +make_stub(connect) +#endif + #ifndef __NR_create_module make_stub(create_module) #endif @@ -95,10 +129,22 @@ make_stub(fsetxattr) make_stub(get_kernel_syms) #endif +#ifndef __NR_getpeername +make_stub(getpeername) +#endif + #if !defined(__NR_getpgrp) && (defined(__NR_getpgid) && (defined(__NR_getpid) || defined(__NR_getxpid))) make_stub(getpgrp) #endif +#ifndef __NR_getsockname +make_stub(getsockname) +#endif + +#ifndef __NR_getsockopt +make_stub(getsockopt) +#endif + #ifndef __NR_getxattr make_stub(getxattr) #endif @@ -111,6 +157,10 @@ make_stub(init_module) make_stub(lgetxattr) #endif +#ifndef __NR_listen +make_stub(listen) +#endif + #ifndef __NR_listxattr make_stub(listxattr) #endif @@ -135,6 +185,18 @@ make_stub(pivot_root) make_stub(query_module) #endif +#ifndef __NR_recv +make_stub(recv) +#endif + +#ifndef __NR_recvfrom +make_stub(recvfrom) +#endif + +#ifndef __NR_recvmsg +make_stub(recvmsg) +#endif + #ifndef __NR_removexattr make_stub(removexattr) #endif @@ -147,14 +209,46 @@ make_stub(sched_getaffinity) make_stub(sched_setaffinity) #endif +#ifndef __NR_send +make_stub(send) +#endif + +#ifndef __NR_sendmsg +make_stub(sendmsg) +#endif + +#ifndef __NR_sendto +make_stub(sendto) +#endif + +#ifndef __NR_setsockopt +make_stub(setsockopt) +#endif + #ifndef __NR_setxattr make_stub(setxattr) #endif +#ifndef __NR_shutdown +make_stub(shutdown) +#endif + #if !defined(__NR_signalfd4) && !defined(__NR_signalfd) make_stub(signalfd) #endif +#ifndef __NR_socket +make_stub(socket) +#endif + +#ifndef __NR_socketcall +make_stub(socketcall) +#endif + +#ifndef __NR_socketpair +make_stub(socketpair) +#endif + #ifndef __NR_rt_sigtimedwait make_stub(sigtimedwait) make_stub(sigwaitinfo) -- cgit v1.2.3 From d3ddb92ea03c89fe7d56a0bcbfbe64743bc51210 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 13:12:14 +0200 Subject: add pipe2() Signed-off-by: Bernhard Reutner-Fischer --- extra/Configs/Config.in | 3 ++- include/unistd.h | 7 +++++++ libc/sysdeps/linux/common/Makefile.in | 3 ++- libc/sysdeps/linux/common/bits/kernel-features.h | 13 +++++++++++++ libc/sysdeps/linux/common/pipe2.c | 16 ++++++++++++++++ libc/sysdeps/linux/common/stubs.c | 8 ++++++++ 6 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 libc/sysdeps/linux/common/pipe2.c diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 147a316e6..7dffdeab9 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -915,7 +915,8 @@ config UCLIBC_LINUX_SPECIFIC default y help capget(), capset(), fstatfs(), inotify_*(), ioperm(), iopl(), - madvise(), modify_ldt(), personality(), prctl()/arch_prctl(), + madvise(), modify_ldt(), pipe2(), personality(), + prctl()/arch_prctl(), ppoll(), readahead(), reboot(), remap_file_pages(), sched_getaffinity(), sched_setaffinity(), sendfile(), setfsgid(), setfsuid(), setresuid(), diff --git a/include/unistd.h b/include/unistd.h index c421cb308..6b614dd05 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -389,6 +389,13 @@ extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n, extern int pipe (int __pipedes[2]) __THROW __wur; libc_hidden_proto(pipe) +#ifdef __USE_GNU +/* Same as pipe but apply flags passed in FLAGS to the new file + descriptors. */ +extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur; +libc_hidden_proto(pipe2) +#endif + /* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. If SECONDS is zero, any currently scheduled alarm will be cancelled. The function returns the number of seconds remaining until the last diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 8811268d0..d97c73dcb 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -19,7 +19,8 @@ CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ get_kernel_syms.c # we need these internally: fstatfs.c statfs.c CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ - madvise.c modify_ldt.c personality.c ppoll.c prctl.c readahead.c reboot.c \ + madvise.c modify_ldt.c pipe2.c personality.c ppoll.c prctl.c \ + readahead.c reboot.c \ remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \ sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \ splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h index b338e0770..6bf554457 100644 --- a/libc/sysdeps/linux/common/bits/kernel-features.h +++ b/libc/sysdeps/linux/common/bits/kernel-features.h @@ -309,6 +309,19 @@ # define __ASSUME_O_CLOEXEC 1 #endif +/* Support for various CLOEXEC and NONBLOCK flags was added for x86, + * x86-64, PPC, IA-64, and SPARC in 2.6.27. */ +#if __LINUX_KERNEL_VERSION >= 0x02061b \ + && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \ + || defined __ia64__ || defined __sparc__ || defined __s390__) +/* # define __ASSUME_SOCK_CLOEXEC 1 */ +/* # define __ASSUME_IN_NONBLOCK 1 */ +# define __ASSUME_PIPE2 1 +/* # define __ASSUME_EVENTFD2 1 */ +/* # define __ASSUME_SIGNALFD4 1 */ +#endif + + /* These features were surely available with 2.4.12. */ #if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__ # define __ASSUME_MMAP2_SYSCALL 1 diff --git a/libc/sysdeps/linux/common/pipe2.c b/libc/sysdeps/linux/common/pipe2.c new file mode 100644 index 000000000..0a3686d81 --- /dev/null +++ b/libc/sysdeps/linux/common/pipe2.c @@ -0,0 +1,16 @@ +/* vi: set sw=4 ts=4: */ +/* + * pipe2() for uClibc + * + * Copyright (C) 2011 Bernhard Reutner-Fischer + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +#ifdef __NR_pipe2 +_syscall2(int, pipe2, int *, filedes, int, flags) +libc_hidden_def(pipe2) +#endif diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index 1aa07de36..f7c6dc5c5 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -31,6 +31,10 @@ static int enosys_stub(void) # undef __NR_sync_file_range #endif +#ifndef __UCLIBC_LINUX_SPECIFIC__ +# undef __NR_pipe2 +#endif + #ifndef __UCLIBC_HAS_SOCKET__ # undef __NR_accept # undef __NR_accept4 @@ -177,6 +181,10 @@ make_stub(lremovexattr) make_stub(lsetxattr) #endif +#ifndef __NR_pipe2 +make_stub(pipe2) +#endif + #ifndef __NR_pivot_root make_stub(pivot_root) #endif -- cgit v1.2.3 From bbb07be58509856b4629d7b2a4aa09dbddcb6828 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 19:16:17 +0200 Subject: Revert "libubacktrace: fix config-symbol handling" This reverts commit 7a080cd149c7b25d415d76506510d55b34819fc2. This symbol is in fact different (as it is set no 'n'). --- libubacktrace/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libubacktrace/Makefile.in b/libubacktrace/Makefile.in index e2a4cb64f..f75f68b75 100644 --- a/libubacktrace/Makefile.in +++ b/libubacktrace/Makefile.in @@ -45,7 +45,7 @@ lib-so-$(UCLIBC_HAS_BACKTRACE) += $(top_builddir)lib/libubacktrace.so objclean-y += CLEAN_libubacktrace -ifeq ($(DOMULTI),) +ifeq ($(DOMULTI),n) ifeq ($(DOPIC),y) $(top_builddir)lib/libubacktrace.so: $(top_builddir)lib/libubacktrace.a $(libdl.depend) else -- cgit v1.2.3 From 7d8c08baf43d27aac22a29e55c1108f31b8d7595 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 19:52:16 +0200 Subject: libubacktrace: mv unwind.h to include Fixes compilation if NPTL is off. I hope this doesn't break ARM EABI but cannot check ATM. Signed-off-by: Bernhard Reutner-Fischer --- include/unwind.h | 220 +++++++++++++++++++++++++++++++ libpthread/nptl/sysdeps/generic/unwind.h | 220 ------------------------------- 2 files changed, 220 insertions(+), 220 deletions(-) create mode 100644 include/unwind.h delete mode 100644 libpthread/nptl/sysdeps/generic/unwind.h diff --git a/include/unwind.h b/include/unwind.h new file mode 100644 index 000000000..81fc4db55 --- /dev/null +++ b/include/unwind.h @@ -0,0 +1,220 @@ +/* Exception handling and frame unwind runtime interface routines. + Copyright (C) 2001, 2003 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This is derived from the C++ ABI for IA-64. Where we diverge + for cross-architecture compatibility are noted with "@@@". */ + +#ifndef _UNWIND_H +#define _UNWIND_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Level 1: Base ABI */ + +/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is + inefficient for 32-bit and smaller machines. */ +typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); +typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); +#if defined(__ia64__) && defined(__hpux__) +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); +#else +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); +#endif +typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); + +/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and + consumer of an exception. We'll go along with this for now even on + 32-bit machines. We'll need to provide some other option for + 16-bit machines and for machines with > 8 bits per byte. */ +typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); + +/* The unwind interface uses reason codes in several contexts to + identify the reasons for failures or other actions. */ +typedef enum +{ + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 +} _Unwind_Reason_Code; + + +/* The unwind interface uses a pointer to an exception header object + as its representation of an exception being thrown. In general, the + full representation of an exception object is language- and + implementation-specific, but it will be prefixed by a header + understood by the unwind interface. */ + +struct _Unwind_Exception; + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +struct _Unwind_Exception +{ + _Unwind_Exception_Class exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + _Unwind_Word private_1; + _Unwind_Word private_2; + + /* @@@ The IA-64 ABI says that this structure must be double-word aligned. + Taking that literally does not make much sense generically. Instead we + provide the maximum alignment required by any type for the machine. */ +} __attribute__((__aligned__)); + + +/* The ACTIONS argument to the personality routine is a bitwise OR of one + or more of the following constants. */ +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 +#define _UA_END_OF_STACK 16 + +/* This is an opaque type used to refer to a system-specific data + structure used by the system unwinder. This context is created and + destroyed by the system, and passed to the personality routine + during unwinding. */ +struct _Unwind_Context; + +/* Raise an exception, passing along the given exception object. */ +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); + +/* Raise an exception for forced unwinding. */ + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, + _Unwind_Stop_Fn, + void *); + +/* Helper to invoke the exception_cleanup routine. */ +extern void _Unwind_DeleteException (struct _Unwind_Exception *); + +/* Resume propagation of an existing exception. This is used after + e.g. executing cleanup code, and not to implement rethrowing. */ +extern void _Unwind_Resume (struct _Unwind_Exception *); + +/* @@@ Use unwind data to perform a stack backtrace. The trace callback + is called for every stack frame in the call chain, but no cleanup + actions are performed. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) + (struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* These functions are used for communicating information about the unwind + context (i.e. the unwind descriptors and the user register state) between + the unwind library and the personality routine and landing pad. Only + selected registers maybe manipulated. */ + +extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); + +extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); +extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); + +/* @@@ Retrieve the CFA of the given context. */ +extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); + +extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); + +extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); + + +/* The personality routine is the function in the C++ (or other language) + runtime library which serves as an interface between the system unwind + library and language-specific exception handling semantics. It is + specific to the code fragment described by an unwind info block, and + it is always referenced via the pointer in the unwind info block, and + hence it has no ABI-specified name. + + Note that this implies that two different C++ implementations can + use different names, and have different contents in the language + specific data area. Moreover, that the language specific data + area contains no version info because name of the function invoked + provides more effective versioning by detecting at link time the + lack of code to handle the different data format. */ + +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *); + +/* @@@ The following alternate entry points are for setjmp/longjmp + based unwinding. */ + +struct SjLj_Function_Context; +extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); +extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); + +extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException + (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind + (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); +extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *); + +/* @@@ The following provide access to the base addresses for text + and data-relative addressing in the LDSA. In order to stay link + compatible with the standard ABI for IA-64, we inline these. */ + +#ifdef __ia64__ +#include + +static inline _Unwind_Ptr +_Unwind_GetDataRelBase (struct _Unwind_Context *_C) +{ + /* The GP is stored in R1. */ + return _Unwind_GetGR (_C, 1); +} + +static inline _Unwind_Ptr +_Unwind_GetTextRelBase (struct _Unwind_Context *_C) +{ + abort (); + return 0; +} + +/* @@@ Retrieve the Backing Store Pointer of the given context. */ +extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); +#else +extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); +extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); +#endif + +/* @@@ Given an address, return the entry point of the function that + contains it. */ +extern void * _Unwind_FindEnclosingFunction (void *pc); + +#ifdef __cplusplus +} +#endif + +#endif /* unwind.h */ diff --git a/libpthread/nptl/sysdeps/generic/unwind.h b/libpthread/nptl/sysdeps/generic/unwind.h deleted file mode 100644 index 81fc4db55..000000000 --- a/libpthread/nptl/sysdeps/generic/unwind.h +++ /dev/null @@ -1,220 +0,0 @@ -/* Exception handling and frame unwind runtime interface routines. - Copyright (C) 2001, 2003 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This is derived from the C++ ABI for IA-64. Where we diverge - for cross-architecture compatibility are noted with "@@@". */ - -#ifndef _UNWIND_H -#define _UNWIND_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* Level 1: Base ABI */ - -/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is - inefficient for 32-bit and smaller machines. */ -typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); -typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); -#if defined(__ia64__) && defined(__hpux__) -typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); -#else -typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); -#endif -typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); - -/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and - consumer of an exception. We'll go along with this for now even on - 32-bit machines. We'll need to provide some other option for - 16-bit machines and for machines with > 8 bits per byte. */ -typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); - -/* The unwind interface uses reason codes in several contexts to - identify the reasons for failures or other actions. */ -typedef enum -{ - _URC_NO_REASON = 0, - _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_FATAL_PHASE2_ERROR = 2, - _URC_FATAL_PHASE1_ERROR = 3, - _URC_NORMAL_STOP = 4, - _URC_END_OF_STACK = 5, - _URC_HANDLER_FOUND = 6, - _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8 -} _Unwind_Reason_Code; - - -/* The unwind interface uses a pointer to an exception header object - as its representation of an exception being thrown. In general, the - full representation of an exception object is language- and - implementation-specific, but it will be prefixed by a header - understood by the unwind interface. */ - -struct _Unwind_Exception; - -typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, - struct _Unwind_Exception *); - -struct _Unwind_Exception -{ - _Unwind_Exception_Class exception_class; - _Unwind_Exception_Cleanup_Fn exception_cleanup; - _Unwind_Word private_1; - _Unwind_Word private_2; - - /* @@@ The IA-64 ABI says that this structure must be double-word aligned. - Taking that literally does not make much sense generically. Instead we - provide the maximum alignment required by any type for the machine. */ -} __attribute__((__aligned__)); - - -/* The ACTIONS argument to the personality routine is a bitwise OR of one - or more of the following constants. */ -typedef int _Unwind_Action; - -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 -#define _UA_END_OF_STACK 16 - -/* This is an opaque type used to refer to a system-specific data - structure used by the system unwinder. This context is created and - destroyed by the system, and passed to the personality routine - during unwinding. */ -struct _Unwind_Context; - -/* Raise an exception, passing along the given exception object. */ -extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); - -/* Raise an exception for forced unwinding. */ - -typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, - _Unwind_Stop_Fn, - void *); - -/* Helper to invoke the exception_cleanup routine. */ -extern void _Unwind_DeleteException (struct _Unwind_Exception *); - -/* Resume propagation of an existing exception. This is used after - e.g. executing cleanup code, and not to implement rethrowing. */ -extern void _Unwind_Resume (struct _Unwind_Exception *); - -/* @@@ Use unwind data to perform a stack backtrace. The trace callback - is called for every stack frame in the call chain, but no cleanup - actions are performed. */ -typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) - (struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); - -/* These functions are used for communicating information about the unwind - context (i.e. the unwind descriptors and the user register state) between - the unwind library and the personality routine and landing pad. Only - selected registers maybe manipulated. */ - -extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); -extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); - -extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); -extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); - -/* @@@ Retrieve the CFA of the given context. */ -extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); - -extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); - -extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); - - -/* The personality routine is the function in the C++ (or other language) - runtime library which serves as an interface between the system unwind - library and language-specific exception handling semantics. It is - specific to the code fragment described by an unwind info block, and - it is always referenced via the pointer in the unwind info block, and - hence it has no ABI-specified name. - - Note that this implies that two different C++ implementations can - use different names, and have different contents in the language - specific data area. Moreover, that the language specific data - area contains no version info because name of the function invoked - provides more effective versioning by detecting at link time the - lack of code to handle the different data format. */ - -typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, struct _Unwind_Context *); - -/* @@@ The following alternate entry points are for setjmp/longjmp - based unwinding. */ - -struct SjLj_Function_Context; -extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); -extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); - -extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException - (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind - (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); -extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *); - -/* @@@ The following provide access to the base addresses for text - and data-relative addressing in the LDSA. In order to stay link - compatible with the standard ABI for IA-64, we inline these. */ - -#ifdef __ia64__ -#include - -static inline _Unwind_Ptr -_Unwind_GetDataRelBase (struct _Unwind_Context *_C) -{ - /* The GP is stored in R1. */ - return _Unwind_GetGR (_C, 1); -} - -static inline _Unwind_Ptr -_Unwind_GetTextRelBase (struct _Unwind_Context *_C) -{ - abort (); - return 0; -} - -/* @@@ Retrieve the Backing Store Pointer of the given context. */ -extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); -#else -extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); -extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); -#endif - -/* @@@ Given an address, return the entry point of the function that - contains it. */ -extern void * _Unwind_FindEnclosingFunction (void *pc); - -#ifdef __cplusplus -} -#endif - -#endif /* unwind.h */ -- cgit v1.2.3 From 08c36f4c11f5ffdcd1656802257ea472df8339e7 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 20:29:59 +0200 Subject: x86_64: add TODO for R_X86_64_RELATIVE Signed-off-by: Bernhard Reutner-Fischer --- ldso/ldso/x86_64/dl-startup.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ldso/ldso/x86_64/dl-startup.h b/ldso/ldso/x86_64/dl-startup.h index 7e05846dd..b2ea93db7 100644 --- a/ldso/ldso/x86_64/dl-startup.h +++ b/ldso/ldso/x86_64/dl-startup.h @@ -58,6 +58,9 @@ void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, ElfW(Addr) *reloc_addr, case R_X86_64_TPOFF64: *reloc_addr = sym->st_value + rpnt->r_addend - symbol_addr; break; +/*TODO: case R_X86_64_RELATIVE: + *reloc_addr = load_addr + rpnt->r_addend; + break; */ default: _dl_exit(1); } -- cgit v1.2.3 From 803ea5ff0514ba250b23d134590b5c5d53a994f8 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 20:42:18 +0200 Subject: lll: avoid shadow warnings use __ret uniformly to avoid shadow warnings as seen on x86_64. Signed-off-by: Bernhard Reutner-Fischer --- .../sysdeps/unix/sysv/linux/i386/lowlevellock.h | 32 ++++---- .../nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h | 96 +++++++++++----------- .../sysdeps/unix/sysv/linux/x86_64/lowlevellock.h | 32 ++++---- 3 files changed, 80 insertions(+), 80 deletions(-) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h index ab1a9395e..db951a10e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/lowlevellock.h @@ -336,7 +336,7 @@ LLL_STUB_UNWIND_INFO_END }) #define lll_robust_lock(futex, id, private) \ - ({ int __result, ignore1, ignore2; \ + ({ int __ret, ignore1, ignore2; \ __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %2\n\t" \ "jnz _L_robust_lock_%=\n\t" \ ".subsection 1\n\t" \ @@ -350,11 +350,11 @@ LLL_STUB_UNWIND_INFO_END ".previous\n" \ LLL_STUB_UNWIND_INFO_4 \ "18:" \ - : "=a" (__result), "=c" (ignore1), "=m" (futex), \ + : "=a" (__ret), "=c" (ignore1), "=m" (futex), \ "=&d" (ignore2) \ : "0" (0), "1" (id), "m" (futex), "g" ((int) (private))\ : "memory"); \ - __result; }) + __ret; }) /* Special version of lll_lock which causes the unlock function to @@ -383,7 +383,7 @@ LLL_STUB_UNWIND_INFO_END #define lll_robust_cond_lock(futex, id, private) \ - ({ int __result, ignore1, ignore2; \ + ({ int __ret, ignore1, ignore2; \ __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %2\n\t" \ "jnz _L_robust_cond_lock_%=\n\t" \ ".subsection 1\n\t" \ @@ -397,16 +397,16 @@ LLL_STUB_UNWIND_INFO_END ".previous\n" \ LLL_STUB_UNWIND_INFO_4 \ "18:" \ - : "=a" (__result), "=c" (ignore1), "=m" (futex), \ + : "=a" (__ret), "=c" (ignore1), "=m" (futex), \ "=&d" (ignore2) \ : "0" (0), "1" (id | FUTEX_WAITERS), "m" (futex), \ "g" ((int) (private)) \ : "memory"); \ - __result; }) + __ret; }) #define lll_timedlock(futex, timeout, private) \ - ({ int __result, ignore1, ignore2, ignore3; \ + ({ int __ret, ignore1, ignore2, ignore3; \ __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %3\n\t" \ "jnz _L_timedlock_%=\n\t" \ ".subsection 1\n\t" \ @@ -420,16 +420,16 @@ LLL_STUB_UNWIND_INFO_END ".previous\n" \ LLL_STUB_UNWIND_INFO_4 \ "18:" \ - : "=a" (__result), "=c" (ignore1), "=&d" (ignore2), \ + : "=a" (__ret), "=c" (ignore1), "=&d" (ignore2), \ "=m" (futex), "=S" (ignore3) \ : "0" (0), "1" (1), "m" (futex), "m" (timeout), \ "4" ((int) (private)) \ : "memory"); \ - __result; }) + __ret; }) #define lll_robust_timedlock(futex, timeout, id, private) \ - ({ int __result, ignore1, ignore2, ignore3; \ + ({ int __ret, ignore1, ignore2, ignore3; \ __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %3\n\t" \ "jnz _L_robust_timedlock_%=\n\t" \ ".subsection 1\n\t" \ @@ -443,12 +443,12 @@ LLL_STUB_UNWIND_INFO_END ".previous\n" \ LLL_STUB_UNWIND_INFO_4 \ "18:" \ - : "=a" (__result), "=c" (ignore1), "=&d" (ignore2), \ + : "=a" (__ret), "=c" (ignore1), "=&d" (ignore2), \ "=m" (futex), "=S" (ignore3) \ : "0" (0), "1" (id), "m" (futex), "m" (timeout), \ "4" ((int) (private)) \ : "memory"); \ - __result; }) + __ret; }) #if defined NOT_IN_libc || defined UP # define __lll_unlock_asm LOCK_INSTR "subl $1, %0\n\t" @@ -570,15 +570,15 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime) __attribute__ ((regparm (2))) attribute_hidden; #define lll_timedwait_tid(tid, abstime) \ ({ \ - int __result = 0; \ + int __ret = 0; \ if (tid != 0) \ { \ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) \ - __result = EINVAL; \ + __ret = EINVAL; \ else \ - __result = __lll_timedwait_tid (&tid, abstime); \ + __ret = __lll_timedwait_tid (&tid, abstime); \ } \ - __result; }) + __ret; }) #endif /* !__ASSEMBLER__ */ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h index 0ea67e0ef..d10cd6116 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sh/lowlevellock.h @@ -98,7 +98,7 @@ extern int __lll_unlock_wake_private (int *__futex) attribute_hidden; extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; #define lll_trylock(futex) \ - ({ unsigned char __result; \ + ({ unsigned char __ret; \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -112,15 +112,15 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; 1: mov r1,r15\n\ mov #-1,%0\n\ negc %0,%0"\ - : "=r" (__result) \ + : "=r" (__ret) \ : "r" (&(futex)), \ "r" (LLL_LOCK_INITIALIZER_LOCKED), \ "r" (LLL_LOCK_INITIALIZER) \ : "r0", "r1", "r2", "t", "memory"); \ - __result; }) + __ret; }) #define lll_robust_trylock(futex, id) \ - ({ unsigned char __result; \ + ({ unsigned char __ret; \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -134,15 +134,15 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; 1: mov r1,r15\n\ mov #-1,%0\n\ negc %0,%0"\ - : "=r" (__result) \ + : "=r" (__ret) \ : "r" (&(futex)), \ "r" (id), \ "r" (LLL_LOCK_INITIALIZER) \ : "r0", "r1", "r2", "t", "memory"); \ - __result; }) + __ret; }) #define lll_cond_trylock(futex) \ - ({ unsigned char __result; \ + ({ unsigned char __ret; \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -156,15 +156,15 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; 1: mov r1,r15\n\ mov #-1,%0\n\ negc %0,%0"\ - : "=r" (__result) \ + : "=r" (__ret) \ : "r" (&(futex)), \ "r" (LLL_LOCK_INITIALIZER_WAITERS), \ "r" (LLL_LOCK_INITIALIZER) \ : "r0", "r1", "r2", "t", "memory"); \ - __result; }) + __ret; }) #define lll_lock(futex, private) \ - (void) ({ int __result, *__futex = &(futex); \ + (void) ({ int __ret, *__futex = &(futex); \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -176,20 +176,20 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; bf 1f\n\ mov.l %1,@%2\n\ 1: mov r1,r15"\ - : "=&r" (__result) : "r" (1), "r" (__futex) \ + : "=&r" (__ret) : "r" (1), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ - if (__result) \ + if (__ret) \ { \ if (__builtin_constant_p (private) \ && (private) == LLL_PRIVATE) \ - __lll_lock_wait_private (__result, __futex); \ + __lll_lock_wait_private (__ret, __futex); \ else \ - __lll_lock_wait (__result, __futex, (private)); \ + __lll_lock_wait (__ret, __futex, (private)); \ } \ }) #define lll_robust_lock(futex, id, private) \ - ({ int __result, *__futex = &(futex); \ + ({ int __ret, *__futex = &(futex); \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -201,16 +201,16 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; bf 1f\n\ mov.l %1,@%2\n\ 1: mov r1,r15"\ - : "=&r" (__result) : "r" (id), "r" (__futex) \ + : "=&r" (__ret) : "r" (id), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ - if (__result) \ - __result = __lll_robust_lock_wait (__result, __futex, private); \ - __result; }) + if (__ret) \ + __ret = __lll_robust_lock_wait (__ret, __futex, private); \ + __ret; }) /* Special version of lll_mutex_lock which causes the unlock function to always wakeup waiters. */ #define lll_cond_lock(futex, private) \ - (void) ({ int __result, *__futex = &(futex); \ + (void) ({ int __ret, *__futex = &(futex); \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -222,13 +222,13 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; bf 1f\n\ mov.l %1,@%2\n\ 1: mov r1,r15"\ - : "=&r" (__result) : "r" (2), "r" (__futex) \ + : "=&r" (__ret) : "r" (2), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ - if (__result) \ - __lll_lock_wait (__result, __futex, private); }) + if (__ret) \ + __lll_lock_wait (__ret, __futex, private); }) #define lll_robust_cond_lock(futex, id, private) \ - ({ int __result, *__futex = &(futex); \ + ({ int __ret, *__futex = &(futex); \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -240,14 +240,14 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; bf 1f\n\ mov.l %1,@%2\n\ 1: mov r1,r15"\ - : "=&r" (__result) : "r" (id | FUTEX_WAITERS), "r" (__futex) \ + : "=&r" (__ret) : "r" (id | FUTEX_WAITERS), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ - if (__result) \ - __result = __lll_robust_lock_wait (__result, __futex, private); \ - __result; }) + if (__ret) \ + __ret = __lll_robust_lock_wait (__ret, __futex, private); \ + __ret; }) #define lll_timedlock(futex, timeout, private) \ - ({ int __result, *__futex = &(futex); \ + ({ int __ret, *__futex = &(futex); \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -259,14 +259,14 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; bf 1f\n\ mov.l %1,@%2\n\ 1: mov r1,r15"\ - : "=&r" (__result) : "r" (1), "r" (__futex) \ + : "=&r" (__ret) : "r" (1), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ - if (__result) \ - __result = __lll_timedlock_wait (__result, __futex, timeout, private); \ - __result; }) + if (__ret) \ + __ret = __lll_timedlock_wait (__ret, __futex, timeout, private); \ + __ret; }) #define lll_robust_timedlock(futex, timeout, id, private) \ - ({ int __result, *__futex = &(futex); \ + ({ int __ret, *__futex = &(futex); \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -278,15 +278,15 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; bf 1f\n\ mov.l %1,@%2\n\ 1: mov r1,r15"\ - : "=&r" (__result) : "r" (id), "r" (__futex) \ + : "=&r" (__ret) : "r" (id), "r" (__futex) \ : "r0", "r1", "t", "memory"); \ - if (__result) \ - __result = __lll_robust_timedlock_wait (__result, __futex, \ + if (__ret) \ + __ret = __lll_robust_timedlock_wait (__ret, __futex, \ timeout, private); \ - __result; }) + __ret; }) #define lll_unlock(futex, private) \ - (void) ({ int __result, *__futex = &(futex); \ + (void) ({ int __ret, *__futex = &(futex); \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -296,9 +296,9 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; add #-1,%0\n\ mov.l %0,@%1\n\ 1: mov r1,r15"\ - : "=&r" (__result) : "r" (__futex) \ + : "=&r" (__ret) : "r" (__futex) \ : "r0", "r1", "memory"); \ - if (__result) \ + if (__ret) \ { \ if (__builtin_constant_p (private) \ && (private) == LLL_PRIVATE) \ @@ -309,7 +309,7 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; }) #define lll_robust_unlock(futex, private) \ - (void) ({ int __result, *__futex = &(futex); \ + (void) ({ int __ret, *__futex = &(futex); \ __asm__ __volatile__ ("\ .align 2\n\ mova 1f,r0\n\ @@ -319,9 +319,9 @@ extern int __lll_unlock_wake (int *__futex, int private) attribute_hidden; and %2,%0\n\ mov.l %0,@%1\n\ 1: mov r1,r15"\ - : "=&r" (__result) : "r" (__futex), "r" (FUTEX_WAITERS) \ + : "=&r" (__ret) : "r" (__futex), "r" (FUTEX_WAITERS) \ : "r0", "r1", "memory"); \ - if (__result) \ + if (__ret) \ __lll_unlock_wake (__futex, private); }) #define lll_robust_dead(futex, private) \ @@ -405,15 +405,15 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime) attribute_hidden; #define lll_timedwait_tid(tid, abstime) \ ({ \ - int __result = 0; \ + int __ret = 0; \ if (tid != 0) \ { \ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) \ - __result = EINVAL; \ + __ret = EINVAL; \ else \ - __result = __lll_timedwait_tid (&tid, abstime); \ + __ret = __lll_timedwait_tid (&tid, abstime); \ } \ - __result; }) + __ret; }) #endif /* !__ASSEMBLER__ */ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h index ffab81eb5..afc40133e 100644 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h +++ b/libpthread/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.h @@ -332,7 +332,7 @@ LLL_STUB_UNWIND_INFO_END }) \ #define lll_robust_lock(futex, id, private) \ - ({ int result, ignore1, ignore2; \ + ({ int __ret, ignore1, ignore2; \ __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %4, %2\n\t" \ "jnz 1f\n\t" \ ".subsection 1\n\t" \ @@ -348,10 +348,10 @@ LLL_STUB_UNWIND_INFO_END LLL_STUB_UNWIND_INFO_5 \ "24:" \ : "=S" (ignore1), "=D" (ignore2), "=m" (futex), \ - "=a" (result) \ + "=a" (__ret) \ : "1" (id), "m" (futex), "3" (0), "0" (private) \ : "cx", "r11", "cc", "memory"); \ - result; }) + __ret; }) #define lll_cond_lock(futex, private) \ (void) \ @@ -377,7 +377,7 @@ LLL_STUB_UNWIND_INFO_END }) #define lll_robust_cond_lock(futex, id, private) \ - ({ int result, ignore1, ignore2; \ + ({ int __ret, ignore1, ignore2; \ __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %4, %2\n\t" \ "jnz 1f\n\t" \ ".subsection 1\n\t" \ @@ -393,14 +393,14 @@ LLL_STUB_UNWIND_INFO_END LLL_STUB_UNWIND_INFO_5 \ "24:" \ : "=S" (ignore1), "=D" (ignore2), "=m" (futex), \ - "=a" (result) \ + "=a" (__ret) \ : "1" (id | FUTEX_WAITERS), "m" (futex), "3" (0), \ "0" (private) \ : "cx", "r11", "cc", "memory"); \ - result; }) + __ret; }) #define lll_timedlock(futex, timeout, private) \ - ({ int result, ignore1, ignore2, ignore3; \ + ({ int __ret, ignore1, ignore2, ignore3; \ __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %4\n\t" \ "jnz 1f\n\t" \ ".subsection 1\n\t" \ @@ -416,15 +416,15 @@ LLL_STUB_UNWIND_INFO_END ".previous\n" \ LLL_STUB_UNWIND_INFO_6 \ "24:" \ - : "=a" (result), "=D" (ignore1), "=S" (ignore2), \ + : "=a" (__ret), "=D" (ignore1), "=S" (ignore2), \ "=&d" (ignore3), "=m" (futex) \ : "0" (0), "1" (1), "m" (futex), "m" (timeout), \ "2" (private) \ : "memory", "cx", "cc", "r10", "r11"); \ - result; }) + __ret; }) #define lll_robust_timedlock(futex, timeout, id, private) \ - ({ int result, ignore1, ignore2, ignore3; \ + ({ int __ret, ignore1, ignore2, ignore3; \ __asm__ __volatile__ (LOCK_INSTR "cmpxchgl %1, %4\n\t" \ "jnz 1f\n\t" \ ".subsection 1\n\t" \ @@ -440,12 +440,12 @@ LLL_STUB_UNWIND_INFO_END ".previous\n" \ LLL_STUB_UNWIND_INFO_6 \ "24:" \ - : "=a" (result), "=D" (ignore1), "=S" (ignore2), \ + : "=a" (__ret), "=D" (ignore1), "=S" (ignore2), \ "=&d" (ignore3), "=m" (futex) \ : "0" (0), "1" (id), "m" (futex), "m" (timeout), \ "2" (private) \ : "memory", "cx", "cc", "r10", "r11"); \ - result; }) + __ret; }) #if defined NOT_IN_libc || defined UP # define __lll_unlock_asm_start LOCK_INSTR "decl %0\n\t" \ @@ -583,15 +583,15 @@ extern int __lll_timedwait_tid (int *tid, const struct timespec *abstime) attribute_hidden; #define lll_timedwait_tid(tid, abstime) \ ({ \ - int __result = 0; \ + int __ret = 0; \ if (tid != 0) \ { \ if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000) \ - __result = EINVAL; \ + __ret = EINVAL; \ else \ - __result = __lll_timedwait_tid (&tid, abstime); \ + __ret = __lll_timedwait_tid (&tid, abstime); \ } \ - __result; }) + __ret; }) #endif /* !__ASSEMBLER__ */ -- cgit v1.2.3 From 23b99061c80f6979cdf873e534f6cd213b460781 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 21:16:23 +0200 Subject: buildsys: document UCLIBC_EXTRA_CPPFLAGS Rename EXTRA_CPPFLAGS to UCLIBC_EXTRA_CPPFLAGS and make them override previous flags (by appending - not prepending - them to the other flags). --- Makefile.help | 1 + Makerules | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile.help b/Makefile.help index 1c2c96e04..d99cf9634 100644 --- a/Makefile.help +++ b/Makefile.help @@ -60,4 +60,5 @@ help: @echo ' and the include dir (usually "/usr")' @echo ' MULTILIB_DIR= - Directory component for libraries (default "lib").' @echo ' UCLIBC_EXTRA_CFLAGS - extra CFLAGS for compiling uClibc' + @echo ' UCLIBC_EXTRA_CPPFLAGS - extra CPPFLAGS for compiling uClibc' diff --git a/Makerules b/Makerules index f045e527f..7a3962cac 100644 --- a/Makerules +++ b/Makerules @@ -233,12 +233,12 @@ cmd_compile.c = $(CC) -c $< -o $@ $(CFLAGS) \ $(CFLAGS-$(notdir $<)) \ $(CFLAGS-$(notdir $@)) \ $(CFLAGS_gen.dep) -cmd_compile.i = $(cmd_compile.c:-c=-E -dD $(EXTRA_CPPFLAGS)) +cmd_compile.i = $(cmd_compile.c:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS) cmd_compile.s = $(cmd_compile.c:-c=-S) cmd_compile.u = $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@)) $(CFLAGS_gen.dep) cmd_compile.S = $(filter-out -std=gnu99, $(cmd_compile.c)) -D__ASSEMBLER__ $(ASFLAGS) $(ARCH_ASFLAGS) $(ASFLAGS-$(suffix $@)) $(ASFLAGS-$(notdir $<)) $(ASFLAGS-$(notdir $@)) cmd_compile.m = $(cmd_compile.c) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@)) -cmd_compile.mi= $(cmd_compile.m:-c=-E -dD $(EXTRA_CPPFLAGS)) +cmd_compile.mi= $(cmd_compile.m:-c=-E -dD) $(UCLIBC_EXTRA_CPPFLAGS) cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(notdir $(@D))) $(CFLAGS-$(notdir $@)) $(sort $(foreach d,$(^:$(top_srcdir)=),$(collect_multi_flags))) cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^ -- cgit v1.2.3 From bf5dd19d97991de30486abaedb1868f6eb049a70 Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Wed, 11 May 2011 09:28:13 +0200 Subject: Implement epoll_create1 and epoll_pwait system calls. Note: TODO: This lacks cancellation support. Signed-off-by: Thierry Reding Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/epoll.c | 16 ++++++++++++++ libc/sysdeps/linux/common/sys/epoll.h | 40 +++++++++++++++++++++++++++++++---- libc/sysdeps/linux/x86_64/sys/epoll.h | 36 ++++++++++++++++++++++++++++++- 3 files changed, 87 insertions(+), 5 deletions(-) diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c index dda92282e..41c4eacc2 100644 --- a/libc/sysdeps/linux/common/epoll.c +++ b/libc/sysdeps/linux/common/epoll.c @@ -17,6 +17,13 @@ _syscall1(int, epoll_create, int, size) #endif +/* + * epoll_create1() + */ +#ifdef __NR_epoll_create1 +_syscall1(int, epoll_create1, int, flags) +#endif + /* * epoll_ctl() */ @@ -29,4 +36,13 @@ _syscall4(int,epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, even */ #ifdef __NR_epoll_wait _syscall4(int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout) +/* TODO: add cancellation for epoll_wait */ +#endif + +/* + * epoll_pwait() + */ +#ifdef __NR_epoll_pwait +_syscall5(int, epoll_pwait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout, __const sigset_t *, ss) +/* TODO: add cancellation for epoll_pwait */ #endif diff --git a/libc/sysdeps/linux/common/sys/epoll.h b/libc/sysdeps/linux/common/sys/epoll.h index 44e814bfd..f6a648872 100644 --- a/libc/sysdeps/linux/common/sys/epoll.h +++ b/libc/sysdeps/linux/common/sys/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002-2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,6 +22,24 @@ #include #include +/* Get __sigset_t. */ +#include + +#ifndef __sigset_t_defined +# define __sigset_t_defined +typedef __sigset_t sigset_t; +#endif + + +/* Flags to be passed to epoll_create1. */ +enum + { + EPOLL_CLOEXEC = 02000000, +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 04000 +#define EPOLL_NONBLOCK EPOLL_NONBLOCK + }; + enum EPOLL_EVENTS { @@ -55,9 +73,9 @@ enum EPOLL_EVENTS /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ -#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */ -#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */ -#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */ +#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ +#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ +#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ typedef union epoll_data @@ -83,6 +101,10 @@ __BEGIN_DECLS returned by epoll_create() should be closed with close(). */ extern int epoll_create (int __size) __THROW; +/* Same as epoll_create but with a FLAGS parameter. The unused SIZE + parameter has been dropped. */ +extern int epoll_create1 (int __flags) __THROW; + /* Manipulate an epoll instance "epfd". Returns 0 in case of success, -1 in case of error ( the "errno" variable will contain the @@ -107,6 +129,16 @@ extern int epoll_ctl (int __epfd, int __op, int __fd, extern int epoll_wait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout); + +/* Same as epoll_wait, but the thread's signal mask is temporarily + and atomically replaced with the one provided as parameter. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int epoll_pwait (int __epfd, struct epoll_event *__events, + int __maxevents, int __timeout, + __const __sigset_t *__ss); + __END_DECLS #endif /* sys/epoll.h */ diff --git a/libc/sysdeps/linux/x86_64/sys/epoll.h b/libc/sysdeps/linux/x86_64/sys/epoll.h index 02672d3c7..a8171cc36 100644 --- a/libc/sysdeps/linux/x86_64/sys/epoll.h +++ b/libc/sysdeps/linux/x86_64/sys/epoll.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 2002-2008, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,6 +22,24 @@ #include #include +/* Get __sigset_t. */ +#include + +#ifndef __sigset_t_defined +# define __sigset_t_defined +typedef __sigset_t sigset_t; +#endif + + +/* Flags to be passed to epoll_create1. */ +enum + { + EPOLL_CLOEXEC = 02000000, +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 04000 +#define EPOLL_NONBLOCK EPOLL_NONBLOCK + }; + enum EPOLL_EVENTS { @@ -45,6 +63,8 @@ enum EPOLL_EVENTS #define EPOLLERR EPOLLERR EPOLLHUP = 0x010, #define EPOLLHUP EPOLLHUP + EPOLLRDHUP = 0x2000, +#define EPOLLRDHUP EPOLLRDHUP EPOLLONESHOT = (1 << 30), #define EPOLLONESHOT EPOLLONESHOT EPOLLET = (1 << 31) @@ -81,6 +101,10 @@ __BEGIN_DECLS returned by epoll_create() should be closed with close(). */ extern int epoll_create (int __size) __THROW; +/* Same as epoll_create but with a FLAGS parameter. The unused SIZE + parameter has been dropped. */ +extern int epoll_create1 (int __flags) __THROW; + /* Manipulate an epoll instance "epfd". Returns 0 in case of success, -1 in case of error ( the "errno" variable will contain the @@ -105,6 +129,16 @@ extern int epoll_ctl (int __epfd, int __op, int __fd, extern int epoll_wait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout); + +/* Same as epoll_wait, but the thread's signal mask is temporarily + and atomically replaced with the one provided as parameter. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int epoll_pwait (int __epfd, struct epoll_event *__events, + int __maxevents, int __timeout, + __const __sigset_t *__ss); + __END_DECLS #endif /* sys/epoll.h */ -- cgit v1.2.3 From c91c3a2b27f5909e190cde4518383864298e82af Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 22:03:33 +0200 Subject: commentary typo fix use cancellation (with two 'l') uniformly. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/x86_64/sys/epoll.h | 6 +++--- libpthread/linuxthreads.old/cancel.c | 2 +- libpthread/linuxthreads.old/pthread.c | 2 +- libpthread/linuxthreads.old/wrapsyscall.c | 2 +- libpthread/nptl/ChangeLog | 4 ++-- libpthread/nptl/pthreadP.h | 2 +- libpthread/nptl/sysdeps/pthread/pthread_once.c | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/libc/sysdeps/linux/x86_64/sys/epoll.h b/libc/sysdeps/linux/x86_64/sys/epoll.h index a8171cc36..bd5b30812 100644 --- a/libc/sysdeps/linux/x86_64/sys/epoll.h +++ b/libc/sysdeps/linux/x86_64/sys/epoll.h @@ -73,9 +73,9 @@ enum EPOLL_EVENTS /* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ -#define EPOLL_CTL_ADD 1 /* Add a file decriptor to the interface. */ -#define EPOLL_CTL_DEL 2 /* Remove a file decriptor from the interface. */ -#define EPOLL_CTL_MOD 3 /* Change file decriptor epoll_event structure. */ +#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ +#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ +#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ typedef union epoll_data diff --git a/libpthread/linuxthreads.old/cancel.c b/libpthread/linuxthreads.old/cancel.c index 47534be66..0e5defb17 100644 --- a/libpthread/linuxthreads.old/cancel.c +++ b/libpthread/linuxthreads.old/cancel.c @@ -213,7 +213,7 @@ void __pthread_perform_cleanup(char *currentframe) } #ifndef __PIC__ -/* We need a hook to force the cancelation wrappers to be linked in when +/* We need a hook to force the cancellation wrappers to be linked in when static libpthread is used. */ extern const char __pthread_provide_wrappers; static const char *const __pthread_require_wrappers = diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index a8830b1a4..42e03f4dc 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -1159,7 +1159,7 @@ void __pthread_message(char * fmt, ...) #ifndef __PIC__ -/* We need a hook to force the cancelation wrappers to be linked in when +/* We need a hook to force the cancellation wrappers to be linked in when static libpthread is used. */ extern const char __pthread_provide_wrappers; static const char *const __pthread_require_wrappers = diff --git a/libpthread/linuxthreads.old/wrapsyscall.c b/libpthread/linuxthreads.old/wrapsyscall.c index 6e18388ca..e69ed6c8d 100644 --- a/libpthread/linuxthreads.old/wrapsyscall.c +++ b/libpthread/linuxthreads.old/wrapsyscall.c @@ -1,4 +1,4 @@ -/* Wrapper arpund system calls to provide cancelation points. +/* Wrapper arpund system calls to provide cancellation points. Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. diff --git a/libpthread/nptl/ChangeLog b/libpthread/nptl/ChangeLog index c81eb03b7..8ec6acde2 100644 --- a/libpthread/nptl/ChangeLog +++ b/libpthread/nptl/ChangeLog @@ -6717,7 +6717,7 @@ 2003-07-15 Ulrich Drepper - * tst-tcancel-wrappers.sh: lseek and llseek are not cancelation points. + * tst-tcancel-wrappers.sh: lseek and llseek are not cancellation points. 2003-07-14 Ulrich Drepper @@ -10990,7 +10990,7 @@ the static TLS block. (allocate_stack): Call _dl_allocate_tls_init for user-provided stack. - * cancellation.c: Renamed from cancelation.c. + * cancellation.c: Renamed from cancellation.c. * Makefile: Adjust accordingly. * pthreadP.h (CANCELLATION_P): Renamed from CANCELATION_P. * cleanup_defer.c: Use CANCELLATION_P. diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h index fb354eaa3..850562b1f 100644 --- a/libpthread/nptl/pthreadP.h +++ b/libpthread/nptl/pthreadP.h @@ -312,7 +312,7 @@ __do_cancel (void) # define LIBC_CANCEL_HANDLED() /* Nothing. */ #endif -/* The signal used for asynchronous cancelation. */ +/* The signal used for asynchronous cancellation. */ #define SIGCANCEL __SIGRTMIN diff --git a/libpthread/nptl/sysdeps/pthread/pthread_once.c b/libpthread/nptl/sysdeps/pthread/pthread_once.c index 57bb6b977..55131091a 100644 --- a/libpthread/nptl/sysdeps/pthread/pthread_once.c +++ b/libpthread/nptl/sysdeps/pthread/pthread_once.c @@ -38,7 +38,7 @@ __pthread_once ( lll_lock (once_lock, LLL_PRIVATE); /* XXX This implementation is not complete. It doesn't take - cancelation and fork into account. */ + cancellation and fork into account. */ if (*once_control == PTHREAD_ONCE_INIT) { init_routine (); -- cgit v1.2.3 From 3e72d1b5129c51cabf6b501a4698f7c2433781ce Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 22:17:23 +0200 Subject: epoll: unify epoll.h --- libc/sysdeps/linux/common/sys/epoll.h | 26 +++++- libc/sysdeps/linux/x86_64/sys/epoll.h | 144 ---------------------------------- 2 files changed, 24 insertions(+), 146 deletions(-) delete mode 100644 libc/sysdeps/linux/x86_64/sys/epoll.h diff --git a/libc/sysdeps/linux/common/sys/epoll.h b/libc/sysdeps/linux/common/sys/epoll.h index f6a648872..a04bd704c 100644 --- a/libc/sysdeps/linux/common/sys/epoll.h +++ b/libc/sysdeps/linux/common/sys/epoll.h @@ -32,12 +32,30 @@ typedef __sigset_t sigset_t; /* Flags to be passed to epoll_create1. */ + enum { +#if defined __alpha__ + EPOLL_CLOEXEC = 010000000, +# define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 04 +# define EPOLL_NONBLOCK EPOLL_NONBLOCK +#else +# if defined __sparc__ + EPOLL_CLOEXEC = 020000000, +# else EPOLL_CLOEXEC = 02000000, -#define EPOLL_CLOEXEC EPOLL_CLOEXEC +# endif +# define EPOLL_CLOEXEC EPOLL_CLOEXEC +# if defined __mips__ + EPOLL_NONBLOCK = 0200 +# elif defined __sparc__ + EPOLL_NONBLOCK = 040000 +# else EPOLL_NONBLOCK = 04000 +# endif #define EPOLL_NONBLOCK EPOLL_NONBLOCK +#endif }; @@ -90,7 +108,11 @@ struct epoll_event { uint32_t events; /* Epoll events */ epoll_data_t data; /* User data variable */ -}; +} +#if defined __x86_64__ +__attribute__((packed)) +#endif +; __BEGIN_DECLS diff --git a/libc/sysdeps/linux/x86_64/sys/epoll.h b/libc/sysdeps/linux/x86_64/sys/epoll.h deleted file mode 100644 index bd5b30812..000000000 --- a/libc/sysdeps/linux/x86_64/sys/epoll.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright (C) 2002-2008, 2010 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#ifndef _SYS_EPOLL_H -#define _SYS_EPOLL_H 1 - -#include -#include - -/* Get __sigset_t. */ -#include - -#ifndef __sigset_t_defined -# define __sigset_t_defined -typedef __sigset_t sigset_t; -#endif - - -/* Flags to be passed to epoll_create1. */ -enum - { - EPOLL_CLOEXEC = 02000000, -#define EPOLL_CLOEXEC EPOLL_CLOEXEC - EPOLL_NONBLOCK = 04000 -#define EPOLL_NONBLOCK EPOLL_NONBLOCK - }; - - -enum EPOLL_EVENTS - { - EPOLLIN = 0x001, -#define EPOLLIN EPOLLIN - EPOLLPRI = 0x002, -#define EPOLLPRI EPOLLPRI - EPOLLOUT = 0x004, -#define EPOLLOUT EPOLLOUT - EPOLLRDNORM = 0x040, -#define EPOLLRDNORM EPOLLRDNORM - EPOLLRDBAND = 0x080, -#define EPOLLRDBAND EPOLLRDBAND - EPOLLWRNORM = 0x100, -#define EPOLLWRNORM EPOLLWRNORM - EPOLLWRBAND = 0x200, -#define EPOLLWRBAND EPOLLWRBAND - EPOLLMSG = 0x400, -#define EPOLLMSG EPOLLMSG - EPOLLERR = 0x008, -#define EPOLLERR EPOLLERR - EPOLLHUP = 0x010, -#define EPOLLHUP EPOLLHUP - EPOLLRDHUP = 0x2000, -#define EPOLLRDHUP EPOLLRDHUP - EPOLLONESHOT = (1 << 30), -#define EPOLLONESHOT EPOLLONESHOT - EPOLLET = (1 << 31) -#define EPOLLET EPOLLET - }; - - -/* Valid opcodes ( "op" parameter ) to issue to epoll_ctl(). */ -#define EPOLL_CTL_ADD 1 /* Add a file descriptor to the interface. */ -#define EPOLL_CTL_DEL 2 /* Remove a file descriptor from the interface. */ -#define EPOLL_CTL_MOD 3 /* Change file descriptor epoll_event structure. */ - - -typedef union epoll_data -{ - void *ptr; - int fd; - uint32_t u32; - uint64_t u64; -} epoll_data_t; - -struct epoll_event -{ - uint32_t events; /* Epoll events */ - epoll_data_t data; /* User data variable */ -} __attribute__ ((__packed__)); - - -__BEGIN_DECLS - -/* Creates an epoll instance. Returns an fd for the new instance. - The "size" parameter is a hint specifying the number of file - descriptors to be associated with the new instance. The fd - returned by epoll_create() should be closed with close(). */ -extern int epoll_create (int __size) __THROW; - -/* Same as epoll_create but with a FLAGS parameter. The unused SIZE - parameter has been dropped. */ -extern int epoll_create1 (int __flags) __THROW; - - -/* Manipulate an epoll instance "epfd". Returns 0 in case of success, - -1 in case of error ( the "errno" variable will contain the - specific error code ) The "op" parameter is one of the EPOLL_CTL_* - constants defined above. The "fd" parameter is the target of the - operation. The "event" parameter describes which events the caller - is interested in and any associated user data. */ -extern int epoll_ctl (int __epfd, int __op, int __fd, - struct epoll_event *__event) __THROW; - - -/* Wait for events on an epoll instance "epfd". Returns the number of - triggered events returned in "events" buffer. Or -1 in case of - error with the "errno" variable set to the specific error code. The - "events" parameter is a buffer that will contain triggered - events. The "maxevents" is the maximum number of events to be - returned ( usually size of "events" ). The "timeout" parameter - specifies the maximum wait time in milliseconds (-1 == infinite). - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int epoll_wait (int __epfd, struct epoll_event *__events, - int __maxevents, int __timeout); - - -/* Same as epoll_wait, but the thread's signal mask is temporarily - and atomically replaced with the one provided as parameter. - - This function is a cancellation point and therefore not marked with - __THROW. */ -extern int epoll_pwait (int __epfd, struct epoll_event *__events, - int __maxevents, int __timeout, - __const __sigset_t *__ss); - -__END_DECLS - -#endif /* sys/epoll.h */ -- cgit v1.2.3 From 4eebb1ab2c9954b9b1ef7480c4d2a797513193de Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Wed, 11 May 2011 22:22:51 +0200 Subject: commentary typo fix s/decriptor/descriptor/ Signed-off-by: Bernhard Reutner-Fischer --- libpthread/linuxthreads.old_db/td_ta_delete.c | 2 +- libpthread/linuxthreads_db/td_ta_delete.c | 2 +- libpthread/nptl/ChangeLog | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libpthread/linuxthreads.old_db/td_ta_delete.c b/libpthread/linuxthreads.old_db/td_ta_delete.c index 0e6ec17d0..be1165af2 100644 --- a/libpthread/linuxthreads.old_db/td_ta_delete.c +++ b/libpthread/linuxthreads.old_db/td_ta_delete.c @@ -45,7 +45,7 @@ td_ta_delete (td_thragent_t *ta) runp = runp->next; if (runp->next == NULL) - /* It's not a valid decriptor since it is not in the list. */ + /* It's not a valid descriptor since it is not in the list. */ return TD_BADTA; runp->next = runp->next->next; diff --git a/libpthread/linuxthreads_db/td_ta_delete.c b/libpthread/linuxthreads_db/td_ta_delete.c index 0e6ec17d0..be1165af2 100644 --- a/libpthread/linuxthreads_db/td_ta_delete.c +++ b/libpthread/linuxthreads_db/td_ta_delete.c @@ -45,7 +45,7 @@ td_ta_delete (td_thragent_t *ta) runp = runp->next; if (runp->next == NULL) - /* It's not a valid decriptor since it is not in the list. */ + /* It's not a valid descriptor since it is not in the list. */ return TD_BADTA; runp->next = runp->next->next; diff --git a/libpthread/nptl/ChangeLog b/libpthread/nptl/ChangeLog index 8ec6acde2..ec22ebb64 100644 --- a/libpthread/nptl/ChangeLog +++ b/libpthread/nptl/ChangeLog @@ -10308,7 +10308,7 @@ * sysdeps/unix/sysv/linux/i386/sysdep-cancel.h: Define SINGLE_THREAD_P. If in libc or libpthread examine multiple_thread - member of thread decriptor, otherwise return unconditionally 1. + member of thread descriptor, otherwise return unconditionally 1. 2002-12-14 Ulrich Drepper -- cgit v1.2.3 From 213709e1e14418f728b52c8fefb4af505c99d567 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 12 May 2011 10:07:25 +0200 Subject: socket: fix stubs Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/stubs.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/libc/sysdeps/linux/common/stubs.c b/libc/sysdeps/linux/common/stubs.c index f7c6dc5c5..e14bbc3a0 100644 --- a/libc/sysdeps/linux/common/stubs.c +++ b/libc/sysdeps/linux/common/stubs.c @@ -57,11 +57,11 @@ static int enosys_stub(void) # undef __NR_socketpair #endif -#ifndef __NR_accept +#if !defined __NR_accept && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(accept) #endif -#ifndef __NR_accept4 +#if !defined __NR_accept4 && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(accept4) #endif @@ -69,7 +69,7 @@ make_stub(accept4) make_stub(bdflush) #endif -#ifndef __NR_bind +#if !defined __NR_bind && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(bind) #endif @@ -81,7 +81,7 @@ make_stub(capget) make_stub(capset) #endif -#ifndef __NR_connect +#if !defined __NR_connect && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(connect) #endif @@ -133,7 +133,7 @@ make_stub(fsetxattr) make_stub(get_kernel_syms) #endif -#ifndef __NR_getpeername +#if !defined __NR_getpeername && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(getpeername) #endif @@ -141,11 +141,11 @@ make_stub(getpeername) make_stub(getpgrp) #endif -#ifndef __NR_getsockname +#if !defined __NR_getsockname && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(getsockname) #endif -#ifndef __NR_getsockopt +#if !defined __NR_getsockopt && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(getsockopt) #endif @@ -161,7 +161,7 @@ make_stub(init_module) make_stub(lgetxattr) #endif -#ifndef __NR_listen +#if !defined __NR_listen && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(listen) #endif @@ -193,15 +193,15 @@ make_stub(pivot_root) make_stub(query_module) #endif -#ifndef __NR_recv +#if !defined __NR_recv && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(recv) #endif -#ifndef __NR_recvfrom +#if !defined __NR_recvfrom && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(recvfrom) #endif -#ifndef __NR_recvmsg +#if !defined __NR_recvmsg && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(recvmsg) #endif @@ -217,19 +217,19 @@ make_stub(sched_getaffinity) make_stub(sched_setaffinity) #endif -#ifndef __NR_send +#if !defined __NR_send && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(send) #endif -#ifndef __NR_sendmsg +#if !defined __NR_sendmsg && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(sendmsg) #endif -#ifndef __NR_sendto +#if !defined __NR_sendto && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(sendto) #endif -#ifndef __NR_setsockopt +#if !defined __NR_setsockopt && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(setsockopt) #endif @@ -237,7 +237,7 @@ make_stub(setsockopt) make_stub(setxattr) #endif -#ifndef __NR_shutdown +#if !defined __NR_shutdown && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(shutdown) #endif @@ -245,15 +245,15 @@ make_stub(shutdown) make_stub(signalfd) #endif -#ifndef __NR_socket +#if !defined __NR_socket && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(socket) #endif -#ifndef __NR_socketcall +#if !defined __NR_socketcall && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(socketcall) #endif -#ifndef __NR_socketpair +#if !defined __NR_socketpair && !defined __NR_socketcall && !defined __UCLIBC_HAS_SOCKET__ make_stub(socketpair) #endif -- cgit v1.2.3 From 3fb846d24c2b74f6dba36580315e1666eca015ee Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 12 May 2011 10:30:48 +0200 Subject: NPTL: needs madvise internally This fixes 8d09a50a044638fde2ed3e1a1c4d3c7c5a3cce5c since NPTL also uses madvise internally. Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/Makefile.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index d97c73dcb..27cbbf420 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -19,15 +19,14 @@ CSRC-$(UCLIBC_LINUX_MODULE_24) += create_module.c query_module.c \ get_kernel_syms.c # we need these internally: fstatfs.c statfs.c CSRC-$(UCLIBC_LINUX_SPECIFIC) += capget.c capset.c inotify.c ioperm.c iopl.c \ - madvise.c modify_ldt.c pipe2.c personality.c ppoll.c prctl.c \ + modify_ldt.c pipe2.c personality.c ppoll.c prctl.c \ readahead.c reboot.c \ remap_file_pages.c sched_getaffinity.c sched_setaffinity.c \ sendfile64.c sendfile.c setfsgid.c setfsuid.c setresuid.c \ splice.c vmsplice.c tee.c signalfd.c swapoff.c swapon.c \ sync_file_range.c sysctl.c sysinfo.c timerfd.c uselib.c vhangup.c -ifeq ($(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE),yy) -CSRC-y += madvise.c -endif +# NPTL needs these internally: madvise.c +CSRC-$(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE)) += madvise.c ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y) CSRC- += fork.c getpid.c raise.c open.c close.c read.c write.c CSRC- += $(if $(findstring =arm=,=$(TARGET_ARCH)=),vfork.c) -- cgit v1.2.3 From 44100dac1138c480deabb72ee8e180544005dfd9 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 12 May 2011 10:37:36 +0200 Subject: linux_specific: handle accept4 and pipe2 Signed-off-by: Bernhard Reutner-Fischer --- extra/Configs/Config.in | 1 + include/sys/socket.h | 2 +- include/unistd.h | 2 +- libc/inet/Makefile.in | 3 +-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in index 7dffdeab9..e41adc465 100644 --- a/extra/Configs/Config.in +++ b/extra/Configs/Config.in @@ -914,6 +914,7 @@ config UCLIBC_LINUX_SPECIFIC bool "Linux specific functions" default y help + accept4(), capget(), capset(), fstatfs(), inotify_*(), ioperm(), iopl(), madvise(), modify_ldt(), pipe2(), personality(), prctl()/arch_prctl(), diff --git a/include/sys/socket.h b/include/sys/socket.h index 5d38f1105..6037f92ae 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -227,7 +227,7 @@ extern int accept (int __fd, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len); libc_hidden_proto(accept) -#ifdef __USE_GNU +#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU /* Similar to 'accept' but takes an additional parameter to specify flags. This function is a cancellation point and therefore not marked with diff --git a/include/unistd.h b/include/unistd.h index 6b614dd05..956879003 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -389,7 +389,7 @@ extern ssize_t pwrite64 (int __fd, __const void *__buf, size_t __n, extern int pipe (int __pipedes[2]) __THROW __wur; libc_hidden_proto(pipe) -#ifdef __USE_GNU +#if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU /* Same as pipe but apply flags passed in FLAGS to the new file descriptors. */ extern int pipe2 (int __pipedes[2], int __flags) __THROW __wur; diff --git a/libc/inet/Makefile.in b/libc/inet/Makefile.in index c490adf7e..d58822074 100644 --- a/libc/inet/Makefile.in +++ b/libc/inet/Makefile.in @@ -48,8 +48,7 @@ socketcalls_CSRC-y += \ accept.c bind.c connect.c getpeername.c getsockname.c \ getsockopt.c listen.c recv.c recvfrom.c recvmsg.c send.c sendmsg.c \ sendto.c setsockopt.c shutdown.c socket.c socketpair.c -# FIXME: GNU / linux specific -socketcalls_CSRC-y += accept4.c +socketcalls_CSRC-$(UCLIBC_LINUX_SPECIFIC) += accept4.c CSRC-$(UCLIBC_HAS_SOCKET) += $(socketcalls_CSRC-y) opensock.c CSRC-$(findstring y,$(UCLIBC_HAS_SOCKET)$(UCLIBC_HAS_IPV4)$(UCLIBC_HAS_IPV6)) += ethers.c ether_addr.c -- cgit v1.2.3 From f6e44ebb529508cbc6ae5ef6a24614b85ad0f16f Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 12 May 2011 12:11:14 +0200 Subject: wordexp: fix mishandled return value of pipe call and use pipe2 if available while at it. Signed-off-by: Bernhard Reutner-Fischer --- libc/misc/wordexp/wordexp.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c index 4c25d2860..700ea2c23 100644 --- a/libc/misc/wordexp/wordexp.c +++ b/libc/misc/wordexp/wordexp.c @@ -20,6 +20,7 @@ Boston, MA 02111-1307, USA. */ #include +#include #include #include #include @@ -757,16 +758,21 @@ exec_comm_child(char *comm, int *fildes, int showerr, int noexec) /* Redirect output. */ fd = fildes[1]; - if (fd != 1) { - dup2(fd, 1); + if (likely(fd != STDOUT_FILENO)) { + dup2(fd, STDOUT_FILENO); close(fd); } - +#if defined O_CLOEXEC && defined __UCLIBC_LINUX_SPECIFIC__ && defined __ASSUME_PIPE2 + else { + /* Reset the close-on-exec flag (if necessary). */ + fcntl (fd, F_SETFD, 0); + } +#endif /* Redirect stderr to /dev/null if we have to. */ if (showerr == 0) { - close(2); + close(STDERR_FILENO); fd = open(_PATH_DEVNULL, O_WRONLY); - if (fd >= 0 && fd != 2) { + if (fd >= 0 && fd != STDERR_FILENO) { dup2(fd, 2); close(fd); } @@ -802,10 +808,15 @@ exec_comm(char *comm, char **word, size_t * word_length, /* Don't fork() unless necessary */ if (!comm || !*comm) return 0; - - if (pipe(fildes)) +#if defined O_CLOEXEC && defined __UCLIBC_LINUX_SPECIFIC__ && defined __ASSUME_PIPE2 + if (pipe2(fildes, O_CLOEXEC) < 0) /* Bad */ return WRDE_NOSPACE; +#else + if (pipe(fildes) < 0) + /* Bad */ + return WRDE_NOSPACE; +#endif if ((pid = fork()) < 0) { /* Bad */ -- cgit v1.2.3 From 2fbbd10ac6a8218555e2ed731a95b275957b2261 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Thu, 12 May 2011 12:26:41 +0200 Subject: libm: fix building out-of-tree Thanks to Thierry Reding for noticing! Signed-off-by: Bernhard Reutner-Fischer --- libm/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libm/Makefile.in b/libm/Makefile.in index 223593304..f0aaa2aff 100644 --- a/libm/Makefile.in +++ b/libm/Makefile.in @@ -20,7 +20,7 @@ # by Erik Andersen # -subdirs += libm +subdirs += libm libm/$(TARGET_ARCH) CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS) CFLAGS-libm += -D_IEEE_LIBM -- cgit v1.2.3 From c6057584e07fae9c8b96e6a5af0271b2e2bc85f6 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Fri, 13 May 2011 01:56:08 +0200 Subject: epoll.c: add cancellation to epoll_[p]wait() While there, fix epoll_pwait syscall, it takes 6 arguments Signed-off-by: Peter S. Mazinger Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/epoll.c | 25 +++++++++++++++++++++---- libpthread/linuxthreads.old/wrapsyscall.c | 13 +++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c index 41c4eacc2..e3cbb00bf 100644 --- a/libc/sysdeps/linux/common/epoll.c +++ b/libc/sysdeps/linux/common/epoll.c @@ -9,6 +9,7 @@ #include #include +#include /* * epoll_create() @@ -35,14 +36,30 @@ _syscall4(int,epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, even * epoll_wait() */ #ifdef __NR_epoll_wait -_syscall4(int, epoll_wait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout) -/* TODO: add cancellation for epoll_wait */ +static int __NC(epoll_wait)(int epfd, struct epoll_event *events, int maxevents, int timeout) +{ + return INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout); +} +CANCELLABLE_SYSCALL(int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout), + (epfd, events, maxevents, timeout)) #endif /* * epoll_pwait() */ #ifdef __NR_epoll_pwait -_syscall5(int, epoll_pwait, int, epfd, struct epoll_event *, events, int, maxevents, int, timeout, __const sigset_t *, ss) -/* TODO: add cancellation for epoll_pwait */ +# include + +# define __NR___syscall_epoll_pwait __NR_epoll_pwait +static __always_inline _syscall6(int, __syscall_epoll_pwait, int, epfd, struct epoll_event *, events, + int, maxevents, int, timeout, const sigset_t *, sigmask, size_t, sigsetsize) + +static int __NC(epoll_pwait)(int epfd, struct epoll_event *events, int maxevents, int timeout, + const sigset_t *set) +{ + return __syscall_epoll_pwait(epfd, events, maxevents, timeout, set, __SYSCALL_SIGSET_T_SIZE); +} +CANCELLABLE_SYSCALL(int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout, + const sigset_t *set), + (epfd, events, maxevents, timeout, set)) #endif diff --git a/libpthread/linuxthreads.old/wrapsyscall.c b/libpthread/linuxthreads.old/wrapsyscall.c index e69ed6c8d..6c74bd1ff 100644 --- a/libpthread/linuxthreads.old/wrapsyscall.c +++ b/libpthread/linuxthreads.old/wrapsyscall.c @@ -227,3 +227,16 @@ CANCELABLE_SYSCALL (ssize_t, sendto, (int fd, const __ptr_t buf, size_t n, socklen_t addr_len), (fd, buf, n, flags, addr, addr_len)) #endif /* __UCLIBC_HAS_SOCKET__ */ + +#ifdef __UCLIBC_HAS_EPOLL__ +# ifdef __NR_epoll_wait +CANCELABLE_SYSCALL (int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout), + (epfd, events, maxevents, timeout)) +# endif +# ifdef __NR_epoll_pwait +# include +CANCELABLE_SYSCALL (int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout, + const sigset_t *set), + (epfd, events, maxevents, timeout, set)) +# endif +#endif -- cgit v1.2.3 From 1bfe83b42b5b850c20ed8d35819cced510eaef3c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 13 May 2011 12:16:29 +0200 Subject: epoll: redo cancellation to match master Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/epoll.c | 47 ++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c index e3cbb00bf..85b0cfd2b 100644 --- a/libc/sysdeps/linux/common/epoll.c +++ b/libc/sysdeps/linux/common/epoll.c @@ -9,7 +9,11 @@ #include #include -#include +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +# include +#else +# define SINGLE_THREAD_P 1 +#endif /* * epoll_create() @@ -36,12 +40,21 @@ _syscall4(int,epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event *, even * epoll_wait() */ #ifdef __NR_epoll_wait -static int __NC(epoll_wait)(int epfd, struct epoll_event *events, int maxevents, int timeout) +extern __typeof(epoll_wait) __libc_epoll_wait; +int __libc_epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) { - return INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout); + if (SINGLE_THREAD_P) + return INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout); +# ifdef __UCLIBC_HAS_THREADS_NATIVE__ + else { + int oldtype = LIBC_CANCEL_ASYNC (); + int result = INLINE_SYSCALL(epoll_wait, 4, epfd, events, maxevents, timeout); + LIBC_CANCEL_RESET (oldtype); + return result; + } +# endif } -CANCELLABLE_SYSCALL(int, epoll_wait, (int epfd, struct epoll_event *events, int maxevents, int timeout), - (epfd, events, maxevents, timeout)) +weak_alias(__libc_epoll_wait, epoll_wait) #endif /* @@ -50,16 +63,20 @@ CANCELLABLE_SYSCALL(int, epoll_wait, (int epfd, struct epoll_event *events, int #ifdef __NR_epoll_pwait # include -# define __NR___syscall_epoll_pwait __NR_epoll_pwait -static __always_inline _syscall6(int, __syscall_epoll_pwait, int, epfd, struct epoll_event *, events, - int, maxevents, int, timeout, const sigset_t *, sigmask, size_t, sigsetsize) - -static int __NC(epoll_pwait)(int epfd, struct epoll_event *events, int maxevents, int timeout, - const sigset_t *set) +extern __typeof(epoll_pwait) __libc_epoll_pwait; +int __libc_epoll_pwait(int epfd, struct epoll_event *events, int maxevents, + int timeout, const sigset_t *set) { - return __syscall_epoll_pwait(epfd, events, maxevents, timeout, set, __SYSCALL_SIGSET_T_SIZE); + if (SINGLE_THREAD_P) + return INLINE_SYSCALL(epoll_pwait, 6, epfd, events, maxevents, timeout, set, _NSIG / 8); +# ifdef __UCLIBC_HAS_THREADS_NATIVE__ + else { + int oldtype = LIBC_CANCEL_ASYNC (); + int result = INLINE_SYSCALL(epoll_pwait, 6, epfd, events, maxevents, timeout, set, _NSIG / 8); + LIBC_CANCEL_RESET (oldtype); + return result; + } +# endif } -CANCELLABLE_SYSCALL(int, epoll_pwait, (int epfd, struct epoll_event *events, int maxevents, int timeout, - const sigset_t *set), - (epfd, events, maxevents, timeout, set)) +weak_alias(__libc_epoll_pwait, epoll_pwait) #endif -- cgit v1.2.3 From 71d63ed75648da9b0b71afabb9c60aaad792c55c Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 13 May 2011 15:31:06 -0700 Subject: unwind.h: Move to libc/sysdeps from nptl sysdeps Signed-off-by: Khem Raj --- include/unwind.h | 220 ---------------- libc/sysdeps/linux/arm/unwind.h | 279 +++++++++++++++++++++ libc/sysdeps/linux/common/unwind.h | 220 ++++++++++++++++ .../nptl/sysdeps/unix/sysv/linux/arm/unwind.h | 279 --------------------- 4 files changed, 499 insertions(+), 499 deletions(-) delete mode 100644 include/unwind.h create mode 100644 libc/sysdeps/linux/arm/unwind.h create mode 100644 libc/sysdeps/linux/common/unwind.h delete mode 100644 libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind.h diff --git a/include/unwind.h b/include/unwind.h deleted file mode 100644 index 81fc4db55..000000000 --- a/include/unwind.h +++ /dev/null @@ -1,220 +0,0 @@ -/* Exception handling and frame unwind runtime interface routines. - Copyright (C) 2001, 2003 Free Software Foundation, Inc. - - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -/* This is derived from the C++ ABI for IA-64. Where we diverge - for cross-architecture compatibility are noted with "@@@". */ - -#ifndef _UNWIND_H -#define _UNWIND_H 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* Level 1: Base ABI */ - -/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is - inefficient for 32-bit and smaller machines. */ -typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); -typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); -#if defined(__ia64__) && defined(__hpux__) -typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); -#else -typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); -#endif -typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); - -/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and - consumer of an exception. We'll go along with this for now even on - 32-bit machines. We'll need to provide some other option for - 16-bit machines and for machines with > 8 bits per byte. */ -typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); - -/* The unwind interface uses reason codes in several contexts to - identify the reasons for failures or other actions. */ -typedef enum -{ - _URC_NO_REASON = 0, - _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_FATAL_PHASE2_ERROR = 2, - _URC_FATAL_PHASE1_ERROR = 3, - _URC_NORMAL_STOP = 4, - _URC_END_OF_STACK = 5, - _URC_HANDLER_FOUND = 6, - _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8 -} _Unwind_Reason_Code; - - -/* The unwind interface uses a pointer to an exception header object - as its representation of an exception being thrown. In general, the - full representation of an exception object is language- and - implementation-specific, but it will be prefixed by a header - understood by the unwind interface. */ - -struct _Unwind_Exception; - -typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, - struct _Unwind_Exception *); - -struct _Unwind_Exception -{ - _Unwind_Exception_Class exception_class; - _Unwind_Exception_Cleanup_Fn exception_cleanup; - _Unwind_Word private_1; - _Unwind_Word private_2; - - /* @@@ The IA-64 ABI says that this structure must be double-word aligned. - Taking that literally does not make much sense generically. Instead we - provide the maximum alignment required by any type for the machine. */ -} __attribute__((__aligned__)); - - -/* The ACTIONS argument to the personality routine is a bitwise OR of one - or more of the following constants. */ -typedef int _Unwind_Action; - -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 -#define _UA_END_OF_STACK 16 - -/* This is an opaque type used to refer to a system-specific data - structure used by the system unwinder. This context is created and - destroyed by the system, and passed to the personality routine - during unwinding. */ -struct _Unwind_Context; - -/* Raise an exception, passing along the given exception object. */ -extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); - -/* Raise an exception for forced unwinding. */ - -typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, - _Unwind_Stop_Fn, - void *); - -/* Helper to invoke the exception_cleanup routine. */ -extern void _Unwind_DeleteException (struct _Unwind_Exception *); - -/* Resume propagation of an existing exception. This is used after - e.g. executing cleanup code, and not to implement rethrowing. */ -extern void _Unwind_Resume (struct _Unwind_Exception *); - -/* @@@ Use unwind data to perform a stack backtrace. The trace callback - is called for every stack frame in the call chain, but no cleanup - actions are performed. */ -typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) - (struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); - -/* These functions are used for communicating information about the unwind - context (i.e. the unwind descriptors and the user register state) between - the unwind library and the personality routine and landing pad. Only - selected registers maybe manipulated. */ - -extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); -extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); - -extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); -extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); - -/* @@@ Retrieve the CFA of the given context. */ -extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); - -extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); - -extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); - - -/* The personality routine is the function in the C++ (or other language) - runtime library which serves as an interface between the system unwind - library and language-specific exception handling semantics. It is - specific to the code fragment described by an unwind info block, and - it is always referenced via the pointer in the unwind info block, and - hence it has no ABI-specified name. - - Note that this implies that two different C++ implementations can - use different names, and have different contents in the language - specific data area. Moreover, that the language specific data - area contains no version info because name of the function invoked - provides more effective versioning by detecting at link time the - lack of code to handle the different data format. */ - -typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - struct _Unwind_Exception *, struct _Unwind_Context *); - -/* @@@ The following alternate entry points are for setjmp/longjmp - based unwinding. */ - -struct SjLj_Function_Context; -extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); -extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); - -extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException - (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind - (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); -extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *); - -/* @@@ The following provide access to the base addresses for text - and data-relative addressing in the LDSA. In order to stay link - compatible with the standard ABI for IA-64, we inline these. */ - -#ifdef __ia64__ -#include - -static inline _Unwind_Ptr -_Unwind_GetDataRelBase (struct _Unwind_Context *_C) -{ - /* The GP is stored in R1. */ - return _Unwind_GetGR (_C, 1); -} - -static inline _Unwind_Ptr -_Unwind_GetTextRelBase (struct _Unwind_Context *_C) -{ - abort (); - return 0; -} - -/* @@@ Retrieve the Backing Store Pointer of the given context. */ -extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); -#else -extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); -extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); -#endif - -/* @@@ Given an address, return the entry point of the function that - contains it. */ -extern void * _Unwind_FindEnclosingFunction (void *pc); - -#ifdef __cplusplus -} -#endif - -#endif /* unwind.h */ diff --git a/libc/sysdeps/linux/arm/unwind.h b/libc/sysdeps/linux/arm/unwind.h new file mode 100644 index 000000000..eeb9cf8b6 --- /dev/null +++ b/libc/sysdeps/linux/arm/unwind.h @@ -0,0 +1,279 @@ +/* Header file for the ARM EABI unwinder + Copyright (C) 2003, 2004, 2005, 2009 Free Software Foundation, Inc. + Contributed by Paul Brook + + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + In addition to the permissions in the GNU General Public License, the + Free Software Foundation gives you unlimited permission to link the + compiled version of this file into combinations with other programs, + and to distribute those combinations without any restriction coming + from the use of this file. (The General Public License restrictions + do apply in other respects; for example, they cover modification of + the file, and distribution when not linked into a combine + executable.) + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; see the file COPYING. If not, write to + the Free Software Foundation, 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* Language-independent unwinder header public defines. This contains both + ABI defined objects, and GNU support routines. */ + +#ifndef UNWIND_ARM_H +#define UNWIND_ARM_H + +#define __ARM_EABI_UNWINDER__ 1 + +#ifdef __cplusplus +extern "C" { +#endif + typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); + typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); + typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); + typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); + typedef _Unwind_Word _uw; + typedef unsigned _uw64 __attribute__((mode(__DI__))); + typedef unsigned _uw16 __attribute__((mode(__HI__))); + typedef unsigned _uw8 __attribute__((mode(__QI__))); + + typedef enum + { + _URC_OK = 0, /* operation completed successfully */ + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8, + _URC_FAILURE = 9 /* unspecified failure of some kind */ + } + _Unwind_Reason_Code; + + typedef enum + { + _US_VIRTUAL_UNWIND_FRAME = 0, + _US_UNWIND_FRAME_STARTING = 1, + _US_UNWIND_FRAME_RESUME = 2, + _US_ACTION_MASK = 3, + _US_FORCE_UNWIND = 8, + _US_END_OF_STACK = 16 + } + _Unwind_State; + + /* Provided only for for compatibility with existing code. */ + typedef int _Unwind_Action; +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 +#define _UA_END_OF_STACK 16 +#define _URC_NO_REASON _URC_OK + + typedef struct _Unwind_Control_Block _Unwind_Control_Block; + typedef struct _Unwind_Context _Unwind_Context; + typedef _uw _Unwind_EHT_Header; + + + /* UCB: */ + + struct _Unwind_Control_Block + { +#ifdef _LIBC + /* For the benefit of code which assumes this is a scalar. All + glibc ever does is clear it. */ + _uw64 exception_class; +#else + char exception_class[8]; +#endif + void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *); + /* Unwinder cache, private fields for the unwinder's use */ + struct + { + _uw reserved1; /* Forced unwind stop fn, 0 if not forced */ + _uw reserved2; /* Personality routine address */ + _uw reserved3; /* Saved callsite address */ + _uw reserved4; /* Forced unwind stop arg */ + _uw reserved5; + } + unwinder_cache; + /* Propagation barrier cache (valid after phase 1): */ + struct + { + _uw sp; + _uw bitpattern[5]; + } + barrier_cache; + /* Cleanup cache (preserved over cleanup): */ + struct + { + _uw bitpattern[4]; + } + cleanup_cache; + /* Pr cache (for pr's benefit): */ + struct + { + _uw fnstart; /* function start address */ + _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ + _uw additional; /* additional data */ + _uw reserved1; + } + pr_cache; + long long int :0; /* Force alignment to 8-byte boundary */ + }; + + /* Virtual Register Set*/ + + typedef enum + { + _UVRSC_CORE = 0, /* integer register */ + _UVRSC_VFP = 1, /* vfp */ + _UVRSC_FPA = 2, /* fpa */ + _UVRSC_WMMXD = 3, /* Intel WMMX data register */ + _UVRSC_WMMXC = 4 /* Intel WMMX control register */ + } + _Unwind_VRS_RegClass; + + typedef enum + { + _UVRSD_UINT32 = 0, + _UVRSD_VFPX = 1, + _UVRSD_FPAX = 2, + _UVRSD_UINT64 = 3, + _UVRSD_FLOAT = 4, + _UVRSD_DOUBLE = 5 + } + _Unwind_VRS_DataRepresentation; + + typedef enum + { + _UVRSR_OK = 0, + _UVRSR_NOT_IMPLEMENTED = 1, + _UVRSR_FAILED = 2 + } + _Unwind_VRS_Result; + + /* Frame unwinding state. */ + typedef struct + { + /* The current word (bytes packed msb first). */ + _uw data; + /* Pointer to the next word of data. */ + _uw *next; + /* The number of bytes left in this word. */ + _uw8 bytes_left; + /* The number of words pointed to by ptr. */ + _uw8 words_left; + } + __gnu_unwind_state; + + typedef _Unwind_Reason_Code (*personality_routine) (_Unwind_State, + _Unwind_Control_Block *, _Unwind_Context *); + + _Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation, + void *); + + _Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation, + void *); + + _Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass, + _uw, _Unwind_VRS_DataRepresentation); + + + /* Support functions for the PR. */ +#define _Unwind_Exception _Unwind_Control_Block + typedef char _Unwind_Exception_Class[8]; + + void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); + _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); + + /* These two should never be used. */ + _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *); + _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *); + + /* Interface functions: */ + _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp); + void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp); + _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp); + + typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + _Unwind_Control_Block *, struct _Unwind_Context *, void *); + _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *, + _Unwind_Stop_Fn, void *); + _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); + void _Unwind_Complete(_Unwind_Control_Block *ucbp); + void _Unwind_DeleteException (_Unwind_Exception *); + + _Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *, + _Unwind_Context *); + _Unwind_Reason_Code __gnu_unwind_execute (_Unwind_Context *, + __gnu_unwind_state *); + + /* Decode an R_ARM_TARGET2 relocation. */ + static inline _Unwind_Word + _Unwind_decode_target2 (_Unwind_Word ptr) + { + _Unwind_Word tmp; + + tmp = *(_Unwind_Word *) ptr; + /* Zero values are always NULL. */ + if (!tmp) + return 0; + +#if defined(linux) || defined(__NetBSD__) + /* Pc-relative indirect. */ + tmp += ptr; + tmp = *(_Unwind_Word *) tmp; +#elif defined(__symbian__) + /* Absolute pointer. Nothing more to do. */ +#else + /* Pc-relative pointer. */ + tmp += ptr; +#endif + return tmp; + } + + static inline _Unwind_Word + _Unwind_GetGR (_Unwind_Context *context, int regno) + { + _uw val; + _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); + return val; + } + + /* Return the address of the instruction, not the actual IP value. */ +#define _Unwind_GetIP(context) \ + (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1) + + static inline void + _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val) + { + _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); + } + + /* The dwarf unwinder doesn't understand arm/thumb state. We assume the + landing pad uses the same instruction set as the call site. */ +#define _Unwind_SetIP(context, val) \ + _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)) + +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) + (struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* defined UNWIND_ARM_H */ diff --git a/libc/sysdeps/linux/common/unwind.h b/libc/sysdeps/linux/common/unwind.h new file mode 100644 index 000000000..81fc4db55 --- /dev/null +++ b/libc/sysdeps/linux/common/unwind.h @@ -0,0 +1,220 @@ +/* Exception handling and frame unwind runtime interface routines. + Copyright (C) 2001, 2003 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* This is derived from the C++ ABI for IA-64. Where we diverge + for cross-architecture compatibility are noted with "@@@". */ + +#ifndef _UNWIND_H +#define _UNWIND_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Level 1: Base ABI */ + +/* @@@ The IA-64 ABI uses uint64 throughout. Most places this is + inefficient for 32-bit and smaller machines. */ +typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); +typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); +#if defined(__ia64__) && defined(__hpux__) +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__word__))); +#else +typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); +#endif +typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); + +/* @@@ The IA-64 ABI uses a 64-bit word to identify the producer and + consumer of an exception. We'll go along with this for now even on + 32-bit machines. We'll need to provide some other option for + 16-bit machines and for machines with > 8 bits per byte. */ +typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__))); + +/* The unwind interface uses reason codes in several contexts to + identify the reasons for failures or other actions. */ +typedef enum +{ + _URC_NO_REASON = 0, + _URC_FOREIGN_EXCEPTION_CAUGHT = 1, + _URC_FATAL_PHASE2_ERROR = 2, + _URC_FATAL_PHASE1_ERROR = 3, + _URC_NORMAL_STOP = 4, + _URC_END_OF_STACK = 5, + _URC_HANDLER_FOUND = 6, + _URC_INSTALL_CONTEXT = 7, + _URC_CONTINUE_UNWIND = 8 +} _Unwind_Reason_Code; + + +/* The unwind interface uses a pointer to an exception header object + as its representation of an exception being thrown. In general, the + full representation of an exception object is language- and + implementation-specific, but it will be prefixed by a header + understood by the unwind interface. */ + +struct _Unwind_Exception; + +typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, + struct _Unwind_Exception *); + +struct _Unwind_Exception +{ + _Unwind_Exception_Class exception_class; + _Unwind_Exception_Cleanup_Fn exception_cleanup; + _Unwind_Word private_1; + _Unwind_Word private_2; + + /* @@@ The IA-64 ABI says that this structure must be double-word aligned. + Taking that literally does not make much sense generically. Instead we + provide the maximum alignment required by any type for the machine. */ +} __attribute__((__aligned__)); + + +/* The ACTIONS argument to the personality routine is a bitwise OR of one + or more of the following constants. */ +typedef int _Unwind_Action; + +#define _UA_SEARCH_PHASE 1 +#define _UA_CLEANUP_PHASE 2 +#define _UA_HANDLER_FRAME 4 +#define _UA_FORCE_UNWIND 8 +#define _UA_END_OF_STACK 16 + +/* This is an opaque type used to refer to a system-specific data + structure used by the system unwinder. This context is created and + destroyed by the system, and passed to the personality routine + during unwinding. */ +struct _Unwind_Context; + +/* Raise an exception, passing along the given exception object. */ +extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); + +/* Raise an exception for forced unwinding. */ + +typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, + _Unwind_Stop_Fn, + void *); + +/* Helper to invoke the exception_cleanup routine. */ +extern void _Unwind_DeleteException (struct _Unwind_Exception *); + +/* Resume propagation of an existing exception. This is used after + e.g. executing cleanup code, and not to implement rethrowing. */ +extern void _Unwind_Resume (struct _Unwind_Exception *); + +/* @@@ Use unwind data to perform a stack backtrace. The trace callback + is called for every stack frame in the call chain, but no cleanup + actions are performed. */ +typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) + (struct _Unwind_Context *, void *); + +extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); + +/* These functions are used for communicating information about the unwind + context (i.e. the unwind descriptors and the user register state) between + the unwind library and the personality routine and landing pad. Only + selected registers maybe manipulated. */ + +extern _Unwind_Word _Unwind_GetGR (struct _Unwind_Context *, int); +extern void _Unwind_SetGR (struct _Unwind_Context *, int, _Unwind_Word); + +extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); +extern void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr); + +/* @@@ Retrieve the CFA of the given context. */ +extern _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); + +extern void *_Unwind_GetLanguageSpecificData (struct _Unwind_Context *); + +extern _Unwind_Ptr _Unwind_GetRegionStart (struct _Unwind_Context *); + + +/* The personality routine is the function in the C++ (or other language) + runtime library which serves as an interface between the system unwind + library and language-specific exception handling semantics. It is + specific to the code fragment described by an unwind info block, and + it is always referenced via the pointer in the unwind info block, and + hence it has no ABI-specified name. + + Note that this implies that two different C++ implementations can + use different names, and have different contents in the language + specific data area. Moreover, that the language specific data + area contains no version info because name of the function invoked + provides more effective versioning by detecting at link time the + lack of code to handle the different data format. */ + +typedef _Unwind_Reason_Code (*_Unwind_Personality_Fn) + (int, _Unwind_Action, _Unwind_Exception_Class, + struct _Unwind_Exception *, struct _Unwind_Context *); + +/* @@@ The following alternate entry points are for setjmp/longjmp + based unwinding. */ + +struct SjLj_Function_Context; +extern void _Unwind_SjLj_Register (struct SjLj_Function_Context *); +extern void _Unwind_SjLj_Unregister (struct SjLj_Function_Context *); + +extern _Unwind_Reason_Code _Unwind_SjLj_RaiseException + (struct _Unwind_Exception *); +extern _Unwind_Reason_Code _Unwind_SjLj_ForcedUnwind + (struct _Unwind_Exception *, _Unwind_Stop_Fn, void *); +extern void _Unwind_SjLj_Resume (struct _Unwind_Exception *); + +/* @@@ The following provide access to the base addresses for text + and data-relative addressing in the LDSA. In order to stay link + compatible with the standard ABI for IA-64, we inline these. */ + +#ifdef __ia64__ +#include + +static inline _Unwind_Ptr +_Unwind_GetDataRelBase (struct _Unwind_Context *_C) +{ + /* The GP is stored in R1. */ + return _Unwind_GetGR (_C, 1); +} + +static inline _Unwind_Ptr +_Unwind_GetTextRelBase (struct _Unwind_Context *_C) +{ + abort (); + return 0; +} + +/* @@@ Retrieve the Backing Store Pointer of the given context. */ +extern _Unwind_Word _Unwind_GetBSP (struct _Unwind_Context *); +#else +extern _Unwind_Ptr _Unwind_GetDataRelBase (struct _Unwind_Context *); +extern _Unwind_Ptr _Unwind_GetTextRelBase (struct _Unwind_Context *); +#endif + +/* @@@ Given an address, return the entry point of the function that + contains it. */ +extern void * _Unwind_FindEnclosingFunction (void *pc); + +#ifdef __cplusplus +} +#endif + +#endif /* unwind.h */ diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind.h b/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind.h deleted file mode 100644 index eeb9cf8b6..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/arm/unwind.h +++ /dev/null @@ -1,279 +0,0 @@ -/* Header file for the ARM EABI unwinder - Copyright (C) 2003, 2004, 2005, 2009 Free Software Foundation, Inc. - Contributed by Paul Brook - - This file is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2, or (at your option) any - later version. - - In addition to the permissions in the GNU General Public License, the - Free Software Foundation gives you unlimited permission to link the - compiled version of this file into combinations with other programs, - and to distribute those combinations without any restriction coming - from the use of this file. (The General Public License restrictions - do apply in other respects; for example, they cover modification of - the file, and distribution when not linked into a combine - executable.) - - This file is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* Language-independent unwinder header public defines. This contains both - ABI defined objects, and GNU support routines. */ - -#ifndef UNWIND_ARM_H -#define UNWIND_ARM_H - -#define __ARM_EABI_UNWINDER__ 1 - -#ifdef __cplusplus -extern "C" { -#endif - typedef unsigned _Unwind_Word __attribute__((__mode__(__word__))); - typedef signed _Unwind_Sword __attribute__((__mode__(__word__))); - typedef unsigned _Unwind_Ptr __attribute__((__mode__(__pointer__))); - typedef unsigned _Unwind_Internal_Ptr __attribute__((__mode__(__pointer__))); - typedef _Unwind_Word _uw; - typedef unsigned _uw64 __attribute__((mode(__DI__))); - typedef unsigned _uw16 __attribute__((mode(__HI__))); - typedef unsigned _uw8 __attribute__((mode(__QI__))); - - typedef enum - { - _URC_OK = 0, /* operation completed successfully */ - _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_END_OF_STACK = 5, - _URC_HANDLER_FOUND = 6, - _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8, - _URC_FAILURE = 9 /* unspecified failure of some kind */ - } - _Unwind_Reason_Code; - - typedef enum - { - _US_VIRTUAL_UNWIND_FRAME = 0, - _US_UNWIND_FRAME_STARTING = 1, - _US_UNWIND_FRAME_RESUME = 2, - _US_ACTION_MASK = 3, - _US_FORCE_UNWIND = 8, - _US_END_OF_STACK = 16 - } - _Unwind_State; - - /* Provided only for for compatibility with existing code. */ - typedef int _Unwind_Action; -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 -#define _UA_END_OF_STACK 16 -#define _URC_NO_REASON _URC_OK - - typedef struct _Unwind_Control_Block _Unwind_Control_Block; - typedef struct _Unwind_Context _Unwind_Context; - typedef _uw _Unwind_EHT_Header; - - - /* UCB: */ - - struct _Unwind_Control_Block - { -#ifdef _LIBC - /* For the benefit of code which assumes this is a scalar. All - glibc ever does is clear it. */ - _uw64 exception_class; -#else - char exception_class[8]; -#endif - void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *); - /* Unwinder cache, private fields for the unwinder's use */ - struct - { - _uw reserved1; /* Forced unwind stop fn, 0 if not forced */ - _uw reserved2; /* Personality routine address */ - _uw reserved3; /* Saved callsite address */ - _uw reserved4; /* Forced unwind stop arg */ - _uw reserved5; - } - unwinder_cache; - /* Propagation barrier cache (valid after phase 1): */ - struct - { - _uw sp; - _uw bitpattern[5]; - } - barrier_cache; - /* Cleanup cache (preserved over cleanup): */ - struct - { - _uw bitpattern[4]; - } - cleanup_cache; - /* Pr cache (for pr's benefit): */ - struct - { - _uw fnstart; /* function start address */ - _Unwind_EHT_Header *ehtp; /* pointer to EHT entry header word */ - _uw additional; /* additional data */ - _uw reserved1; - } - pr_cache; - long long int :0; /* Force alignment to 8-byte boundary */ - }; - - /* Virtual Register Set*/ - - typedef enum - { - _UVRSC_CORE = 0, /* integer register */ - _UVRSC_VFP = 1, /* vfp */ - _UVRSC_FPA = 2, /* fpa */ - _UVRSC_WMMXD = 3, /* Intel WMMX data register */ - _UVRSC_WMMXC = 4 /* Intel WMMX control register */ - } - _Unwind_VRS_RegClass; - - typedef enum - { - _UVRSD_UINT32 = 0, - _UVRSD_VFPX = 1, - _UVRSD_FPAX = 2, - _UVRSD_UINT64 = 3, - _UVRSD_FLOAT = 4, - _UVRSD_DOUBLE = 5 - } - _Unwind_VRS_DataRepresentation; - - typedef enum - { - _UVRSR_OK = 0, - _UVRSR_NOT_IMPLEMENTED = 1, - _UVRSR_FAILED = 2 - } - _Unwind_VRS_Result; - - /* Frame unwinding state. */ - typedef struct - { - /* The current word (bytes packed msb first). */ - _uw data; - /* Pointer to the next word of data. */ - _uw *next; - /* The number of bytes left in this word. */ - _uw8 bytes_left; - /* The number of words pointed to by ptr. */ - _uw8 words_left; - } - __gnu_unwind_state; - - typedef _Unwind_Reason_Code (*personality_routine) (_Unwind_State, - _Unwind_Control_Block *, _Unwind_Context *); - - _Unwind_VRS_Result _Unwind_VRS_Set(_Unwind_Context *, _Unwind_VRS_RegClass, - _uw, _Unwind_VRS_DataRepresentation, - void *); - - _Unwind_VRS_Result _Unwind_VRS_Get(_Unwind_Context *, _Unwind_VRS_RegClass, - _uw, _Unwind_VRS_DataRepresentation, - void *); - - _Unwind_VRS_Result _Unwind_VRS_Pop(_Unwind_Context *, _Unwind_VRS_RegClass, - _uw, _Unwind_VRS_DataRepresentation); - - - /* Support functions for the PR. */ -#define _Unwind_Exception _Unwind_Control_Block - typedef char _Unwind_Exception_Class[8]; - - void * _Unwind_GetLanguageSpecificData (_Unwind_Context *); - _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *); - - /* These two should never be used. */ - _Unwind_Ptr _Unwind_GetDataRelBase (_Unwind_Context *); - _Unwind_Ptr _Unwind_GetTextRelBase (_Unwind_Context *); - - /* Interface functions: */ - _Unwind_Reason_Code _Unwind_RaiseException(_Unwind_Control_Block *ucbp); - void __attribute__((noreturn)) _Unwind_Resume(_Unwind_Control_Block *ucbp); - _Unwind_Reason_Code _Unwind_Resume_or_Rethrow (_Unwind_Control_Block *ucbp); - - typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) - (int, _Unwind_Action, _Unwind_Exception_Class, - _Unwind_Control_Block *, struct _Unwind_Context *, void *); - _Unwind_Reason_Code _Unwind_ForcedUnwind (_Unwind_Control_Block *, - _Unwind_Stop_Fn, void *); - _Unwind_Word _Unwind_GetCFA (struct _Unwind_Context *); - void _Unwind_Complete(_Unwind_Control_Block *ucbp); - void _Unwind_DeleteException (_Unwind_Exception *); - - _Unwind_Reason_Code __gnu_unwind_frame (_Unwind_Control_Block *, - _Unwind_Context *); - _Unwind_Reason_Code __gnu_unwind_execute (_Unwind_Context *, - __gnu_unwind_state *); - - /* Decode an R_ARM_TARGET2 relocation. */ - static inline _Unwind_Word - _Unwind_decode_target2 (_Unwind_Word ptr) - { - _Unwind_Word tmp; - - tmp = *(_Unwind_Word *) ptr; - /* Zero values are always NULL. */ - if (!tmp) - return 0; - -#if defined(linux) || defined(__NetBSD__) - /* Pc-relative indirect. */ - tmp += ptr; - tmp = *(_Unwind_Word *) tmp; -#elif defined(__symbian__) - /* Absolute pointer. Nothing more to do. */ -#else - /* Pc-relative pointer. */ - tmp += ptr; -#endif - return tmp; - } - - static inline _Unwind_Word - _Unwind_GetGR (_Unwind_Context *context, int regno) - { - _uw val; - _Unwind_VRS_Get (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); - return val; - } - - /* Return the address of the instruction, not the actual IP value. */ -#define _Unwind_GetIP(context) \ - (_Unwind_GetGR (context, 15) & ~(_Unwind_Word)1) - - static inline void - _Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val) - { - _Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val); - } - - /* The dwarf unwinder doesn't understand arm/thumb state. We assume the - landing pad uses the same instruction set as the call site. */ -#define _Unwind_SetIP(context, val) \ - _Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1)) - -typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) - (struct _Unwind_Context *, void *); - -extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* defined UNWIND_ARM_H */ -- cgit v1.2.3 From 8514218c136c9a21a5ed4f123d2c49f21ef86947 Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Thu, 26 May 2011 18:15:06 +0200 Subject: Correct a bug when remapping textrel segments on nommu From: Alan Davis On C6X, when trying to execute a program that has a textrel DSO, it fails to load. The telltale line in the LD_DEBUG output is: _dl_get_ready_to_run:779: file=''; needed by './a.out' The corresponding DT_NEEDED entry has 'libc.so.0', but here the filename is empty. This is what is happening in _dl_elf_shared_library(): First, map all segments according to their permissions. Text gets initially mapped read-only. Then, parse the dynamic information. The dynamic table is in RW but some of the tags may point to RO. For example, DT_NEEDED points to a string in .dynstr which is in RO. These pointers get computed according to the loadmap from the original mapping. Then, in response to a DT_TEXTREL tag, the RO segment gets remapped, thereby invaliding anything that points to it, in particular certain dynamic tags such as DT_NEEDED. The following patch re-parses the dynamic info after the remapping so as to re-compute any invalid pointers. Signed-off-by: Alan Davis Signed-off-by: Bernd Schmidt --- ldso/ldso/dl-elf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 7b5d75146..09b3aaf01 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -714,6 +714,9 @@ struct elf_resolve *_dl_load_elf_shared_library(int secure, DL_UPDATE_LOADADDR_HDR(lib_loadaddr, new_addr + (ppnt->p_vaddr & ADDR_ALIGN), ppnt); + /* This has invalidated all pointers into the previously readonly segment. + Update any them to point into the remapped segment. */ + _dl_parse_dynamic_info(dpnt, dynamic_info, NULL, lib_loadaddr); #endif } } -- cgit v1.2.3 From 5e87d86aceed23e9f2cffe4e6cbcd99569a4dac1 Mon Sep 17 00:00:00 2001 From: Filippo Arcidiacono Date: Fri, 27 May 2011 17:08:36 +0200 Subject: sh: fix build in !NPTL case Fix build issue due to missing symbols in !NPTL case: - vfork - _longjmp_unwind Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/sh/Makefile.arch | 2 +- libc/sysdeps/linux/sh/longjmp.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libc/sysdeps/linux/sh/Makefile.arch b/libc/sysdeps/linux/sh/Makefile.arch index 3e32e1095..09d7ecffe 100644 --- a/libc/sysdeps/linux/sh/Makefile.arch +++ b/libc/sysdeps/linux/sh/Makefile.arch @@ -9,4 +9,4 @@ CSRC := \ mmap.c pipe.c __init_brk.c brk.c sbrk.c pread_write.c longjmp.c cacheflush.c -SSRC := setjmp.S __longjmp.S ___fpscr_values.S +SSRC := setjmp.S __longjmp.S ___fpscr_values.S vfork.S diff --git a/libc/sysdeps/linux/sh/longjmp.c b/libc/sysdeps/linux/sh/longjmp.c index dd0616d8a..28ab71515 100644 --- a/libc/sysdeps/linux/sh/longjmp.c +++ b/libc/sysdeps/linux/sh/longjmp.c @@ -29,7 +29,9 @@ libc_hidden_proto(sigprocmask) extern int __longjmp(char *env, int val); libc_hidden_proto(__longjmp) +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ extern void _longjmp_unwind (jmp_buf env, int val); +#endif /* Set the signal mask to the one specified in ENV, and jump @@ -39,7 +41,9 @@ void __libc_siglongjmp (sigjmp_buf env, int val) { /* Perform any cleanups needed by the frames being unwound. */ +#if __UCLIBC_HAS_THREADS_NATIVE__ _longjmp_unwind (env, val); +#endif if (env[0].__mask_was_saved) /* Restore the saved signal mask. */ -- cgit v1.2.3 From 461c76887fa071aa428a17ef05cb2eb4eed1f93c Mon Sep 17 00:00:00 2001 From: Filippo Arcidiacono Date: Fri, 27 May 2011 17:17:51 +0200 Subject: sh: use the common implementation for longjmp Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/common/Makefile.in | 2 +- libc/sysdeps/linux/sh/Makefile.arch | 2 +- libc/sysdeps/linux/sh/longjmp.c | 60 ----------------------------------- 3 files changed, 2 insertions(+), 62 deletions(-) delete mode 100644 libc/sysdeps/linux/sh/longjmp.c diff --git a/libc/sysdeps/linux/common/Makefile.in b/libc/sysdeps/linux/common/Makefile.in index 27cbbf420..8f936ffcc 100644 --- a/libc/sysdeps/linux/common/Makefile.in +++ b/libc/sysdeps/linux/common/Makefile.in @@ -52,7 +52,7 @@ CSRC-$(UCLIBC_HAS_XATTR) += xattr.c CSRC-$(UCLIBC_HAS_PROFILING) += noophooks.c #pcprofile.c CSRC-$(UCLIBC_SV4_DEPRECATED) += ustat.c CSRC- += $(if $(findstring =c6x=,=$(TARGET_ARCH)=),vfork.c) -CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),longjmp.c vfork.c) +CSRC- += $(if $(findstring =sh=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =sparc=,=$(TARGET_ARCH)=),vfork.c) CSRC- += $(if $(findstring =i386=,=$(TARGET_ARCH)=),vfork.c) diff --git a/libc/sysdeps/linux/sh/Makefile.arch b/libc/sysdeps/linux/sh/Makefile.arch index 09d7ecffe..92e262b6c 100644 --- a/libc/sysdeps/linux/sh/Makefile.arch +++ b/libc/sysdeps/linux/sh/Makefile.arch @@ -7,6 +7,6 @@ # CSRC := \ - mmap.c pipe.c __init_brk.c brk.c sbrk.c pread_write.c longjmp.c cacheflush.c + mmap.c pipe.c __init_brk.c brk.c sbrk.c pread_write.c cacheflush.c SSRC := setjmp.S __longjmp.S ___fpscr_values.S vfork.S diff --git a/libc/sysdeps/linux/sh/longjmp.c b/libc/sysdeps/linux/sh/longjmp.c deleted file mode 100644 index 28ab71515..000000000 --- a/libc/sysdeps/linux/sh/longjmp.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 1991, 92, 94, 95, 97, 98, 2000 Free Software Foundation, Inc. - Copyright (C) 2001 Hewlett-Packard Australia - - This program is free software; you can redistribute it and/or modify it under - the terms of the GNU Library General Public License as published by the Free - Software Foundation; either version 2 of the License, or (at your option) any - later version. - - This program is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more - details. - - You should have received a copy of the GNU Library General Public License - along with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Derived in part from the Linux-8086 C library, the GNU C Library, and several - other sundry sources. Files within this library are copyright by their - respective copyright holders. -*/ - -#include -#include -#include - -libc_hidden_proto(sigprocmask) - -extern int __longjmp(char *env, int val); -libc_hidden_proto(__longjmp) - -#ifdef __UCLIBC_HAS_THREADS_NATIVE__ -extern void _longjmp_unwind (jmp_buf env, int val); -#endif - - -/* Set the signal mask to the one specified in ENV, and jump - to the position specified in ENV, causing the setjmp - call there to return VAL, or 1 if VAL is 0. */ -void __libc_siglongjmp (sigjmp_buf env, int val) -{ - /* Perform any cleanups needed by the frames being unwound. */ - -#if __UCLIBC_HAS_THREADS_NATIVE__ - _longjmp_unwind (env, val); -#endif - - if (env[0].__mask_was_saved) - /* Restore the saved signal mask. */ - (void) sigprocmask (SIG_SETMASK, &env[0].__saved_mask, - (sigset_t *) NULL); - - /* Call the machine-dependent function to restore machine state. */ - __longjmp ((char *) env[0].__jmpbuf, val ?: 1); -} - -__asm__(".weak longjmp; longjmp = __libc_siglongjmp"); -__asm__(".weak _longjmp; _longjmp = __libc_siglongjmp"); -__asm__(".weak siglongjmp; siglongjmp = __libc_siglongjmp"); -strong_alias(__libc_siglongjmp, __libc_longjmp) -- cgit v1.2.3 From 204c7849029d90e5e3486670a6a07a76f949afd6 Mon Sep 17 00:00:00 2001 From: Filippo Arcidiacono Date: Fri, 27 May 2011 17:36:20 +0200 Subject: libc: make common longjmp usable with NPTL Call _longjmp_unwind conditionally under NPTL config option, making longjmp usable with NPTL. Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- libc/sysdeps/linux/common/longjmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/longjmp.c b/libc/sysdeps/linux/common/longjmp.c index b07eced6a..f3448bc6f 100644 --- a/libc/sysdeps/linux/common/longjmp.c +++ b/libc/sysdeps/linux/common/longjmp.c @@ -24,7 +24,7 @@ extern void __longjmp (__jmp_buf __env, int __val) attribute_noreturn; libc_hidden_proto(__longjmp) -#if 0 +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ extern void _longjmp_unwind (jmp_buf env, int val); #endif @@ -34,7 +34,7 @@ extern __typeof(longjmp) __libc_longjmp attribute_noreturn; call there to return VAL, or 1 if VAL is 0. */ void __libc_longjmp (sigjmp_buf env, int val) { -#if 0 +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ /* Perform any cleanups needed by the frames being unwound. */ _longjmp_unwind (env, val); #endif -- cgit v1.2.3 From 5c49e11c01b0baf4c2c54259e5ec06274251f0fa Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 31 May 2011 09:45:44 +0200 Subject: NPTL: Fix CTOR_DTOR Signed-off-by: Bernhard Reutner-Fischer --- libpthread/nptl/.gitignore | 3 +++ libpthread/nptl/Makefile.in | 12 +++++++----- libpthread/nptl/sysdeps/pthread/Makefile.in | 24 ++++++++++++++++++------ libpthread/nptl/sysdeps/pthread/defs.awk | 24 ------------------------ libpthread/nptl/sysdeps/pthread/pt-initfini.c | 4 ++++ 5 files changed, 32 insertions(+), 35 deletions(-) delete mode 100644 libpthread/nptl/sysdeps/pthread/defs.awk diff --git a/libpthread/nptl/.gitignore b/libpthread/nptl/.gitignore index ac44e0c5d..06395e1f5 100644 --- a/libpthread/nptl/.gitignore +++ b/libpthread/nptl/.gitignore @@ -18,6 +18,9 @@ sysdeps/unix/sysv/linux/lowlevelrobustlock.h sysdeps/unix/sysv/linux/structsem.h sysdeps/unix/sysv/linux/unwindbuf.h sysdeps/unix/sysv/linux/pthread-pi-defines.h +sysdeps/pthread/crt[in].S +sysdeps/pthread/defs.h +sysdeps/pthread/pt-initfini.s # # symlinks # diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in index 3e9676ac8..70616a1fe 100644 --- a/libpthread/nptl/Makefile.in +++ b/libpthread/nptl/Makefile.in @@ -63,9 +63,11 @@ librt-a-y += $(librt_OBJS) endif librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS) -ifneq ($(UCLIBC_CTOR_DTOR),y) -START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o $(SHARED_START_FILES) -END_FILE-libpthread.so := $(SHARED_END_FILES) $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o +ifeq ($(UCLIBC_CTOR_DTOR),y) +START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o +END_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o +LDFLAGS-libpthread.so += -nostartfiles +$(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so) endif libpthread_FULL_NAME := libpthread-$(VERSION).so @@ -137,9 +139,9 @@ CLEAN_libpthread/nptl: $(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a) ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs +LDFLAGS-libpthread.so += $(LDFLAGS_NOSTRIP) -Wl,-z,defs else -LDFLAGS-libpthread.so := $(LDFLAGS) +LDFLAGS-libpthread.so += $(LDFLAGS) endif LDFLAGS-libpthread.so += $(top_builddir)lib/$(UCLIBC_LDSO_NAME)-$(VERSION).so $(top_builddir)lib/libdl-$(VERSION).so \ diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in index fc0c6ac3e..d93b3a55f 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -67,22 +67,34 @@ librt-pt-shared-only-routines-y = rt-unwind-resume.c ifeq ($(UCLIBC_CTOR_DTOR),y) CFLAGS-OMIT-pt-initfini.c = $(CFLAGS-pthread) -CFLAGS-pt-initfini.c = -S -g0 -fPIC -fno-inline-functions \ +CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions \ $(call check_gcc,-fno-unit-at-a-time,) \ + $(SSP_DISABLE_FLAGS) \ -finhibit-size-directive \ + -fno-asynchronous-unwind-tables -fno-unwind-tables \ $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,)) ASFLAGS-crti.S = -g0 ASFLAGS-crtn.S = -g0 $(libpthread_pthread_OUT)/pt-initfini.s: $(libpthread_pthread_DIR)/pt-initfini.c $(compile.c) - $(do_sed) '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \ - $(do_awk) $(libpthread_pthread_DIR)/defs.awk > $(libpthread_pthread_OUT)/defs.h +$(libpthread_pthread_OUT)/defs.h: $(libpthread_pthread_DIR)/pt-initfini.c + $(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \ + $(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp + $(Q)mv $@.tmp $@ -$(libpthread_pthread_OUT)/crti.S $(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s - $(do_sed) -e '1,/@HEADER_ENDS/p' \ +$(libpthread_pthread_OUT)/crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h + $(do_sed) -n -e '/[ ]*\.file/d' \ + -e '1,/@HEADER_ENDS/p' \ -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \ - -e '/@TRAILER_BEGINS/,$$p' $< > $@ + -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp + $(Q)mv $@.tmp $@ +$(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h + $(do_sed) -n -e '/[ ]*\.file/d' \ + -e '1,/@HEADER_ENDS/p' \ + -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \ + -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp + $(Q)mv $@.tmp $@ endif # It would have been easier to just add dummy files that include the real # impl, but ok. diff --git a/libpthread/nptl/sysdeps/pthread/defs.awk b/libpthread/nptl/sysdeps/pthread/defs.awk deleted file mode 100644 index d41d57bd7..000000000 --- a/libpthread/nptl/sysdeps/pthread/defs.awk +++ /dev/null @@ -1,24 +0,0 @@ -/^[ ]*\.endp/ { need_endp = 1 } -/^[ ]*\.end/ { need_end = 1 } -/^[ ]*\.align/ { if($2 > max) max = $2; } - -END { - if(need_endp) - { - print "#define END_INIT .endp _init"; - print "#define END_FINI .endp _fini"; - } else if(need_end) - { - print "#define END_INIT .end _init"; - print "#define END_FINI .end _fini"; - } - else - { - print "#define END_INIT"; - print "#define END_FINI"; - } - if(max) - print "#define ALIGN .align", max; - else - print "#define ALIGN"; -} diff --git a/libpthread/nptl/sysdeps/pthread/pt-initfini.c b/libpthread/nptl/sysdeps/pthread/pt-initfini.c index 1f81144d0..ccdce3e22 100644 --- a/libpthread/nptl/sysdeps/pthread/pt-initfini.c +++ b/libpthread/nptl/sysdeps/pthread/pt-initfini.c @@ -44,6 +44,10 @@ /* Embed an #include to pull in the alignment and .end directives. */ __asm__ ("\n#include \"defs.h\""); +__asm__ ("\n#if defined __i686 && defined __ASSEMBLER__"); +__asm__ ("\n#undef __i686"); +__asm__ ("\n#define __i686 __i686"); +__asm__ ("\n#endif"); /* The initial common code ends here. */ __asm__ ("\n/*@HEADER_ENDS*/"); -- cgit v1.2.3 From 399ab8e650e03cffbe8f1e687192d33f3bf942ad Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 31 May 2011 09:47:12 +0200 Subject: libubacktrace: Fix ASNEEDED emission In master the variable is called SHARED_LIBNAME and not SHARED_MAJORNAME. Signed-off-by: Bernhard Reutner-Fischer --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 2f8370b0f..8ed5f8f10 100644 --- a/Makefile.in +++ b/Makefile.in @@ -338,7 +338,7 @@ else endif ifeq ($(UCLIBC_HAS_BACKTRACE),y) # Add the AS_NEEDED entry for libubacktrace.so - if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_MAJORNAME) ] ; then \ + if [ -f $(top_builddir)lib/libc.so -a -f $(PREFIX)$(RUNTIME_PREFIX)$(MULTILIB_DIR)/$(SHARED_LIBNAME) ] ; then \ echo "GROUP ( $(UBACKTRACE_ASNEEDED) )" >> $(PREFIX)$(DEVEL_PREFIX)$(MULTILIB_DIR)/libc.so; \ fi endif -- cgit v1.2.3 From cf0b3a3342f24dbf601ba639bdce5b2a2f001c7a Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Mon, 30 May 2011 14:22:57 +0200 Subject: buildsys: fix pregen target (!NPTL with LOCALE) When NPTL is not enabled, and LOCALE support is used, compilation fails with the following error: ------------------------------------------------------------------------- MKDIR include/bits GEN include/bits/sysnum.h make[1]: *** No rule to make target `../..//include/bits/uClibc_ctype.h', needed by `../../extra/locale/gen_wc8bit.c'. Stop. make: *** [pregen] Error 2 ------------------------------------------------------------------------- The problem is that "headers" is not listed as prerequisite of pregen. These have been changed multiple times recently: o Austin: order headers before pregen-headers 1f5c73c9f8a98b1d2a35cea868a585c97ab0e436 o Khem: pregen: Fix the parallel build problem in pregen target 046035ecde92262d96eff2192ba3cda716f04909 o Khem: pregen-headers: Add new target which depends on headers. ef18cfe8ebab25f5ef92e81956f50e2dc57df602 o Carmelo: build: Fix infinite loop when no threading support is enabled ff5e4de7088fe8d34812c2a1e604bf04be713606 In all of these commits headers was actually as prerequisite In commit 9381d622e2411a35a5fd73a5a573eb269e2dd9c9 [nptl: fix buildsys] by Bernhard, headers was removed, causing the problem reported above. Signed-off-by: Filippo Arcidiacono Signed-off-by: Carmelo Amoroso --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.in b/Makefile.in index 8ed5f8f10..90a78db6c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -161,7 +161,7 @@ headers-y += $(target-headers-sysdep) headers: $(top_builddir)include/bits/uClibc_config.h | subdirs subdirs: $(addprefix $(top_builddir),$(subdirs)) pregen-headers: $(top_builddir)include/bits/sysnum.h $(pregen-headers-y) -pregen: pregen-headers +pregen: headers pregen-headers $(Q)$(if $(UCLIBC_HAS_LOCALE),$(MAKE) -C extra/locale locale_headers) $(top_builddir)include/bits/sysnum.h: $(top_srcdir)extra/scripts/gen_bits_syscall_h.sh | $(top_builddir)include/bits -- cgit v1.2.3 From 9a923848c48330ad6c96dc457402eafc2463dd7c Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 10 Jun 2011 13:05:34 -0700 Subject: nptl/Makefile.in: Fix the build break caused by UCLIBC_CTOR_DTOR enabling Extra / somehow does not match the target and complains that $(top_builddir)libpthread/nptl/sysdeps/pthread/crti.o has no rules to build Signed-off-by: Khem Raj --- libpthread/nptl/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in index 70616a1fe..92d72a6cb 100644 --- a/libpthread/nptl/Makefile.in +++ b/libpthread/nptl/Makefile.in @@ -64,8 +64,8 @@ endif librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS) ifeq ($(UCLIBC_CTOR_DTOR),y) -START_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crti.o -END_FILE-libpthread.so := $(top_builddir)/libpthread/nptl/sysdeps/pthread/crtn.o +START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/crti.o +END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/crtn.o LDFLAGS-libpthread.so += -nostartfiles $(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so) endif -- cgit v1.2.3 From 8245f3b4638fdff2011c2657af1bb211def704bc Mon Sep 17 00:00:00 2001 From: Phil Blundell Date: Sat, 11 Jun 2011 01:10:46 -0400 Subject: Fix __libc_epoll_pwait compile failure on x86 This prevents "memory input 7 is not directly addressable" errors. | libc/sysdeps/linux/common/epoll.c: In function '__libc_epoll_pwait': | libc/sysdeps/linux/common/epoll.c:71:80: error: memory input 7 is not directly addressable | libc/sysdeps/linux/common/epoll.c:75:86: error: memory input 7 is not directly addressable | make: *** [libc/sysdeps/linux/common/epoll.o] Error 1 | make: *** Waiting for unfinished jobs.... Signed-off-by: Phil Blundell Signed-off-by: Jason Woodward Signed-off-by: Khem Raj --- libc/sysdeps/linux/common/epoll.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libc/sysdeps/linux/common/epoll.c b/libc/sysdeps/linux/common/epoll.c index 85b0cfd2b..ab3e73bb7 100644 --- a/libc/sysdeps/linux/common/epoll.c +++ b/libc/sysdeps/linux/common/epoll.c @@ -67,12 +67,13 @@ extern __typeof(epoll_pwait) __libc_epoll_pwait; int __libc_epoll_pwait(int epfd, struct epoll_event *events, int maxevents, int timeout, const sigset_t *set) { + int nsig = _NSIG / 8; if (SINGLE_THREAD_P) - return INLINE_SYSCALL(epoll_pwait, 6, epfd, events, maxevents, timeout, set, _NSIG / 8); + return INLINE_SYSCALL(epoll_pwait, 6, epfd, events, maxevents, timeout, set, nsig); # ifdef __UCLIBC_HAS_THREADS_NATIVE__ else { int oldtype = LIBC_CANCEL_ASYNC (); - int result = INLINE_SYSCALL(epoll_pwait, 6, epfd, events, maxevents, timeout, set, _NSIG / 8); + int result = INLINE_SYSCALL(epoll_pwait, 6, epfd, events, maxevents, timeout, set, nsig); LIBC_CANCEL_RESET (oldtype); return result; } -- cgit v1.2.3 From 0e5a44e8ccf1c5ac49c1319f74c296e875f290e2 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 9 Jan 2011 01:45:04 +0100 Subject: ARM: reorder "Use BX" option "Use BX" is not available on all CPUs, so the option depends on a correct CPU to be chosen . It is weird that e BX" then appears _above_ the CPU selection, not below. Move the "Use BX" after the CPU selection. Signed-off-by: "Yann E. MORIN" Cc: Khem Raj Cc: Bernhard Reutner-Fischer Cc: Carmelo AMOROSO Signed-off-by: Khem Raj --- extra/Configs/Config.arm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm index eb27a3391..dd63b807c 100644 --- a/extra/Configs/Config.arm +++ b/extra/Configs/Config.arm @@ -30,13 +30,6 @@ config CONFIG_ARM_EABI endchoice -config USE_BX - bool "Use BX in function return" - default y - depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710 - help - Use BX instruction for THUMB aware architectures. - choice prompt "Target Processor Type" default CONFIG_GENERIC_ARM @@ -131,3 +124,10 @@ config CONFIG_ARM_IWMMXT select ARCH_HAS_MMU endchoice + +config USE_BX + bool "Use BX in function return" + default y + depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710 + help + Use BX instruction for THUMB aware architectures. -- cgit v1.2.3 From bda6117489ad3de5abfb008a8cb065c9059cd60c Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 9 Jan 2011 01:45:05 +0100 Subject: ARM: introduce blind options to select & force THUMB mode Add three new blind options to set use of Thumb mode: - COMPILE_IN_THUMB_MODE - if set, CFLAGS will contain -mthumb - if unset, the compiler's default is used - HAS_THUMB - CPUS with Thumb instruction set can select this - use of BX depends on this - FORCE_THUMB - CPUs that are Thumb-only must select this - this selects: HAS_THUMB, COMPILE_IN_THUMB_MODE and USE_BX Also, remove leading space in Rules.mak. Signed-off-by: "Yann E. MORIN" Cc: Khem Raj Cc: Bernhard Reutner-Fischer Cc: Carmelo AMOROSO Signed-off-by: Khem Raj --- Rules.mak | 7 ++++--- extra/Configs/Config.arm | 31 ++++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Rules.mak b/Rules.mak index 65fe47c63..8cd666fe6 100644 --- a/Rules.mak +++ b/Rules.mak @@ -351,9 +351,10 @@ ifeq ($(TARGET_ARCH),arm) CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4 CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110) CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv5te -Wa,-mcpu=xscale - CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt - CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 -mthumb - CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 -mthumb + CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt + CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 + CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 + CPU_CFLAGS-$(COMPILE_IN_THUMB_MODE)+=-mthumb endif ifeq ($(TARGET_ARCH),mips) diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm index dd63b807c..93038e9b2 100644 --- a/extra/Configs/Config.arm +++ b/extra/Configs/Config.arm @@ -64,70 +64,95 @@ config CONFIG_ARM710 config CONFIG_ARM7TDMI bool "Arm 7TDMI" select ARCH_HAS_NO_MMU + select HAS_THUMB config CONFIG_ARM720T bool "Arm 720T" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM920T bool "Arm 920T" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM922T bool "Arm 922T" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM926T bool "Arm 926T" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM10T bool "Arm 10T" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM1136JF_S bool "Arm 1136JF-S" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM1176JZ_S bool "Arm 1176JZ-S" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM1176JZF_S bool "Arm 1176JZF-S" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM_CORTEX_M3 bool "Arm Cortex-M3" select ARCH_HAS_NO_MMU - select USE_BX + select FORCE_THUMB config CONFIG_ARM_CORTEX_M1 bool "Arm Cortex-M1" select ARCH_HAS_NO_MMU - select USE_BX + select FORCE_THUMB config CONFIG_ARM_SA110 bool "Intel StrongArm SA-110" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM_SA1100 bool "Intel StrongArm SA-1100" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM_XSCALE bool "Intel Xscale" select ARCH_HAS_MMU + select HAS_THUMB config CONFIG_ARM_IWMMXT bool "Intel Xscale With WMMX PXA27x" select ARCH_HAS_MMU + select HAS_THUMB endchoice +config HAS_THUMB + bool + +config FORCE_THUMB + bool + select HAS_THUMB + select COMPILE_IN_THUMB_MODE + select USE_BX + +config COMPILE_IN_THUMB_MODE + bool + config USE_BX bool "Use BX in function return" default y - depends on !CONFIG_GENERIC_ARM && !CONFIG_ARM610 && !CONFIG_ARM710 + depends on HAS_THUMB help Use BX instruction for THUMB aware architectures. -- cgit v1.2.3 From 3936325282d988fcc998b4dfc611fcffcff29c40 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 9 Jan 2011 01:45:06 +0100 Subject: ARM: remove sub-arch/variants selection from menuconfig Rely on the compiler to be correctly set up to generate appropriate code for the target variant. This exposes the Thumb option, as it is no longer auto-selected. The "Use BX" no longer depends on supported CPU to be selected, so it now defaults to 'n' as it shall work by default on CPUs that do not have BX. Signed-off-by: "Yann E. MORIN" Cc: Khem Raj Cc: Bernhard Reutner-Fischer Cc: Carmelo AMOROSO Signed-off-by: Khem Raj --- Rules.mak | 19 ------- extra/Configs/Config.arm | 125 ++--------------------------------------------- 2 files changed, 5 insertions(+), 139 deletions(-) diff --git a/Rules.mak b/Rules.mak index 8cd666fe6..a635fdf55 100644 --- a/Rules.mak +++ b/Rules.mak @@ -335,25 +335,6 @@ endif ifeq ($(TARGET_ARCH),arm) CPU_CFLAGS-$(ARCH_LITTLE_ENDIAN)+=-mlittle-endian CPU_CFLAGS-$(ARCH_BIG_ENDIAN)+=-mbig-endian - CPU_CFLAGS-$(CONFIG_GENERIC_ARM)+= - CPU_CFLAGS-$(CONFIG_ARM610)+=-mtune=arm610 -march=armv3 - CPU_CFLAGS-$(CONFIG_ARM710)+=-mtune=arm710 -march=armv3 - CPU_CFLAGS-$(CONFIG_ARM7TDMI)+=-mtune=arm7tdmi -march=armv4t - CPU_CFLAGS-$(CONFIG_ARM720T)+=-mtune=arm7tdmi -march=armv4t - CPU_CFLAGS-$(CONFIG_ARM920T)+=-mtune=arm9tdmi -march=armv4t - CPU_CFLAGS-$(CONFIG_ARM922T)+=-mtune=arm9tdmi -march=armv4t - CPU_CFLAGS-$(CONFIG_ARM926T)+=-mtune=arm9e -march=armv5te - CPU_CFLAGS-$(CONFIG_ARM10T)+=-mtune=arm10tdmi -march=armv5t - CPU_CFLAGS-$(CONFIG_ARM1136JF_S)+=-mtune=arm1136jf-s -march=armv6 - CPU_CFLAGS-$(CONFIG_ARM1176JZ_S)+=-mtune=arm1176jz-s -march=armv6 - CPU_CFLAGS-$(CONFIG_ARM1176JZF_S)+=-mtune=arm1176jzf-s -march=armv6 - CPU_CFLAGS-$(CONFIG_ARM_SA110)+=-mtune=strongarm110 -march=armv4 - CPU_CFLAGS-$(CONFIG_ARM_SA1100)+=-mtune=strongarm1100 -march=armv4 - CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=$(call check_gcc,-mtune=xscale,-mtune=strongarm110) - CPU_CFLAGS-$(CONFIG_ARM_XSCALE)+=-march=armv5te -Wa,-mcpu=xscale - CPU_CFLAGS-$(CONFIG_ARM_IWMMXT)+=-march=iwmmxt -Wa,-mcpu=iwmmxt -mabi=iwmmxt - CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M3)+=-mcpu=cortex-m3 - CPU_CFLAGS-$(CONFIG_ARM_CORTEX_M1)+=-mcpu=cortex-m1 CPU_CFLAGS-$(COMPILE_IN_THUMB_MODE)+=-mthumb endif diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm index 93038e9b2..b3f66f4a4 100644 --- a/extra/Configs/Config.arm +++ b/extra/Configs/Config.arm @@ -30,129 +30,14 @@ config CONFIG_ARM_EABI endchoice -choice - prompt "Target Processor Type" - default CONFIG_GENERIC_ARM - help - This is the processor type of your CPU. This information is used for - optimizing purposes. To build a library that will run on all ARMCPU - types (albeit not optimally fast), you can specify "Generic Arm" here. - If you pick anything other than "Generic Arm", there is no guarantee - that uClibc will even run on anything other than the selected - processor type. - - Here are the settings recommended for greatest speed: - - "Generic Arm" select this if your compiler is already setup to - optimize things properly, or if you want to run on pretty much - everything, or you just don't much care. - - For anything else, pick the ARM core type that best matches the - cpu you will be using on your device. - - If you don't know what to do, choose "Generic Arm". - -config CONFIG_GENERIC_ARM - bool "Generic Arm" - -config CONFIG_ARM610 - bool "Arm 610" - select ARCH_HAS_MMU - -config CONFIG_ARM710 - bool "Arm 710" - select ARCH_HAS_MMU - -config CONFIG_ARM7TDMI - bool "Arm 7TDMI" - select ARCH_HAS_NO_MMU - select HAS_THUMB - -config CONFIG_ARM720T - bool "Arm 720T" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM920T - bool "Arm 920T" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM922T - bool "Arm 922T" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM926T - bool "Arm 926T" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM10T - bool "Arm 10T" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM1136JF_S - bool "Arm 1136JF-S" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM1176JZ_S - bool "Arm 1176JZ-S" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM1176JZF_S - bool "Arm 1176JZF-S" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM_CORTEX_M3 - bool "Arm Cortex-M3" - select ARCH_HAS_NO_MMU - select FORCE_THUMB - -config CONFIG_ARM_CORTEX_M1 - bool "Arm Cortex-M1" - select ARCH_HAS_NO_MMU - select FORCE_THUMB - -config CONFIG_ARM_SA110 - bool "Intel StrongArm SA-110" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM_SA1100 - bool "Intel StrongArm SA-1100" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM_XSCALE - bool "Intel Xscale" - select ARCH_HAS_MMU - select HAS_THUMB - -config CONFIG_ARM_IWMMXT - bool "Intel Xscale With WMMX PXA27x" - select ARCH_HAS_MMU - select HAS_THUMB - -endchoice - -config HAS_THUMB - bool - -config FORCE_THUMB - bool - select HAS_THUMB - select COMPILE_IN_THUMB_MODE - select USE_BX - config COMPILE_IN_THUMB_MODE - bool + bool "Build using Thumb mode" + select USE_BX + help + Say 'y' here to force building uClibc in thumb mode. + Say 'n' to use your compiler's default mode. config USE_BX bool "Use BX in function return" - default y - depends on HAS_THUMB help Use BX instruction for THUMB aware architectures. -- cgit v1.2.3 From 7f40574243cfdbecbc5dde1798105027b84b81fc Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 9 Jan 2011 01:45:07 +0100 Subject: ARM: transform the EABI/OABI choice into a boolean The CONFIG_ARM_OABI option is never used. Signed-off-by: "Yann E. MORIN" Cc: Khem Raj Cc: Bernhard Reutner-Fischer Cc: Carmelo AMOROSO Signed-off-by: Khem Raj --- extra/Configs/Config.arm | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm index b3f66f4a4..4ab7da0d1 100644 --- a/extra/Configs/Config.arm +++ b/extra/Configs/Config.arm @@ -12,23 +12,16 @@ config FORCE_OPTIONS_FOR_ARCH default y select ARCH_ANY_ENDIAN -choice - prompt "Target ABI" - default CONFIG_ARM_EABI +config CONFIG_ARM_EABI + bool "Build for EABI" help - If you choose "EABI" here, functions and constants required by the - ARM EABI will be built into the library. You should choose "EABI" + If you say 'y' here, functions and constants required by the + ARM EABI will be built into the library. You should say 'y' if your compiler uses the ARM EABI, in which case you will also - need a kernel supporting the EABI system call interface, or "OABI" - for a compiler using the old Linux ABI. - -config CONFIG_ARM_OABI - bool "OABI" - -config CONFIG_ARM_EABI - bool "EABI" + need a kernel supporting the EABI system call interface. -endchoice + If you say 'n' here, then the library will be built for the + old Linux ABI. config COMPILE_IN_THUMB_MODE bool "Build using Thumb mode" -- cgit v1.2.3 From 3862c65a05983b2b18cb7884a124a905828f7a18 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 9 Jan 2011 01:45:08 +0100 Subject: ARM: #include where __USE_BX__ is used The check for __USE_BX__ will be available in bits/arm_asm.h, so the latter must be included wherever the former is used. Signed-off-by: "Yann E. MORIN" Cc: Khem Raj Cc: Bernhard Reutner-Fischer Cc: Carmelo AMOROSO Signed-off-by: Khem Raj --- ldso/ldso/arm/dl-startup.h | 1 + libc/sysdeps/linux/arm/sysdep.h | 1 + 2 files changed, 2 insertions(+) diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h index a95389d98..2dfdaffda 100644 --- a/ldso/ldso/arm/dl-startup.h +++ b/ldso/ldso/arm/dl-startup.h @@ -7,6 +7,7 @@ */ #include +#include #if !defined(__thumb__) __asm__( diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h index 013f88cdd..e498695be 100644 --- a/libc/sysdeps/linux/arm/sysdep.h +++ b/libc/sysdeps/linux/arm/sysdep.h @@ -21,6 +21,7 @@ #define _LINUX_ARM_SYSDEP_H 1 #include +#include #include /* For Linux we can use the system call table in the header file -- cgit v1.2.3 From 7a246fda8e3bd2067d44e01c30c8ce761dad39a8 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 9 Jan 2011 01:45:09 +0100 Subject: ARM: detect BX availibility at build time The "use BX" option is now a suggestion that BX be used if available. Use a macro to detect if BX is available at build time. If so, and the user requested it be used, then use it. Otherwise, error out. Macro courtesy Khem RAJ: http://lists.uclibc.org/pipermail/uclibc/2009-April/042301.html Signed-off-by: "Yann E. MORIN" Cc: Khem Raj Cc: Bernhard Reutner-Fischer Cc: Carmelo AMOROSO Signed-off-by: Khem Raj --- extra/Configs/Config.arm | 4 +++- libc/sysdeps/linux/arm/bits/arm_asm.h | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/extra/Configs/Config.arm b/extra/Configs/Config.arm index 4ab7da0d1..0bb2971a9 100644 --- a/extra/Configs/Config.arm +++ b/extra/Configs/Config.arm @@ -33,4 +33,6 @@ config COMPILE_IN_THUMB_MODE config USE_BX bool "Use BX in function return" help - Use BX instruction for THUMB aware architectures. + Say 'y' to use BX to return from functions on your thumb-aware + processor. Say 'y' if you need to use interworking. Say 'n' if not. + It is safe to say 'y' even if you're not doing interworking. diff --git a/libc/sysdeps/linux/arm/bits/arm_asm.h b/libc/sysdeps/linux/arm/bits/arm_asm.h index 1d87df6eb..921c9a3c9 100644 --- a/libc/sysdeps/linux/arm/bits/arm_asm.h +++ b/libc/sysdeps/linux/arm/bits/arm_asm.h @@ -24,5 +24,12 @@ #define THUMB1_ONLY 1 #endif -#endif /* _ARM_ASM_H */ +#if defined(__USE_BX__) +# if ( defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_3__) \ + || defined (__ARM_ARCH_3M__) || defined (__ARM_ARCH_4__) \ + ) +# error Use of BX was requested, but is not available on the target processor. +# endif /* ARCH level */ +#endif /* __USE_BX__ */ +#endif /* _ARM_ASM_H */ -- cgit v1.2.3 From 4151e14cc8b60f5b3478d6c1f9372e427f7e05c4 Mon Sep 17 00:00:00 2001 From: "Yann E. MORIN" Date: Sun, 9 Jan 2011 01:45:10 +0100 Subject: ARM: remove EABI/OABI selection Rely on the compiler to be properly setup for the default ABI. When installing-headers, there are two cases: - NPTL: no issue, a cross-compiler is already expected - LinuxThreads: no issue, EABI/OABI has no impact on installed headers. Signed-off-by: "Yann E. MORIN" Cc: Khem Raj Cc: Bernhard Reutner-Fischer Cc: Carmelo AMOROSO Signed-off-by: Khem Raj --- libc/sysdeps/linux/arm/Makefile.arch | 9 +++++++-- libc/sysdeps/linux/arm/bits/huge_val.h | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/libc/sysdeps/linux/arm/Makefile.arch b/libc/sysdeps/linux/arm/Makefile.arch index b53c539bf..14279e0d7 100644 --- a/libc/sysdeps/linux/arm/Makefile.arch +++ b/libc/sysdeps/linux/arm/Makefile.arch @@ -24,7 +24,12 @@ ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),y) CSRC += posix_fadvise.c posix_fadvise64.c endif -ifeq ($(CONFIG_ARM_EABI),y) +# Is our compiler set up for EABI ? +IS_EABI:=$(shell $(CC) $(CFLAGS) -x c - -E -dM /dev/null \ + |sed -r -e '/^\#[[:space:]]*define[[:space:]]+__ARM_EABI__([[:space:]]+1)?$$/!d; s/.+/y/;' \ + ) + +ifeq ($(IS_EABI),y) CSRC += aeabi_assert.c aeabi_atexit.c aeabi_errno_addr.c \ aeabi_localeconv.c aeabi_memclr.c aeabi_memcpy.c \ aeabi_memmove.c aeabi_memset.c find_exidx.c @@ -37,7 +42,7 @@ else CSRC += syscall.c endif -ifeq ($(CONFIG_ARM_EABI),y) +ifeq ($(IS_EABI),y) libc-static-y += $(ARCH_OUT)/aeabi_lcsts.o $(ARCH_OUT)/aeabi_math.o \ $(ARCH_OUT)/aeabi_sighandlers.o libc-nonshared-y += $(ARCH_OUT)/aeabi_lcsts.os $(ARCH_OUT)/aeabi_math.os \ diff --git a/libc/sysdeps/linux/arm/bits/huge_val.h b/libc/sysdeps/linux/arm/bits/huge_val.h index a215f3c0b..745e0bbd5 100644 --- a/libc/sysdeps/linux/arm/bits/huge_val.h +++ b/libc/sysdeps/linux/arm/bits/huge_val.h @@ -32,7 +32,7 @@ # define HUGE_VAL (__extension__ 0x1.0p2047) #elif defined __GNUC__ -#ifndef __CONFIG_ARM_EABI__ +#ifndef __ARM_EABI__ # define HUGE_VAL \ (__extension__ \ ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ @@ -50,7 +50,7 @@ typedef union { unsigned char __c[8]; double __d; } __huge_val_t; -#ifndef __CONFIG_ARM_EABI__ +#ifndef __ARM_EABI__ # if __BYTE_ORDER == __BIG_ENDIAN # define __HUGE_VAL_bytes { 0, 0, 0, 0, 0x7f, 0xf0, 0, 0 } # endif -- cgit v1.2.3 From 45046d8134da4dee6a5d382cfbd17a1039e55f27 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 11 Jun 2011 00:15:02 -0700 Subject: Rules.mak: Rearrange appending UCLIBC_EXTRA_CFLAGS to CFLAGS UCLIBC_EXTRA_CFLAGS is currently added before the OPTIMIZATION flags and OPTIMIZATION is chosen to be Os by default. But in OE we pass the optimisation flags through UCLIBC_EXTRA_CFLAGS but they are not effective since -Os is specified at last. So we need to change the order of these option flags Signed-off-by: Khem Raj --- Rules.mak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Rules.mak b/Rules.mak index a635fdf55..076a13ac1 100644 --- a/Rules.mak +++ b/Rules.mak @@ -567,9 +567,6 @@ CFLAGS := -include $(top_srcdir)include/libc-symbols.h \ -nostdinc -I$(top_builddir)include -I$(top_srcdir)include -I. \ -I$(top_srcdir)libc/sysdeps/linux \ -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) -ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"") -CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS)) -endif # We need this to be checked within libc-symbols.h ifneq ($(HAVE_SHARED),y) @@ -615,6 +612,9 @@ LDFLAGS += -Wl,-s else STRIPTOOL := true -Stripping_disabled endif +ifneq ($(strip $(UCLIBC_EXTRA_CFLAGS)),"") +CFLAGS += $(call qstrip,$(UCLIBC_EXTRA_CFLAGS)) +endif ifeq ($(DOMULTI),y) # we try to compile all sources at once into an object (IMA), but -- cgit v1.2.3 From c97ce776368ec5d9d954fc8653f3e1c11490fc74 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 13 Jun 2011 16:30:55 -0700 Subject: ctor/dtor nptl: Fix init and fini function compilation We need to define the rules for .S files so it gets the include paths some architectures like mips include headers Some architectures e.g. SH have their own version of pt-initfini.c so look for that first before resorting to generic version of pt-initfini.c Signed-off-by: Khem Raj --- libc/sysdeps/linux/mips/crtn.S | 15 --------------- libpthread/nptl/Makefile.in | 4 ++-- libpthread/nptl/sysdeps/pthread/Makefile.in | 26 ++++++++++++++++++++------ 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/libc/sysdeps/linux/mips/crtn.S b/libc/sysdeps/linux/mips/crtn.S index cedd593f0..f3756a2f1 100644 --- a/libc/sysdeps/linux/mips/crtn.S +++ b/libc/sysdeps/linux/mips/crtn.S @@ -10,7 +10,6 @@ #NO_APP .align 2 .globl _init - .ent _init .type _init, @function #NO_APP lw $31,28($sp) @@ -22,14 +21,12 @@ .set macro .set reorder - .end _init #APP .section .fini #NO_APP .align 2 .globl _fini - .ent _fini .type _fini, @function #NO_APP lw $31,28($sp) @@ -41,7 +38,6 @@ .set macro .set reorder - .end _fini #APP .ident "GCC: (GNU) 3.3.2" @@ -54,10 +50,8 @@ .section .init #NO_APP - .align 2 .align 3 .globl _init - .ent _init .type _init, @function #NO_APP ld $31,8($sp) @@ -68,16 +62,12 @@ addiu $sp,$sp,16 .set macro .set reorder - - .end _init #APP .section .fini #NO_APP - .align 2 .align 3 .globl _fini - .ent _fini .type _fini, @function #NO_APP ld $31,8($sp) @@ -89,7 +79,6 @@ .set macro .set reorder - .end _fini #APP .ident "GCC: (GNU) 3.4.3" @@ -105,7 +94,6 @@ #NO_APP .align 2 .globl _init - .ent _init .type _init, @function #NO_APP ld $31,24($sp) @@ -118,14 +106,12 @@ .set macro .set reorder - .end _init #APP .section .fini #NO_APP .align 2 .globl _fini - .ent _fini .type _fini, @function #NO_APP ld $31,24($sp) @@ -138,7 +124,6 @@ .set macro .set reorder - .end _fini #APP .ident "GCC: (GNU) 3.3.2" diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in index 92d72a6cb..849bd5965 100644 --- a/libpthread/nptl/Makefile.in +++ b/libpthread/nptl/Makefile.in @@ -64,8 +64,8 @@ endif librt-so-y += $(librt_OBJS:.o=.oS) $(librt-pt-shared-only-routines-y:.o=.oS) ifeq ($(UCLIBC_CTOR_DTOR),y) -START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/crti.o -END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/crtn.o +START_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crti.o +END_FILE-libpthread.so := $(top_builddir)libpthread/nptl/sysdeps/pthread/pt-crtn.o LDFLAGS-libpthread.so += -nostartfiles $(top_builddir)lib/libpthread.so: | $(START_FILE-libpthread.so) $(END_FILE-libpthread.so) endif diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in index d93b3a55f..398eaea12 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -73,23 +73,37 @@ CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions \ -finhibit-size-directive \ -fno-asynchronous-unwind-tables -fno-unwind-tables \ $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,)) -ASFLAGS-crti.S = -g0 -ASFLAGS-crtn.S = -g0 -$(libpthread_pthread_OUT)/pt-initfini.s: $(libpthread_pthread_DIR)/pt-initfini.c +#ASFLAGS += $(PICFLAG) -I$(top_srcdir)include -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) +ifneq ($(wildcard $(libpthread_DIR)/sysdeps/linux/$(TARGET_ARCH)/pt-initfini.c),) +PTHREAD_INITFINI := $(libpthread_DIR)/sysdeps/linux/$(TARGET_ARCH)/pt-initfini.c +else +PTHREAD_INITFINI := $(libpthread_pthread_DIR)/pt-initfini.c +endif + +ASFLAGS-pt-crti.S = $(PICFLAG) +ASFLAGS-pt-crtn.S = $(PICFLAG) + +$(libpthread_pthread_OUT)/pt-crti.o: $(libpthread_pthread_OUT)/pt-crti.S + $(compile.S) + +$(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S + $(compile.S) + +$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) $(compile.c) -$(libpthread_pthread_OUT)/defs.h: $(libpthread_pthread_DIR)/pt-initfini.c +$(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI) $(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \ $(AWK) -f $(top_srcdir)extra/scripts/defs.awk > $@.tmp $(Q)mv $@.tmp $@ -$(libpthread_pthread_OUT)/crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h +$(libpthread_pthread_OUT)/pt-crti.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h $(do_sed) -n -e '/[ ]*\.file/d' \ -e '1,/@HEADER_ENDS/p' \ -e '/@_.*_PROLOG_BEGINS/,/@_.*_PROLOG_ENDS/p' \ -e '/@TRAILER_BEGINS/,$$p' $< > $@.tmp $(Q)mv $@.tmp $@ -$(libpthread_pthread_OUT)/crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h +$(libpthread_pthread_OUT)/pt-crtn.S: $(libpthread_pthread_OUT)/pt-initfini.s $(libpthread_pthread_OUT)/defs.h $(do_sed) -n -e '/[ ]*\.file/d' \ -e '1,/@HEADER_ENDS/p' \ -e '/@_.*_EPILOG_BEGINS/,/@_.*_EPILOG_ENDS/p' \ -- cgit v1.2.3 From f282ca2286c728c805dff4d57f7c3b3404f1a618 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 13 Jun 2011 17:13:52 -0700 Subject: nptl/pthread: Correct path for machine specific pt-initfini.c Signed-off-by: Khem Raj --- libpthread/nptl/sysdeps/pthread/Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in index 398eaea12..ca8464227 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -75,8 +75,8 @@ CFLAGS-pt-initfini.c = -S -g0 $(PICFLAG) -fno-inline-functions \ $(patsubst -f%,-fno-%,$(call check_gcc,-fexceptions,)) #ASFLAGS += $(PICFLAG) -I$(top_srcdir)include -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) -ifneq ($(wildcard $(libpthread_DIR)/sysdeps/linux/$(TARGET_ARCH)/pt-initfini.c),) -PTHREAD_INITFINI := $(libpthread_DIR)/sysdeps/linux/$(TARGET_ARCH)/pt-initfini.c +ifneq ($(wildcard $(libpthread_pthread_DIR)/../unix/sysv/linux/$(TARGET_ARCH)/pt-initfini.c),) +PTHREAD_INITFINI := $(libpthread_pthread_DIR)/../unix/sysv/linux/$(TARGET_ARCH)/pt-initfini.c else PTHREAD_INITFINI := $(libpthread_pthread_DIR)/pt-initfini.c endif -- cgit v1.2.3 From 2fa7315f3456d13512e9a65848c4f0874fce9c5b Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Jun 2011 10:27:17 +0200 Subject: bump version to 0.9.33-git Signed-off-by: Bernhard Reutner-Fischer --- Rules.mak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rules.mak b/Rules.mak index 076a13ac1..4e4baf9d2 100644 --- a/Rules.mak +++ b/Rules.mak @@ -105,8 +105,8 @@ export RUNTIME_PREFIX DEVEL_PREFIX KERNEL_HEADERS MULTILIB_DIR # Now config hard core MAJOR_VERSION := 0 MINOR_VERSION := 9 -SUBLEVEL := 32 -EXTRAVERSION :=-rc3-git +SUBLEVEL := 33 +EXTRAVERSION :=-git VERSION := $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL) ABI_VERSION := $(MAJOR_VERSION) ifneq ($(EXTRAVERSION),) -- cgit v1.2.3 From bc3be18145e4d57e7268506f123c0f0f373a15e2 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Sun, 12 Jun 2011 12:09:04 +0000 Subject: getaddrinfo: allow numeric service without any hints This appears to correspond to what glibc does and this fixes an issue with iptables-1.4.11 with udp and raw port numbers. (see http://bugzilla.netfilter.org/show_bug.cgi?id=721) This fixes #3841 https://bugs.busybox.net/show_bug.cgi?id=3841 Signed-off-by: Natanael Copa Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/getaddrinfo.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c index 1a77c5199..e7511f6c4 100644 --- a/libc/inet/getaddrinfo.c +++ b/libc/inet/getaddrinfo.c @@ -820,13 +820,6 @@ getaddrinfo(const char *name, const char *service, if (hints->ai_flags & AI_NUMERICSERV) return EAI_NONAME; gaih_service.num = -1; - } else { - /* - * Can't specify a numerical socket unless a protocol - * family was given. - */ - if (hints->ai_socktype == 0 && hints->ai_protocol == 0) - return EAI_SERVICE; } pservice = &gaih_service; } else -- cgit v1.2.3 From 0100056707c0ca5c51bb0b8d88612a407be09ef1 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Jun 2011 16:31:00 +0200 Subject: resolv: try next server on SERVFAIL in bug 3637 Andrey Kovalev aka pxe.ru writes: getaddrinfo does NOT add domain to query when receive SERVFAIL RFC1035 7.2 suggests that - If a resolver gets a server error or other bizarre response from a name server, it should remove it from SLIST, and may wish to schedule an immediate transmission to the next candidate server address. So let's try the next server upon SERVFAIL even if it's not strictly required. Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/resolv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 021d5bf5d..e8b7f2bad 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1461,7 +1461,7 @@ int attribute_hidden __dns_lookup(const char *name, /* bug 660 says we treat negative response as an error * and retry, which is, eh, an error. :) * We were incurring long delays because of this. */ - if (h.rcode == NXDOMAIN) { + if (h.rcode == NXDOMAIN || h.rcode == SERVFAIL) { /* if possible, try next search domain */ if (!ends_with_dot) { DPRINTF("variant:%d sdomains:%d\n", variant, sdomains); -- cgit v1.2.3 From 6b76a7129903ab3726ec0217349b526262bec3ac Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Jun 2011 16:48:51 +0200 Subject: libdl: search for ELF_RTYPE_CLASS_DLSYM in dlsym() On FDPIC platforms, functions are passed by function descriptor, not by pointers. If you don't specify ELF_RTYPE_CLASS_DLSYM when calling _dl_find_hash() the return value from dlsym() will be a pointer not a function descriptor, crashing the program. The bug was introduced when TLS support was added in 534661b91c98492995274c364c8177c45efc63db Closes bug#3433 Signed-off-by: Bernhard Reutner-Fischer --- ldso/libdl/libdl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/libdl/libdl.c b/ldso/libdl/libdl.c index 52c77b00a..f59889c99 100644 --- a/ldso/libdl/libdl.c +++ b/ldso/libdl/libdl.c @@ -667,7 +667,7 @@ void *dlsym(void *vhandle, const char *name) tpnt = NULL; if (handle == _dl_symbol_tables) tpnt = handle->dyn; /* Only search RTLD_GLOBAL objs if global object */ - ret = _dl_find_hash(name2, handle, tpnt, 0, &sym_ref); + ret = _dl_find_hash(name2, handle, tpnt, ELF_RTYPE_CLASS_DLSYM, &sym_ref); #if defined(USE_TLS) && USE_TLS && defined SHARED if (sym_ref.tpnt) { -- cgit v1.2.3 From 4cf580dfcc5846b89a4cf688ecca431d5a5e5647 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Jun 2011 17:51:58 +0200 Subject: buildsys: pt-initfini.s depends on uClibc_config.h Signed-off-by: Bernhard Reutner-Fischer --- libpthread/nptl/sysdeps/pthread/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in index ca8464227..be5c022b1 100644 --- a/libpthread/nptl/sysdeps/pthread/Makefile.in +++ b/libpthread/nptl/sysdeps/pthread/Makefile.in @@ -90,7 +90,7 @@ $(libpthread_pthread_OUT)/pt-crti.o: $(libpthread_pthread_OUT)/pt-crti.S $(libpthread_pthread_OUT)/pt-crtn.o: $(libpthread_pthread_OUT)/pt-crtn.S $(compile.S) -$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) +$(libpthread_pthread_OUT)/pt-initfini.s: $(PTHREAD_INITFINI) | $(top_builddir)include/bits/uClibc_config.h $(compile.c) $(libpthread_pthread_OUT)/defs.h: $(PTHREAD_INITFINI) $(do_sed) -n -e '/@TESTS_BEGIN/,/@TESTS_END/p' $< | \ -- cgit v1.2.3 From 97c3c5f634379ff7b16dcaeff34b7f3eeea2b3f1 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Tue, 14 Jun 2011 18:48:19 +0200 Subject: config: Fix passing defconfig args Don't rely on argument-shuffling but use correct arguments in the first place. In bug#3589 Thomas Suckow writes: The modified kconfig defines -D to be the same function as -d. In addition -d does not take an argument and Config.in should be passed as a non-option argument. The existing argument order appears to work on distributions such as Fedora but chokes on Cygwin (newlib?). Signed-off-by: Bernhard Reutner-Fischer --- Makefile.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 90a78db6c..ad9e629e1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -448,8 +448,8 @@ allnoconfig: $(top_builddir)extra/config/conf $(Q)$(top_builddir)extra/config/conf -n extra/Configs/Config.in defconfig: $(top_builddir)extra/config/conf - $(Q)$(top_builddir)extra/config/conf -d extra/Configs/Config.in \ - -D extra/Configs/defconfigs/$(ARCH) + $(Q)$(top_builddir)extra/config/conf \ + -D extra/Configs/defconfigs/$(ARCH) extra/Configs/Config.in menuconfig-clean-y: $(Q)$(MAKE) -C extra/config CLEAN_extra/config -- cgit v1.2.3 From e8dc8eca8d312a717dc94f9783af212aed388c11 Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 17 Jun 2011 20:27:51 +0200 Subject: resolv: fix bug in res_init with ipv6 nameservers Thanks to Christian Krause for finding and fixing this! Signed-off-by: Bernhard Reutner-Fischer --- libc/inet/resolv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index e8b7f2bad..dc8a752fa 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -2964,7 +2964,7 @@ int res_init(void) if (__nameserver[i].sa.sa_family == AF_INET6 && m < ARRAY_SIZE(rp->_u._ext.nsaddrs) ) { - struct sockaddr_in6 *sa6 = malloc(sizeof(sa6)); + struct sockaddr_in6 *sa6 = malloc(sizeof(*sa6)); if (sa6) { *sa6 = __nameserver[i].sa6; /* struct copy */ rp->_u._ext.nsaddrs[m] = sa6; @@ -2981,7 +2981,7 @@ int res_init(void) #else /* IPv6 only */ while (m < ARRAY_SIZE(rp->_u._ext.nsaddrs) && i < __nameservers) { - struct sockaddr_in6 *sa6 = malloc(sizeof(sa6)); + struct sockaddr_in6 *sa6 = malloc(sizeof(*sa6)); if (sa6) { *sa6 = __nameserver[i].sa6; /* struct copy */ rp->_u._ext.nsaddrs[m] = sa6; -- cgit v1.2.3 From c2eaaf39dc68e5d2acc4fbae95d815c85dd5a4fb Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Mon, 13 Jun 2011 19:58:22 +0200 Subject: ldso_tls: fix compiler warning due to missing cast Fix compiler warning (as below) due to missign cast In file included from ldso/ldso/ldso.c:42:0: ldso/ldso/dl-tls.c: In function 'init_tls': ldso/ldso/dl-tls.c:1028:24: error: initialization makes pointer from integer without a cast Signed-off-by: Carmelo Amoroso --- ldso/ldso/dl-tls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ldso/ldso/dl-tls.c b/ldso/ldso/dl-tls.c index 43dd5a00a..362efbbec 100644 --- a/ldso/ldso/dl-tls.c +++ b/ldso/ldso/dl-tls.c @@ -1025,7 +1025,7 @@ init_tls (void) /* And finally install it for the main thread. If ld.so itself uses TLS we know the thread pointer was initialized earlier. */ - const char *lossage = TLS_INIT_TP (tcbp, USE___THREAD); + const char *lossage = (char *)TLS_INIT_TP (tcbp, USE___THREAD); if(__builtin_expect (lossage != NULL, 0)) { _dl_debug_early("cannot set up thread-local storage: %s\n", lossage); _dl_exit(30); -- cgit v1.2.3 From 74da7a88552ecf518e64642c90742fddca57be00 Mon Sep 17 00:00:00 2001 From: Carmelo Amoroso Date: Fri, 24 Jun 2011 15:05:55 +0200 Subject: fts: fix warning due to old-style function definition Signed-off-by: Carmelo Amoroso --- libc/misc/fts/fts.c | 64 ++++++++++++++--------------------------------------- 1 file changed, 16 insertions(+), 48 deletions(-) diff --git a/libc/misc/fts/fts.c b/libc/misc/fts/fts.c index ce5d1586b..deb8f4adc 100644 --- a/libc/misc/fts/fts.c +++ b/libc/misc/fts/fts.c @@ -87,10 +87,8 @@ static int fts_safe_changedir (FTS *, FTSENT *, int, const char *) #define BREAD 3 /* fts_read */ FTS * -fts_open(argv, options, compar) - char * const *argv; - register int options; - int (*compar) (const FTSENT **, const FTSENT **); +fts_open( char * const *argv, register int options, + int (*compar) (const FTSENT **, const FTSENT **)) { register FTS *sp; register FTSENT *p, *root; @@ -204,9 +202,7 @@ mem1: free(sp); static void internal_function -fts_load(sp, p) - FTS *sp; - register FTSENT *p; +fts_load(FTS *sp, register FTSENT *p) { register int len; register char *cp; @@ -230,8 +226,7 @@ fts_load(sp, p) } int -fts_close(sp) - FTS *sp; +fts_close(FTS *sp) { register FTSENT *freep, *p; int saved_errno; @@ -284,8 +279,7 @@ fts_close(sp) ? p->fts_pathlen - 1 : p->fts_pathlen) FTSENT * -fts_read(sp) - register FTS *sp; +fts_read(register FTS *sp) { register FTSENT *p, *tmp; register int instr; @@ -481,10 +475,7 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent); */ /* ARGSUSED */ int -fts_set(sp, p, instr) - FTS *sp; - FTSENT *p; - int instr; +fts_set(FTS *sp, FTSENT *p, int instr) { if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW && instr != FTS_NOINSTR && instr != FTS_SKIP) { @@ -496,9 +487,7 @@ fts_set(sp, p, instr) } FTSENT * -fts_children(sp, instr) - register FTS *sp; - int instr; +fts_children(register FTS *sp, int instr) { register FTSENT *p; int fd; @@ -579,9 +568,7 @@ fts_children(sp, instr) */ static FTSENT * internal_function -fts_build(sp, type) - register FTS *sp; - int type; +fts_build(register FTS *sp, int type) { register struct dirent *dp; register FTSENT *p, *head; @@ -851,10 +838,7 @@ mem1: saved_errno = errno; static u_short internal_function -fts_stat(sp, p, follow) - FTS *sp; - register FTSENT *p; - int follow; +fts_stat(FTS *sp, register FTSENT *p, int follow) { register FTSENT *t; register dev_t dev; @@ -935,10 +919,7 @@ err: memset(sbp, 0, sizeof(struct stat)); static FTSENT * internal_function -fts_sort(sp, head, nitems) - FTS *sp; - FTSENT *head; - register int nitems; +fts_sort(FTS *sp, FTSENT *head, register int nitems) { register FTSENT **ap, *p; @@ -973,10 +954,7 @@ fts_sort(sp, head, nitems) static FTSENT * internal_function -fts_alloc(sp, name, namelen) - FTS *sp; - const char *name; - size_t namelen; +fts_alloc(FTS *sp, const char *name, size_t namelen) { register FTSENT *p; size_t len; @@ -1013,8 +991,7 @@ fts_alloc(sp, name, namelen) static void internal_function -fts_lfree(head) - register FTSENT *head; +fts_lfree(register FTSENT *head) { register FTSENT *p; @@ -1033,9 +1010,7 @@ fts_lfree(head) */ static int internal_function -fts_palloc(sp, more) - FTS *sp; - size_t more; +fts_palloc(FTS *sp, size_t more) { char *p; @@ -1067,9 +1042,7 @@ fts_palloc(sp, more) */ static void internal_function -fts_padjust(sp, head) - FTS *sp; - FTSENT *head; +fts_padjust(FTS *sp, FTSENT *head) { FTSENT *p; char *addr = sp->fts_path; @@ -1094,8 +1067,7 @@ fts_padjust(sp, head) static size_t internal_function -fts_maxarglen(argv) - char * const *argv; +fts_maxarglen(char * const *argv) { size_t len, max; @@ -1112,11 +1084,7 @@ fts_maxarglen(argv) */ static int internal_function -fts_safe_changedir(sp, p, fd, path) - FTS *sp; - FTSENT *p; - int fd; - const char *path; +fts_safe_changedir(FTS *sp, FTSENT *p, int fd, const char *path) { int ret, oerrno, newfd; struct stat64 sb; -- cgit v1.2.3