Commit 254b378a authored by Natanael Copa's avatar Natanael Copa

main/fortify-headers: use builtins when possible

This helps compiler to optimize away the function call when possible.
parent 228579f6
......@@ -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"
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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment