[Rpm-maint] [rpm-software-management/rpm] configure.ac: correct stack protector check (#99)

jdknight-rockwellcollins notifications at github.com
Wed Nov 16 20:59:23 UTC 2016


If a used toolchain accepts the `-fstack-protector` option but does not
provide a stack smashing protector implementation (ex. libssp), linking
will fail:

 .libs/rpmio.o: In function `Fdescr':
 rpmio.c:(.text+0x672): undefined reference to `__stack_chk_fail_local'
 .libs/rpmio.o: In function `Fdopen':
 rpmio.c:(.text+0xce9): undefined reference to `__stack_chk_fail_local'
 .libs/rpmio.o: In function `ufdCopy':
 rpmio.c:(.text+0x10f7): undefined reference to `__stack_chk_fail_local'
 ...

This is a result of testing for `-fstack-protector` support using a main
that GCC does not inject guards. GCC's manual notes that stack protector
code is only added when "[functions] that call alloca, and functions
with buffers larger than 8 bytes" [1]. This commit adjusts the stack
protector check to allocate memory on the stack (via `alloca`).

[1]: https://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html

Signed-off-by: James Knight <james.knight at rockwellcollins.com>
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/99

-- Commit Summary --

  * configure.ac: correct stack protector check

-- File Changes --

    M configure.ac (2)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/99.patch
https://github.com/rpm-software-management/rpm/pull/99.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/99
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20161116/e770f248/attachment.html>


More information about the Rpm-maint mailing list