OpenLIBM: local modification - elf notes on assembly
authorJohn Marino <draco@marino.st>
Sun, 12 Jul 2015 20:06:59 +0000 (21:06 +0100)
committerJohn Marino <draco@marino.st>
Sun, 12 Jul 2015 20:07:00 +0000 (22:07 +0200)
All object files need a .note.GNU-stack elf section in order to preserve
the ability for the resulting program to run on a non-executable stack.
If a single object is missing this section, the linker will run the program
on an executable stack instead which is less secure.

The FreeBSD and NetBSD libm assembly files have these notes, but OpenBSD
does not use them, thus the need for a local modification.

43 files changed:
contrib/openbsd_libm/arch/amd64/e_acos.S
contrib/openbsd_libm/arch/amd64/e_asin.S
contrib/openbsd_libm/arch/amd64/e_atan2.S
contrib/openbsd_libm/arch/amd64/e_atan2f.S
contrib/openbsd_libm/arch/amd64/e_exp.S
contrib/openbsd_libm/arch/amd64/e_fmod.S
contrib/openbsd_libm/arch/amd64/e_log.S
contrib/openbsd_libm/arch/amd64/e_log10.S
contrib/openbsd_libm/arch/amd64/e_remainder.S
contrib/openbsd_libm/arch/amd64/e_remainderf.S
contrib/openbsd_libm/arch/amd64/e_scalb.S
contrib/openbsd_libm/arch/amd64/e_sqrt.S
contrib/openbsd_libm/arch/amd64/e_sqrtf.S
contrib/openbsd_libm/arch/amd64/e_sqrtl.S
contrib/openbsd_libm/arch/amd64/s_atan.S
contrib/openbsd_libm/arch/amd64/s_atanf.S
contrib/openbsd_libm/arch/amd64/s_ceil.S
contrib/openbsd_libm/arch/amd64/s_ceilf.S
contrib/openbsd_libm/arch/amd64/s_copysign.S
contrib/openbsd_libm/arch/amd64/s_copysignf.S
contrib/openbsd_libm/arch/amd64/s_cos.S
contrib/openbsd_libm/arch/amd64/s_cosf.S
contrib/openbsd_libm/arch/amd64/s_floor.S
contrib/openbsd_libm/arch/amd64/s_floorf.S
contrib/openbsd_libm/arch/amd64/s_ilogb.S
contrib/openbsd_libm/arch/amd64/s_ilogbf.S
contrib/openbsd_libm/arch/amd64/s_llrint.S
contrib/openbsd_libm/arch/amd64/s_llrintf.S
contrib/openbsd_libm/arch/amd64/s_log1p.S
contrib/openbsd_libm/arch/amd64/s_log1pf.S
contrib/openbsd_libm/arch/amd64/s_logb.S
contrib/openbsd_libm/arch/amd64/s_logbf.S
contrib/openbsd_libm/arch/amd64/s_lrint.S
contrib/openbsd_libm/arch/amd64/s_lrintf.S
contrib/openbsd_libm/arch/amd64/s_rint.S
contrib/openbsd_libm/arch/amd64/s_rintf.S
contrib/openbsd_libm/arch/amd64/s_scalbnf.S
contrib/openbsd_libm/arch/amd64/s_significand.S
contrib/openbsd_libm/arch/amd64/s_significandf.S
contrib/openbsd_libm/arch/amd64/s_sin.S
contrib/openbsd_libm/arch/amd64/s_sinf.S
contrib/openbsd_libm/arch/amd64/s_tan.S
contrib/openbsd_libm/arch/amd64/s_tanf.S

index 5b493c2..93fb210 100644 (file)
@@ -21,3 +21,6 @@ ENTRY(acos)
        fpatan
        XMM_DOUBLE_EPILOGUE
        ret
+END(acos)
+
+       .section .note.GNU-stack,"",%progbits
index 3e337c8..6a9586e 100644 (file)
@@ -20,3 +20,6 @@ ENTRY(asin)
        fpatan
        XMM_DOUBLE_EPILOGUE
        ret
+END(asin)
+
+       .section .note.GNU-stack,"",%progbits
index ac7c6bb..6120624 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(atan2)
        fpatan
        XMM_DOUBLE_EPILOGUE
        ret
+END(atan2)
+
+       .section .note.GNU-stack,"",%progbits
index 77bd7cd..778a22d 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(atan2f)
        fpatan
        XMM_FLOAT_EPILOGUE
        ret
+END(atan2f)
+
+       .section .note.GNU-stack,"",%progbits
index 101e3c7..d4cf8de 100644 (file)
@@ -99,3 +99,6 @@ x_Inf_or_NaN:
 x_not_minus_Inf:
        movsd   ARG_DOUBLE_ONE,%xmm0
        ret
+END(exp)
+
+       .section .note.GNU-stack,"",%progbits
index 71c8f9c..5cc0895 100644 (file)
@@ -20,3 +20,6 @@ ENTRY(fmod)
        fstp    %st(1)
        XMM_DOUBLE_EPILOGUE
        ret
+END(fmod)
+
+       .section .note.GNU-stack,"",%progbits
index e0293b2..87072e4 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(log)
        fyl2x
        XMM_DOUBLE_EPILOGUE
        ret
+END(log)
+
+       .section .note.GNU-stack,"",%progbits
index d0439b5..1026527 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(log10)
        fyl2x
        XMM_DOUBLE_EPILOGUE
        ret
+END(log10)
+
+       .section .note.GNU-stack,"",%progbits
index 1971538..8d0c50a 100644 (file)
@@ -19,3 +19,6 @@ ENTRY(remainder)
        fstp    %st(1)
        XMM_DOUBLE_EPILOGUE
        ret
+END(remainder)
+
+       .section .note.GNU-stack,"",%progbits
index c739332..fb557e1 100644 (file)
@@ -19,3 +19,6 @@ ENTRY(remainderf)
        fstp    %st(1)
        XMM_FLOAT_EPILOGUE
        ret
+END(remainderf)
+
+       .section .note.GNU-stack,"",%progbits
index ac55499..57785fe 100644 (file)
@@ -16,3 +16,6 @@ ENTRY(scalb)
        fstp    %st(1)                  /* bug fix for fp stack overflow */
        XMM_DOUBLE_EPILOGUE
        ret
+END(scalb)
+
+       .section .note.GNU-stack,"",%progbits
index 5b01486..770dc93 100644 (file)
@@ -9,3 +9,6 @@
 ENTRY(sqrt)
        sqrtsd  %xmm0,%xmm0
        ret
+END(sqrt)
+
+       .section .note.GNU-stack,"",%progbits
index 50fd81b..56de23c 100644 (file)
@@ -9,3 +9,6 @@
 ENTRY(sqrtf)
        sqrtss  %xmm0,%xmm0
        ret
+END(sqrtf)
+
+       .section .note.GNU-stack,"",%progbits
index 37bc91c..fa47c5a 100644 (file)
@@ -10,3 +10,6 @@ ENTRY(sqrtl)
        fldt    8(%rsp)
        fsqrt
        ret
+END(sqrtl)
+
+       .section .note.GNU-stack,"",%progbits
index 5b66329..e96d111 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(atan)
        fpatan
        XMM_DOUBLE_EPILOGUE
        ret
+END(atan)
+
+       .section .note.GNU-stack,"",%progbits
index 5b5dcce..aa778e0 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(atanf)
        fpatan
        XMM_FLOAT_EPILOGUE
        ret
+END(atanf)
+
+       .section .note.GNU-stack,"",%progbits
index 0208581..82529a6 100644 (file)
@@ -22,3 +22,6 @@ ENTRY(ceil)
        fstpl   -8(%rsp)
        movsd   -8(%rsp),%xmm0
        ret
+END(ceil)
+
+       .section .note.GNU-stack,"",%progbits
index a02291e..2aee3eb 100644 (file)
@@ -20,3 +20,6 @@ ENTRY(ceilf)
        fstps   -4(%rsp)
        movss   -4(%rsp),%xmm0
        ret
+END(ceilf)
+
+       .section .note.GNU-stack,"",%progbits
index 7f8c98c..bec6808 100644 (file)
@@ -18,3 +18,6 @@ ENTRY(copysign)
        pand    %xmm3,%xmm0
        por     %xmm1,%xmm0
        ret
+END(copysign)
+
+       .section .note.GNU-stack,"",%progbits
index 618203b..847232f 100644 (file)
@@ -18,3 +18,6 @@ ENTRY(copysignf)
        pand    %xmm3,%xmm0
        por     %xmm1,%xmm0
        ret
+END(copysignf)
+
+       .section .note.GNU-stack,"",%progbits
index c9d191d..c5334f7 100644 (file)
@@ -28,3 +28,6 @@ ENTRY(cos)
        fcos
        XMM_DOUBLE_EPILOGUE
        ret
+END(cos)
+
+       .section .note.GNU-stack,"",%progbits
index 55c8307..9ffe4d1 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(cosf)
        fcos
        XMM_FLOAT_EPILOGUE
        ret     
+END(cosf)
+
+       .section .note.GNU-stack,"",%progbits
index aa611f7..3706a5a 100644 (file)
@@ -20,3 +20,6 @@ ENTRY(floor)
        fstpl   -8(%rsp)
        movsd   -8(%rsp),%xmm0
        ret
+END(floor)
+
+       .section .note.GNU-stack,"",%progbits
index 66bef66..dcfea1c 100644 (file)
@@ -20,3 +20,6 @@ ENTRY(floorf)
        fstps   -4(%rsp)
        movss   -4(%rsp),%xmm0
        ret
+END(floorf)
+
+       .section .note.GNU-stack,"",%progbits
index e8a512e..f52a41d 100644 (file)
@@ -14,3 +14,6 @@ ENTRY(ilogb)
        fistpl  -8(%rsp)
        movl    -8(%rsp),%eax
        ret
+END(ilogb)
+
+       .section .note.GNU-stack,"",%progbits
index be08095..de25437 100644 (file)
@@ -14,3 +14,6 @@ ENTRY(ilogbf)
        fistpl  -4(%rsp)
        movl    -4(%rsp),%eax
        ret
+END(ilogbf)
+
+       .section .note.GNU-stack,"",%progbits
index aeb1347..9e58397 100644 (file)
@@ -9,4 +9,6 @@
 ENTRY(llrint)
        cvtsd2si %xmm0, %rax
        ret
+END(llrint)
 
+       .section .note.GNU-stack,"",%progbits
index 6d06da4..241f57f 100644 (file)
@@ -9,4 +9,6 @@
 ENTRY(llrintf)
        cvtss2si %xmm0, %rax
        ret
+END(llrintf)
 
+       .section .note.GNU-stack,"",%progbits
index 6fa75bd..d99468d 100644 (file)
@@ -73,3 +73,6 @@ use_fyl2xp1:
        fyl2xp1
        XMM_DOUBLE_EPILOGUE
        ret
+END(log1p)
+
+       .section .note.GNU-stack,"",%progbits
index 5180517..b2fda1f 100644 (file)
@@ -73,3 +73,6 @@ use_fyl2xp1:
        fyl2xp1
        XMM_FLOAT_EPILOGUE
        ret
+END(log1pf)
+
+       .section .note.GNU-stack,"",%progbits
index 90f2a83..9050236 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(logb)
        fstp    %st
        XMM_DOUBLE_EPILOGUE
        ret
+END(logb)
+
+       .section .note.GNU-stack,"",%progbits
index f5548cc..b12f00b 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(logbf)
        fstp    %st
        XMM_FLOAT_EPILOGUE
        ret
+END(logbf)
+
+       .section .note.GNU-stack,"",%progbits
index 5cc2712..8fdbc9d 100644 (file)
@@ -9,4 +9,6 @@
 ENTRY(lrint)
        cvtsd2si %xmm0, %rax
        ret
+END(lrint)
 
+       .section .note.GNU-stack,"",%progbits
index 912e6b6..c4f76fd 100644 (file)
@@ -9,4 +9,6 @@
 ENTRY(lrintf)
        cvtss2si %xmm0, %rax
        ret
+END(lrintf)
 
+       .section .note.GNU-stack,"",%progbits
index c279782..1468921 100644 (file)
@@ -14,3 +14,6 @@ ENTRY(rint)
        frndint
        XMM_DOUBLE_EPILOGUE
        ret
+END(rint)
+
+       .section .note.GNU-stack,"",%progbits
index d702e5c..8060dd6 100644 (file)
@@ -14,3 +14,6 @@ ENTRY(rintf)
        frndint
        XMM_FLOAT_EPILOGUE
        ret
+END(rintf)
+
+       .section .note.GNU-stack,"",%progbits
index b5a92e2..4af99c6 100644 (file)
@@ -21,4 +21,6 @@ ENTRY(scalbnf)
        fstps   -8(%rsp)
        movss   -8(%rsp),%xmm0
        ret
+END(scalbnf)
 
+       .section .note.GNU-stack,"",%progbits
index 6128eed..d626b9c 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(significand)
        fstp    %st(1)
        XMM_DOUBLE_EPILOGUE
        ret
+END(significand)
+
+       .section .note.GNU-stack,"",%progbits
index 86c1ea0..84e7b98 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(significandf)
        fstp    %st(1)
        XMM_FLOAT_EPILOGUE
        ret
+END(significandf)
+
+       .section .note.GNU-stack,"",%progbits
index cccea47..214dd7d 100644 (file)
@@ -28,3 +28,6 @@ ENTRY(sin)
        fsin
        XMM_DOUBLE_EPILOGUE
        ret
+END(sin)
+
+       .section .note.GNU-stack,"",%progbits
index 4b707cc..85ddb6a 100644 (file)
@@ -15,3 +15,6 @@ ENTRY(sinf)
        fsin
        XMM_FLOAT_EPILOGUE
        ret
+END(sinf)
+
+       .section .note.GNU-stack,"",%progbits
index acbd10d..d732178 100644 (file)
@@ -30,3 +30,6 @@ ENTRY(tan)
        fstp    %st(0)
        XMM_DOUBLE_EPILOGUE
        ret
+END(tan)
+
+       .section .note.GNU-stack,"",%progbits
index e62e6d3..2684c17 100644 (file)
@@ -16,3 +16,6 @@ ENTRY(tanf)
        fstp    %st(0)
        XMM_FLOAT_EPILOGUE
        ret
+END(tanf)
+
+       .section .note.GNU-stack,"",%progbits