aboutsummaryrefslogtreecommitdiffstats
path: root/main/fortify-headers
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2019-02-25 13:29:39 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2019-02-25 13:29:39 +0000
commit254b378a1ac420913292e1acb172e7a299623aed (patch)
tree48801ddc4e58934268122986efa38fd08090d09a /main/fortify-headers
parent228579f6c7663dc4107b1b418367e968513277f9 (diff)
downloadaports-254b378a1ac420913292e1acb172e7a299623aed.tar.bz2
aports-254b378a1ac420913292e1acb172e7a299623aed.tar.xz
main/fortify-headers: use builtins when possible
This helps compiler to optimize away the function call when possible.
Diffstat (limited to 'main/fortify-headers')
-rw-r--r--main/fortify-headers/APKBUILD9
-rw-r--r--main/fortify-headers/use-builtins-when-possible.patch41
2 files changed, 47 insertions, 3 deletions
diff --git a/main/fortify-headers/APKBUILD b/main/fortify-headers/APKBUILD
index c8415affd9..e4b8b04d8a 100644
--- a/main/fortify-headers/APKBUILD
+++ b/main/fortify-headers/APKBUILD
@@ -2,13 +2,15 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=fortify-headers
pkgver=1.0
-pkgrel=0
+pkgrel=1
pkgdesc="standalone fortify source implementation"
url="http://git.2f30.org/fortify-headers/"
arch="noarch"
options="!check" # No test suite.
license="BSD-0"
-source="http://dl.2f30.org/releases/$pkgname-$pkgver.tar.gz"
+source="http://dl.2f30.org/releases/$pkgname-$pkgver.tar.gz
+ use-builtins-when-possible.patch
+ "
builddir="$srcdir"/$pkgname-$pkgver
@@ -21,4 +23,5 @@ package() {
make DESTDIR="$pkgdir" PREFIX=/usr install
}
-sha512sums="085a725da9a6da0eea732ee77e3a3dc7d3c96bc3344172523db5f1e35391492910a050c15c560912115b2db916c2d6fa37e409e997c53399ee4fee912c5513e8 fortify-headers-1.0.tar.gz"
+sha512sums="085a725da9a6da0eea732ee77e3a3dc7d3c96bc3344172523db5f1e35391492910a050c15c560912115b2db916c2d6fa37e409e997c53399ee4fee912c5513e8 fortify-headers-1.0.tar.gz
+b4c6f6b89745ef21c5e0ffbef99b95872ae46f700ce0c42617dcc39bfa52526f54e36794ad682f4a4fe54fa7c348bfc46f3367c20e3629dbd88869a48f45209e use-builtins-when-possible.patch"
diff --git a/main/fortify-headers/use-builtins-when-possible.patch b/main/fortify-headers/use-builtins-when-possible.patch
new file mode 100644
index 0000000000..a2cc96e0e8
--- /dev/null
+++ b/main/fortify-headers/use-builtins-when-possible.patch
@@ -0,0 +1,41 @@
+commit 5aabc7e6aad28327d75671e52c50060e4543112c
+Author: sin <sin@2f30.org>
+Date: Mon Feb 25 13:01:12 2019 +0000
+
+ Make use of builtins whenever possible
+
+diff --git a/include/string.h b/include/string.h
+index 43c7485..66c23e1 100644
+--- a/include/string.h
++++ b/include/string.h
+@@ -50,7 +50,7 @@ _FORTIFY_FN(memcpy) void *memcpy(void *__od, const void *__os, size_t __n)
+ __builtin_trap();
+ if (__n > __bd || __n > __bs)
+ __builtin_trap();
+- return __orig_memcpy(__od, __os, __n);
++ return __builtin_memcpy(__od, __os, __n);
+ }
+
+ _FORTIFY_FN(memmove) void *memmove(void *__d, const void *__s, size_t __n)
+@@ -69,7 +69,7 @@ _FORTIFY_FN(memset) void *memset(void *__d, int __c, size_t __n)
+
+ if (__n > __b)
+ __builtin_trap();
+- return __orig_memset(__d, __c, __n);
++ return __builtin_memset(__d, __c, __n);
+ }
+
+ #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
+diff --git a/include/wchar.h b/include/wchar.h
+index 3cb6f92..09ffa97 100644
+--- a/include/wchar.h
++++ b/include/wchar.h
+@@ -121,7 +121,7 @@ _FORTIFY_FN(wcrtomb) size_t wcrtomb(char *__s, wchar_t __w, mbstate_t *__st)
+ return __r;
+ if (__r > __b)
+ __builtin_trap();
+- memcpy(__s, __buf, __r);
++ __builtin_memcpy(__s, __buf, __r);
+ return __r;
+ }
+ return __orig_wcrtomb(__s, __w, __st);