diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-07-22 03:36:42 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-07-22 03:38:00 -0700 |
commit | 5b2af7dd40a4f3b570aef71daf11b9dfce9a5d13 (patch) | |
tree | 25a322e842cdfc5f7d584f7cd57af5fa81d53204 /gold/testsuite/script_test_1b.cc | |
parent | cd78ea777c35c497fcc0f20d162789296dc0a44d (diff) | |
download | binutils-5b2af7dd40a4f3b570aef71daf11b9dfce9a5d13.zip binutils-5b2af7dd40a4f3b570aef71daf11b9dfce9a5d13.tar.gz binutils-5b2af7dd40a4f3b570aef71daf11b9dfce9a5d13.tar.bz2 |
Don't compare symbol addresses directly
GCC 5 will fold symbol address comparison, assuming each symbol has a
different address, which leads to abort. We should use separate
functions to compare symbol address.
PR gold/18663
* testsuite/Makefile.am (script_test_1_SOURCES): Set to
script_test_1a.cc script_test_1b.cc.
(script_test_11_r.o): Replace script_test_11.o with
script_test_11a.o script_test_11b.o.
(script_test_11.o): Removed.
(script_test_11a.o): New.
(script_test_11b.o): Likewise.
* testsuite/Makefile.in: Regenerated.
* testsuite/script_test_1.h: New file.
* testsuite/script_test_1b.cc: Likewise.
* testsuite/script_test_11.h: Likewise.
* testsuite/script_test_11b.c: Likewise.
* testsuite/script_test_1.cc: Renamed to ...
* testsuite/script_test_1a.cc: This.
Include "script_test_1.h".
(main): Call check_int and check_ptr.
* testsuite/script_test_11.c: Renamed to ...
* testsuite/script_test_11a.c: This.
Include "script_test_11.h".
(main): Call ptr_equal.
Diffstat (limited to 'gold/testsuite/script_test_1b.cc')
-rw-r--r-- | gold/testsuite/script_test_1b.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gold/testsuite/script_test_1b.cc b/gold/testsuite/script_test_1b.cc new file mode 100644 index 0000000..553ebca --- /dev/null +++ b/gold/testsuite/script_test_1b.cc @@ -0,0 +1,38 @@ +// script_test_1b.cc -- linker script test 1 for gold -*- C++ -*- + +// Copyright (C) 2015 Free Software Foundation, Inc. + +// This file is part of gold. + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +// MA 02110-1301, USA. + +// A test for a linker script which sets symbols to values. + +#include <cassert> + +#include "script_test_1.h" + +void +check_int(intptr_t i, intptr_t j) +{ + assert (i == j); +} + +void +check_ptr(int *i, int *j) +{ + assert (i == j); +} |