gdb 7.2 pie support

Gilles Espinasse g.esp at free.fr
Mon Jun 13 00:37:00 PDT 2011


----- Original Message ----- 
From: "Rogelio Serrano" <rogelio.serrano at gmail.com>
To: "Hardened LFS Development List" <hlfs-dev at linuxfromscratch.org>
Sent: Monday, June 13, 2011 8:35 AM
Subject: gdb 7.2 pie support


> gdb 7.2 is supposed to be able to handle pie. anybody has an idea how
> to make it work?
>
> -- 
> quarq consulting: agile, open source
> -- 

I am not sure to have tested gdb with pie binary. I have run the test suite.
I can give my receipt to compile gdb-7.2 and have a limited number of test
failures
Compiled with (this is extracted from a makefile, not a bash script)
# -g is needed by a few tests, particulary when gdb test gdb
# -U_FORTIFY_SOURCE is needed by some tests
CFLAGS    += -U_FORTIFY_SOURCE -g

./configure \
    --build=<my target> \
    --prefix=/usr \
    --disable-nls \
    --disable-install-libbfd \
    --disable-install-libiberty \
    --disable-libada \
    --disable-objc-gc \
    --disable-sim \
    --disable-tui \
    --with-system-readline \
    --with-python=no

To run the tests, I used a tweaked gcc specs file that does not harden by
default or some tests will fail. That file is from toolchain gcc pass2
adjusted to work on final stage with
sed -e 's@/$(TOOLS_DIR)$(LINKER)@$(LINKER)@g' \
  -e '/\*startfile_prefix_spec:/{n;s at .*@/usr/lib/ @}' \
  /$(TOOLS_DIR)/etc/gcc-unhardened.specs \
  > `dirname $$(gcc --print-libgcc-file-name)`/specs

I suppressed too some tests I don't care
sed -i -e 's/gdb\.ada //' -e 's/gdb\.fortran //' \
    -e 's/gdb\.java //' -e 's/gdb\.objc //' \
    -e 's/gdb\.pascal //' -e 's/gdb\.python //' \
    gdb/testsuite/Makefile

I run the tests with one tweak to pass base/auxv.exp test
# gdb.base/auxv.exp require -c unlimited
 -cd $(DIR_APP) && \
  bash -c 'ulimit -c unlimited; \
   make -j 1 -k check ' &> $(DIR_TEST)/$(THISAPP)-$(STAGE_ORDER).log
 # Should have less than 40 failures, philosopher error randomly vary (from
machine to machine?)

Then I remove unhardened specs file
 # restore gcc default hardened behavior
 rm `dirname $$(gcc --print-libgcc-file-name)`/specs

Gilles




More information about the hlfs-dev mailing list