gold/
* testsuite/Makefile.am (TEST_OBJCOPY): New macro. * testsuite/Makefile.in: Regenerate. * testsuite/dwp_test.h: New source file. * testsuite/dwp_test_1.cc: New source file. * testsuite/dwp_test_1.s: New source file. * testsuite/dwp_test_1.sh: New source file. * testsuite/dwp_test_1b.cc: New source file. * testsuite/dwp_test_1b.s: New source file. * testsuite/dwp_test_2.cc: New source file. * testsuite/dwp_test_2.s: New source file. * testsuite/dwp_test_2.sh: New source file. * testsuite/dwp_test_main.cc: New source file. * testsuite/dwp_test_main.s: New source file.
This commit is contained in:
parent
774299092d
commit
35c813e224
@ -1,3 +1,19 @@
|
||||
2012-10-23 Cary Coutant <ccoutant@google.com>
|
||||
|
||||
* testsuite/Makefile.am (TEST_OBJCOPY): New macro.
|
||||
* testsuite/Makefile.in: Regenerate.
|
||||
* testsuite/dwp_test.h: New source file.
|
||||
* testsuite/dwp_test_1.cc: New source file.
|
||||
* testsuite/dwp_test_1.s: New source file.
|
||||
* testsuite/dwp_test_1.sh: New source file.
|
||||
* testsuite/dwp_test_1b.cc: New source file.
|
||||
* testsuite/dwp_test_1b.s: New source file.
|
||||
* testsuite/dwp_test_2.cc: New source file.
|
||||
* testsuite/dwp_test_2.s: New source file.
|
||||
* testsuite/dwp_test_2.sh: New source file.
|
||||
* testsuite/dwp_test_main.cc: New source file.
|
||||
* testsuite/dwp_test_main.s: New source file.
|
||||
|
||||
2012-10-23 Cary Coutant <ccoutant@google.com>
|
||||
|
||||
* dwp.h: New header file.
|
||||
|
@ -21,6 +21,7 @@ AM_CPPFLAGS = \
|
||||
|
||||
TEST_READELF = $(top_builddir)/../binutils/readelf
|
||||
TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
|
||||
TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
|
||||
TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
|
||||
TEST_STRIP = $(top_builddir)/../binutils/strip-new
|
||||
TEST_AR = $(top_builddir)/../binutils/ar
|
||||
@ -2730,3 +2731,47 @@ endif DEFAULT_TARGET_ARM
|
||||
|
||||
endif NATIVE_OR_CROSS_LINKER
|
||||
|
||||
# Tests for the dwp tool.
|
||||
# We don't want to rely yet on GCC support for -gsplit-dwarf,
|
||||
# so we use (for now) test cases in x86 assembly language,
|
||||
# compiled from the dwp_test_*.cc sources.
|
||||
|
||||
if DEFAULT_TARGET_X86_64
|
||||
|
||||
dwp_test_main.o: dwp_test_main.s
|
||||
$(TEST_AS) -o $@ $<
|
||||
dwp_test_1.o: dwp_test_1.s
|
||||
$(TEST_AS) -o $@ $<
|
||||
dwp_test_1b.o: dwp_test_1b.s
|
||||
$(TEST_AS) -o $@ $<
|
||||
dwp_test_2.o: dwp_test_2.s
|
||||
$(TEST_AS) -o $@ $<
|
||||
|
||||
dwp_test_main.dwo: dwp_test_main.o
|
||||
$(TEST_OBJCOPY) --extract-dwo $< $@
|
||||
dwp_test_1.dwo: dwp_test_1.o
|
||||
$(TEST_OBJCOPY) --extract-dwo $< $@
|
||||
dwp_test_1b.dwo: dwp_test_1b.o
|
||||
$(TEST_OBJCOPY) --extract-dwo $< $@
|
||||
dwp_test_2.dwo: dwp_test_2.o
|
||||
$(TEST_OBJCOPY) --extract-dwo $< $@
|
||||
|
||||
check_SCRIPTS += dwp_test_1.sh
|
||||
check_DATA += dwp_test_1.stdout
|
||||
dwp_test_1.stdout: dwp_test_1.dwp
|
||||
$(TEST_READELF) -wi $< > $@
|
||||
dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
|
||||
../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
|
||||
|
||||
check_SCRIPTS += dwp_test_2.sh
|
||||
check_DATA += dwp_test_2.stdout
|
||||
dwp_test_2.stdout: dwp_test_2.dwp
|
||||
$(TEST_READELF) -wi $< > $@
|
||||
dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
|
||||
../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
|
||||
dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
|
||||
../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
|
||||
dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
|
||||
../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
|
||||
|
||||
endif DEFAULT_TARGET_X86_64
|
||||
|
@ -653,6 +653,10 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
|
||||
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_thumb_6m \
|
||||
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm \
|
||||
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ arm_farcall_thumb_arm_5t
|
||||
@DEFAULT_TARGET_X86_64_TRUE@am__append_76 = dwp_test_1.sh \
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.sh
|
||||
@DEFAULT_TARGET_X86_64_TRUE@am__append_77 = dwp_test_1.stdout \
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ dwp_test_2.stdout
|
||||
subdir = testsuite
|
||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
@ -2005,6 +2009,7 @@ AM_CPPFLAGS = \
|
||||
|
||||
TEST_READELF = $(top_builddir)/../binutils/readelf
|
||||
TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
|
||||
TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
|
||||
TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
|
||||
TEST_STRIP = $(top_builddir)/../binutils/strip-new
|
||||
TEST_AR = $(top_builddir)/../binutils/ar
|
||||
@ -2031,11 +2036,12 @@ MOSTLYCLEANFILES = *.so *.syms *.stdout $(am__append_4) \
|
||||
check_SCRIPTS = $(am__append_2) $(am__append_34) $(am__append_38) \
|
||||
$(am__append_54) $(am__append_57) $(am__append_60) \
|
||||
$(am__append_65) $(am__append_67) $(am__append_70) \
|
||||
$(am__append_73)
|
||||
$(am__append_73) $(am__append_76)
|
||||
check_DATA = $(am__append_3) $(am__append_27) $(am__append_29) \
|
||||
$(am__append_35) $(am__append_39) $(am__append_55) \
|
||||
$(am__append_58) $(am__append_61) $(am__append_66) \
|
||||
$(am__append_68) $(am__append_71) $(am__append_74)
|
||||
$(am__append_68) $(am__append_71) $(am__append_74) \
|
||||
$(am__append_77)
|
||||
BUILT_SOURCES = $(am__append_25)
|
||||
TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
|
||||
|
||||
@ -3792,6 +3798,10 @@ arm_farcall_thumb_thumb.sh.log: arm_farcall_thumb_thumb.sh
|
||||
@p='arm_farcall_thumb_thumb.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
arm_farcall_thumb_arm.sh.log: arm_farcall_thumb_arm.sh
|
||||
@p='arm_farcall_thumb_arm.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
dwp_test_1.sh.log: dwp_test_1.sh
|
||||
@p='dwp_test_1.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
dwp_test_2.sh.log: dwp_test_2.sh
|
||||
@p='dwp_test_2.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
object_unittest.log: object_unittest$(EXEEXT)
|
||||
@p='object_unittest$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
|
||||
binary_unittest.log: binary_unittest$(EXEEXT)
|
||||
@ -5648,6 +5658,41 @@ uninstall-am:
|
||||
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
|
||||
@DEFAULT_TARGET_ARM_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ $(TEST_AS) -march=armv5t -o $@ $<
|
||||
|
||||
# Tests for the dwp tool.
|
||||
# We don't want to rely yet on GCC support for -gsplit-dwarf,
|
||||
# so we use (for now) test cases in x86 assembly language,
|
||||
# compiled from the dwp_test_*.cc sources.
|
||||
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_main.o: dwp_test_main.s
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $<
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_1.o: dwp_test_1.s
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $<
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_1b.o: dwp_test_1b.s
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $<
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_2.o: dwp_test_2.s
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_AS) -o $@ $<
|
||||
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_main.dwo: dwp_test_main.o
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_OBJCOPY) --extract-dwo $< $@
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_1.dwo: dwp_test_1.o
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_OBJCOPY) --extract-dwo $< $@
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_1b.dwo: dwp_test_1b.o
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_OBJCOPY) --extract-dwo $< $@
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_2.dwo: dwp_test_2.o
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_OBJCOPY) --extract-dwo $< $@
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_1.stdout: dwp_test_1.dwp
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_READELF) -wi $< > $@
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_2.stdout: dwp_test_2.dwp
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ $(TEST_READELF) -wi $< > $@
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
|
||||
@DEFAULT_TARGET_X86_64_TRUE@dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
|
||||
@DEFAULT_TARGET_X86_64_TRUE@ ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
|
87
gold/testsuite/dwp_test.h
Normal file
87
gold/testsuite/dwp_test.h
Normal file
@ -0,0 +1,87 @@
|
||||
// dwp_test.h -- a test case for dwp, header file -*- C++ -*-
|
||||
|
||||
// Copyright 2012 Free Software Foundation, Inc.
|
||||
// Written by Cary Coutant <ccoutant@google.com>.
|
||||
|
||||
// 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.
|
||||
|
||||
// Adapted from two_file_test.h.
|
||||
|
||||
class C1
|
||||
{
|
||||
public:
|
||||
bool testcase1();
|
||||
bool t1a();
|
||||
int t1_2();
|
||||
bool testcase2();
|
||||
bool testcase3();
|
||||
bool testcase4();
|
||||
int member1;
|
||||
};
|
||||
|
||||
class C2
|
||||
{
|
||||
public:
|
||||
bool testcase1();
|
||||
bool testcase2();
|
||||
bool testcase3();
|
||||
bool testcase4();
|
||||
int member1;
|
||||
};
|
||||
|
||||
class C3
|
||||
{
|
||||
public:
|
||||
bool testcase1();
|
||||
bool testcase2();
|
||||
bool testcase3();
|
||||
bool (*f4())();
|
||||
int member1;
|
||||
};
|
||||
|
||||
extern C3 c3;
|
||||
|
||||
extern int v2;
|
||||
extern int v3;
|
||||
extern char v4[];
|
||||
extern char v5[];
|
||||
|
||||
extern int f10();
|
||||
extern int f11a();
|
||||
extern int f11b(int (*)());
|
||||
extern bool t12();
|
||||
|
||||
extern bool t13();
|
||||
inline void f13i() { }
|
||||
extern void (*f13())();
|
||||
|
||||
#define TEST_STRING_CONSTANT "test string constant"
|
||||
extern const char* f14();
|
||||
|
||||
#define TEST_WIDE_STRING_CONSTANT L"test wide string constant"
|
||||
extern const wchar_t* f15();
|
||||
|
||||
extern bool t16();
|
||||
extern bool t16a();
|
||||
|
||||
extern bool t17();
|
||||
extern const char* t17data[];
|
||||
#define T17_COUNT 5
|
||||
|
||||
extern bool t18();
|
||||
extern const char* f18(int);
|
210
gold/testsuite/dwp_test_1.cc
Normal file
210
gold/testsuite/dwp_test_1.cc
Normal file
@ -0,0 +1,210 @@
|
||||
// dwp_test_1.cc -- a test case for dwp
|
||||
|
||||
// Copyright 2012 Free Software Foundation, Inc.
|
||||
// Written by Cary Coutant <ccoutant@google.com>.
|
||||
|
||||
// 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.
|
||||
|
||||
// Adapted from two_file_test_1.cc.
|
||||
|
||||
#include "dwp_test.h"
|
||||
|
||||
// 1 Code in file 1 calls code in file 2.
|
||||
|
||||
bool
|
||||
C1::testcase1()
|
||||
{
|
||||
return t1_2() == 123;
|
||||
}
|
||||
|
||||
// 2 Code in file 1 refers to global data in file 2.
|
||||
|
||||
bool
|
||||
C1::testcase2()
|
||||
{
|
||||
return v2 == 456;
|
||||
}
|
||||
|
||||
// 3 Code in file 1 referes to common symbol in file 2.
|
||||
|
||||
bool
|
||||
C1::testcase3()
|
||||
{
|
||||
return v3 == 789;
|
||||
}
|
||||
|
||||
// 4 Code in file 1 refers to offset within global data in file 2.
|
||||
|
||||
bool
|
||||
C1::testcase4()
|
||||
{
|
||||
return v4[5] == ',';
|
||||
}
|
||||
|
||||
// 5 Code in file 1 refers to offset within common symbol in file 2.
|
||||
|
||||
bool
|
||||
C2::testcase1()
|
||||
{
|
||||
return v5[7] == 'w';
|
||||
}
|
||||
|
||||
// 6 Data in file 1 refers to global data in file 2.
|
||||
|
||||
int* p6 = &v2;
|
||||
|
||||
bool
|
||||
C2::testcase2()
|
||||
{
|
||||
return *p6 == 456;
|
||||
}
|
||||
|
||||
// 7 Data in file 1 refers to common symbol in file 2.
|
||||
|
||||
int* p7 = &v3;
|
||||
|
||||
bool
|
||||
C2::testcase3()
|
||||
{
|
||||
return *p7 == 789;
|
||||
}
|
||||
|
||||
// 8 Data in file 1 refers to offset within global data in file 2.
|
||||
|
||||
char* p8 = &v4[6];
|
||||
|
||||
bool
|
||||
C2::testcase4()
|
||||
{
|
||||
return *p8 == ' ';
|
||||
}
|
||||
|
||||
// 9 Data in file 1 refers to offset within common symbol in file 2.
|
||||
|
||||
char* p9 = &v5[8];
|
||||
|
||||
bool
|
||||
C3::testcase1()
|
||||
{
|
||||
return *p9 == 'o';
|
||||
}
|
||||
|
||||
// 10 Data in file 1 refers to function in file 2.
|
||||
|
||||
int (*pfn)() = &f10;
|
||||
|
||||
bool
|
||||
C3::testcase2()
|
||||
{
|
||||
return (*pfn)() == 135;
|
||||
}
|
||||
|
||||
// 11 Pass function pointer from file 1 to file 2.
|
||||
|
||||
int
|
||||
f11a()
|
||||
{
|
||||
return 246;
|
||||
}
|
||||
|
||||
bool
|
||||
C3::testcase3()
|
||||
{
|
||||
return f11b(&f11a) == 246;
|
||||
}
|
||||
|
||||
// 12 Compare address of function for equality in both files.
|
||||
|
||||
bool
|
||||
t12()
|
||||
{
|
||||
return &t12 == c3.f4();
|
||||
}
|
||||
|
||||
// 13 Compare address of inline function for equality in both files.
|
||||
|
||||
bool
|
||||
t13()
|
||||
{
|
||||
return &f13i == f13();
|
||||
}
|
||||
|
||||
// 14 Compare string constants in file 1 and file 2.
|
||||
|
||||
bool
|
||||
t14()
|
||||
{
|
||||
const char* s1 = TEST_STRING_CONSTANT;
|
||||
const char* s2 = f14();
|
||||
while (*s1 != '\0')
|
||||
if (*s1++ != *s2++)
|
||||
return false;
|
||||
return *s2 == '\0';
|
||||
}
|
||||
|
||||
// 15 Compare wide string constants in file 1 and file 2.
|
||||
|
||||
bool
|
||||
t15()
|
||||
{
|
||||
const wchar_t* s1 = TEST_WIDE_STRING_CONSTANT;
|
||||
const wchar_t* s2 = f15();
|
||||
while (*s1 != '\0')
|
||||
if (*s1++ != *s2++)
|
||||
return false;
|
||||
return *s2 == '\0';
|
||||
}
|
||||
|
||||
// 16 Call a function directly after its address has been taken.
|
||||
|
||||
bool
|
||||
t16()
|
||||
{
|
||||
return f10() == 135;
|
||||
}
|
||||
|
||||
// 17 File 1 checks array of string constants defined in file 2.
|
||||
|
||||
bool
|
||||
t17()
|
||||
{
|
||||
char c = 'a';
|
||||
for (int i = 0; i < T17_COUNT; ++i)
|
||||
{
|
||||
if (t17data[i][0] != c || t17data[i][1] != '\0')
|
||||
return false;
|
||||
++c;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 18 File 1 checks string constants referenced in code in file 2.
|
||||
|
||||
bool
|
||||
t18()
|
||||
{
|
||||
char c = 'a';
|
||||
for (int i = 0; i < T17_COUNT; ++i)
|
||||
{
|
||||
const char* s = f18(i);
|
||||
if (s[0] != c || s[1] != '\0')
|
||||
return false;
|
||||
++c;
|
||||
}
|
||||
return true;
|
||||
}
|
2660
gold/testsuite/dwp_test_1.s
Normal file
2660
gold/testsuite/dwp_test_1.s
Normal file
File diff suppressed because it is too large
Load Diff
63
gold/testsuite/dwp_test_1.sh
Executable file
63
gold/testsuite/dwp_test_1.sh
Executable file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
|
||||
# dwp_test_1.sh -- Test the dwp tool.
|
||||
|
||||
# Copyright 2012 Free Software Foundation, Inc.
|
||||
# Written by Cary Coutant <ccoutant@google.com>.
|
||||
|
||||
# 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.
|
||||
|
||||
check()
|
||||
{
|
||||
if ! grep -q "$2" "$1"
|
||||
then
|
||||
echo "Did not find expected output:"
|
||||
echo " $2"
|
||||
echo ""
|
||||
echo "Actual error output below:"
|
||||
cat "$1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_num()
|
||||
{
|
||||
n=$(grep -c "$2" "$1")
|
||||
if test "$n" -ne "$3"
|
||||
then
|
||||
echo "Found $n occurrences (should find $3):"
|
||||
echo " $2"
|
||||
echo ""
|
||||
echo "Actual error output below:"
|
||||
cat "$1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
STDOUT="dwp_test_1.stdout"
|
||||
|
||||
check $STDOUT "^Contents of the .debug_info.dwo section"
|
||||
check_num $STDOUT "DW_TAG_compile_unit" 4
|
||||
check_num $STDOUT "DW_TAG_type_unit" 3
|
||||
check_num $STDOUT "DW_AT_name.*: C1" 3
|
||||
check_num $STDOUT "DW_AT_name.*: C2" 2
|
||||
check_num $STDOUT "DW_AT_name.*: C3" 3
|
||||
check_num $STDOUT "DW_AT_name.*: testcase1" 6
|
||||
check_num $STDOUT "DW_AT_name.*: testcase2" 6
|
||||
check_num $STDOUT "DW_AT_name.*: testcase3" 6
|
||||
check_num $STDOUT "DW_AT_name.*: testcase4" 4
|
35
gold/testsuite/dwp_test_1b.cc
Normal file
35
gold/testsuite/dwp_test_1b.cc
Normal file
@ -0,0 +1,35 @@
|
||||
// dwp_test_1b.cc -- a test case for dwp
|
||||
|
||||
// Copyright 2012 Free Software Foundation, Inc.
|
||||
// Written by Cary Coutant <ccoutant@google.com>.
|
||||
|
||||
// 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.
|
||||
|
||||
// Adapted from two_file_test_1b.cc.
|
||||
|
||||
#include "dwp_test.h"
|
||||
|
||||
// 16 Call a function directly after its address has been taken.
|
||||
|
||||
C3 c3;
|
||||
|
||||
bool
|
||||
t16a()
|
||||
{
|
||||
return f10() == 135;
|
||||
}
|
549
gold/testsuite/dwp_test_1b.s
Normal file
549
gold/testsuite/dwp_test_1b.s
Normal file
@ -0,0 +1,549 @@
|
||||
.file "dwp_test_1b.cc"
|
||||
.text
|
||||
.Ltext0:
|
||||
.globl c3
|
||||
.bss
|
||||
.align 4
|
||||
.type c3, @object
|
||||
.size c3, 4
|
||||
c3:
|
||||
.zero 4
|
||||
.text
|
||||
.globl _Z4t16av
|
||||
.type _Z4t16av, @function
|
||||
_Z4t16av:
|
||||
.LFB1:
|
||||
.file 1 "dwp_test_1b.cc"
|
||||
.loc 1 33 0
|
||||
.cfi_startproc
|
||||
pushq %rbp
|
||||
.cfi_def_cfa_offset 16
|
||||
.cfi_offset 6, -16
|
||||
movq %rsp, %rbp
|
||||
.cfi_def_cfa_register 6
|
||||
.loc 1 34 0
|
||||
call _Z3f10v
|
||||
cmpl $135, %eax
|
||||
sete %al
|
||||
.loc 1 35 0
|
||||
popq %rbp
|
||||
.cfi_def_cfa 7, 8
|
||||
ret
|
||||
.cfi_endproc
|
||||
.LFE1:
|
||||
.size _Z4t16av, .-_Z4t16av
|
||||
.Letext0:
|
||||
.file 2 "dwp_test.h"
|
||||
.section .debug_types.dwo,"G",@progbits,wt.bb2916f0c1bd34b5,comdat
|
||||
.long 0x119
|
||||
.value 0x4
|
||||
.long .Ldebug_abbrev0
|
||||
.byte 0x8
|
||||
.byte 0xbb
|
||||
.byte 0x29
|
||||
.byte 0x16
|
||||
.byte 0xf0
|
||||
.byte 0xc1
|
||||
.byte 0xbd
|
||||
.byte 0x34
|
||||
.byte 0xb5
|
||||
.long 0x25
|
||||
.uleb128 0x1
|
||||
.byte 0x4
|
||||
.byte 0x8a
|
||||
.byte 0xda
|
||||
.byte 0x59
|
||||
.byte 0x6e
|
||||
.byte 0x4d
|
||||
.byte 0x5c
|
||||
.byte 0xa
|
||||
.byte 0x88
|
||||
.long .Lskeleton_debug_line0
|
||||
.uleb128 0x2
|
||||
.string "C3"
|
||||
.byte 0x4
|
||||
.byte 0x2
|
||||
.byte 0x2f
|
||||
.long 0xfc
|
||||
.uleb128 0x3
|
||||
.string "member1"
|
||||
.byte 0x2
|
||||
.byte 0x36
|
||||
.long 0xfc
|
||||
.byte 0
|
||||
.byte 0x1
|
||||
.uleb128 0x4
|
||||
.string "testcase1"
|
||||
.byte 0x2
|
||||
.byte 0x32
|
||||
.string "_ZN2C39testcase1Ev"
|
||||
.long 0x103
|
||||
.byte 0x1
|
||||
.long 0x6e
|
||||
.long 0x74
|
||||
.uleb128 0x5
|
||||
.long 0x10b
|
||||
.byte 0
|
||||
.uleb128 0x4
|
||||
.string "testcase2"
|
||||
.byte 0x2
|
||||
.byte 0x33
|
||||
.string "_ZN2C39testcase2Ev"
|
||||
.long 0x103
|
||||
.byte 0x1
|
||||
.long 0xa1
|
||||
.long 0xa7
|
||||
.uleb128 0x5
|
||||
.long 0x10b
|
||||
.byte 0
|
||||
.uleb128 0x4
|
||||
.string "testcase3"
|
||||
.byte 0x2
|
||||
.byte 0x34
|
||||
.string "_ZN2C39testcase3Ev"
|
||||
.long 0x103
|
||||
.byte 0x1
|
||||
.long 0xd4
|
||||
.long 0xda
|
||||
.uleb128 0x5
|
||||
.long 0x10b
|
||||
.byte 0
|
||||
.uleb128 0x6
|
||||
.string "f4"
|
||||
.byte 0x2
|
||||
.byte 0x35
|
||||
.string "_ZN2C32f4Ev"
|
||||
.long 0x111
|
||||
.byte 0x1
|
||||
.long 0xf5
|
||||
.uleb128 0x5
|
||||
.long 0x10b
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x7
|
||||
.byte 0x4
|
||||
.byte 0x5
|
||||
.string "int"
|
||||
.uleb128 0x7
|
||||
.byte 0x1
|
||||
.byte 0x2
|
||||
.string "bool"
|
||||
.uleb128 0x8
|
||||
.byte 0x8
|
||||
.long 0x25
|
||||
.uleb128 0x8
|
||||
.byte 0x8
|
||||
.long 0x117
|
||||
.uleb128 0x9
|
||||
.long 0x103
|
||||
.byte 0
|
||||
.section .debug_types,"G",@progbits,wt.bb2916f0c1bd34b5,comdat
|
||||
.long 0x6f
|
||||
.value 0x4
|
||||
.long .Lskeleton_debug_abbrev0
|
||||
.byte 0x8
|
||||
.byte 0xbb
|
||||
.byte 0x29
|
||||
.byte 0x16
|
||||
.byte 0xf0
|
||||
.byte 0xc1
|
||||
.byte 0xbd
|
||||
.byte 0x34
|
||||
.byte 0xb5
|
||||
.long 0
|
||||
.uleb128 0x2
|
||||
.string "/home/ccoutant/opensource/binutils-git/binutils/gold/testsuite"
|
||||
.string "dwp_test_1b.dwo"
|
||||
.long .Ldebug_pubnames0
|
||||
.long .Ldebug_pubtypes0
|
||||
.long .Ldebug_addr0
|
||||
.section .debug_info.dwo,"e",@progbits
|
||||
.Ldebug_info0:
|
||||
.long 0xcb
|
||||
.value 0x4
|
||||
.long .Ldebug_abbrev0
|
||||
.byte 0x8
|
||||
.uleb128 0xa
|
||||
.string "GNU C++ 4.7.x-google 20120720 (prerelease)"
|
||||
.byte 0x4
|
||||
.string "dwp_test_1b.cc"
|
||||
.string "/home/ccoutant/opensource/binutils-git/binutils/gold/testsuite"
|
||||
.byte 0xf6
|
||||
.byte 0xef
|
||||
.byte 0x47
|
||||
.byte 0xa2
|
||||
.byte 0x3e
|
||||
.byte 0xc1
|
||||
.byte 0x6e
|
||||
.byte 0xbd
|
||||
.uleb128 0x7
|
||||
.byte 0x4
|
||||
.byte 0x5
|
||||
.string "int"
|
||||
.uleb128 0x7
|
||||
.byte 0x1
|
||||
.byte 0x2
|
||||
.string "bool"
|
||||
.uleb128 0xb
|
||||
.string "t16a"
|
||||
.byte 0x1
|
||||
.byte 0x20
|
||||
.string "_Z4t16av"
|
||||
.long 0x95
|
||||
.uleb128 0
|
||||
.quad .LFE1-.LFB1
|
||||
.uleb128 0x1
|
||||
.byte 0x9c
|
||||
.uleb128 0xc
|
||||
.string "c3"
|
||||
.byte 0x1
|
||||
.byte 0x1d
|
||||
.byte 0xbb
|
||||
.byte 0x29
|
||||
.byte 0x16
|
||||
.byte 0xf0
|
||||
.byte 0xc1
|
||||
.byte 0xbd
|
||||
.byte 0x34
|
||||
.byte 0xb5
|
||||
.uleb128 0x2
|
||||
.byte 0xfb
|
||||
.uleb128 0x1
|
||||
.byte 0
|
||||
.section .debug_info,"",@progbits
|
||||
.Lskeleton_debug_info0:
|
||||
.long 0x7f
|
||||
.value 0x4
|
||||
.long .Lskeleton_debug_abbrev0
|
||||
.byte 0x8
|
||||
.uleb128 0x1
|
||||
.quad .Ltext0
|
||||
.quad .Letext0-.Ltext0
|
||||
.long .Ldebug_line0
|
||||
.byte 0xf6
|
||||
.byte 0xef
|
||||
.byte 0x47
|
||||
.byte 0xa2
|
||||
.byte 0x3e
|
||||
.byte 0xc1
|
||||
.byte 0x6e
|
||||
.byte 0xbd
|
||||
.string "/home/ccoutant/opensource/binutils-git/binutils/gold/testsuite"
|
||||
.string "dwp_test_1b.dwo"
|
||||
.long .Ldebug_pubnames0
|
||||
.long .Ldebug_pubtypes0
|
||||
.long .Ldebug_addr0
|
||||
.section .debug_abbrev,"",@progbits
|
||||
.Lskeleton_debug_abbrev0:
|
||||
.uleb128 0x1
|
||||
.uleb128 0x11
|
||||
.byte 0
|
||||
.uleb128 0x11
|
||||
.uleb128 0x1
|
||||
.uleb128 0x12
|
||||
.uleb128 0x7
|
||||
.uleb128 0x10
|
||||
.uleb128 0x17
|
||||
.uleb128 0x2131
|
||||
.uleb128 0x7
|
||||
.uleb128 0x1b
|
||||
.uleb128 0x8
|
||||
.uleb128 0x2130
|
||||
.uleb128 0x8
|
||||
.uleb128 0x2134
|
||||
.uleb128 0x17
|
||||
.uleb128 0x2135
|
||||
.uleb128 0x17
|
||||
.uleb128 0x2133
|
||||
.uleb128 0x17
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x2
|
||||
.uleb128 0x41
|
||||
.byte 0
|
||||
.uleb128 0x1b
|
||||
.uleb128 0x8
|
||||
.uleb128 0x2130
|
||||
.uleb128 0x8
|
||||
.uleb128 0x2134
|
||||
.uleb128 0x17
|
||||
.uleb128 0x2135
|
||||
.uleb128 0x17
|
||||
.uleb128 0x2133
|
||||
.uleb128 0x17
|
||||
.byte 0
|
||||
.byte 0
|
||||
.byte 0
|
||||
.section .debug_abbrev.dwo,"e",@progbits
|
||||
.Ldebug_abbrev0:
|
||||
.uleb128 0x1
|
||||
.uleb128 0x41
|
||||
.byte 0x1
|
||||
.uleb128 0x13
|
||||
.uleb128 0xb
|
||||
.uleb128 0x210f
|
||||
.uleb128 0x7
|
||||
.uleb128 0x10
|
||||
.uleb128 0x17
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x2
|
||||
.uleb128 0x2
|
||||
.byte 0x1
|
||||
.uleb128 0x3
|
||||
.uleb128 0x8
|
||||
.uleb128 0xb
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3a
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3b
|
||||
.uleb128 0xb
|
||||
.uleb128 0x1
|
||||
.uleb128 0x13
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x3
|
||||
.uleb128 0xd
|
||||
.byte 0
|
||||
.uleb128 0x3
|
||||
.uleb128 0x8
|
||||
.uleb128 0x3a
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3b
|
||||
.uleb128 0xb
|
||||
.uleb128 0x49
|
||||
.uleb128 0x13
|
||||
.uleb128 0x38
|
||||
.uleb128 0xb
|
||||
.uleb128 0x32
|
||||
.uleb128 0xb
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x4
|
||||
.uleb128 0x2e
|
||||
.byte 0x1
|
||||
.uleb128 0x3f
|
||||
.uleb128 0x19
|
||||
.uleb128 0x3
|
||||
.uleb128 0x8
|
||||
.uleb128 0x3a
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3b
|
||||
.uleb128 0xb
|
||||
.uleb128 0x6e
|
||||
.uleb128 0x8
|
||||
.uleb128 0x49
|
||||
.uleb128 0x13
|
||||
.uleb128 0x32
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3c
|
||||
.uleb128 0x19
|
||||
.uleb128 0x64
|
||||
.uleb128 0x13
|
||||
.uleb128 0x1
|
||||
.uleb128 0x13
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x5
|
||||
.uleb128 0x5
|
||||
.byte 0
|
||||
.uleb128 0x49
|
||||
.uleb128 0x13
|
||||
.uleb128 0x34
|
||||
.uleb128 0x19
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x6
|
||||
.uleb128 0x2e
|
||||
.byte 0x1
|
||||
.uleb128 0x3f
|
||||
.uleb128 0x19
|
||||
.uleb128 0x3
|
||||
.uleb128 0x8
|
||||
.uleb128 0x3a
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3b
|
||||
.uleb128 0xb
|
||||
.uleb128 0x6e
|
||||
.uleb128 0x8
|
||||
.uleb128 0x49
|
||||
.uleb128 0x13
|
||||
.uleb128 0x32
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3c
|
||||
.uleb128 0x19
|
||||
.uleb128 0x64
|
||||
.uleb128 0x13
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x7
|
||||
.uleb128 0x24
|
||||
.byte 0
|
||||
.uleb128 0xb
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3e
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3
|
||||
.uleb128 0x8
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x8
|
||||
.uleb128 0xf
|
||||
.byte 0
|
||||
.uleb128 0xb
|
||||
.uleb128 0xb
|
||||
.uleb128 0x49
|
||||
.uleb128 0x13
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0x9
|
||||
.uleb128 0x15
|
||||
.byte 0
|
||||
.uleb128 0x49
|
||||
.uleb128 0x13
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0xa
|
||||
.uleb128 0x11
|
||||
.byte 0x1
|
||||
.uleb128 0x25
|
||||
.uleb128 0x8
|
||||
.uleb128 0x13
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3
|
||||
.uleb128 0x8
|
||||
.uleb128 0x1b
|
||||
.uleb128 0x8
|
||||
.uleb128 0x2131
|
||||
.uleb128 0x7
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0xb
|
||||
.uleb128 0x2e
|
||||
.byte 0
|
||||
.uleb128 0x3f
|
||||
.uleb128 0x19
|
||||
.uleb128 0x3
|
||||
.uleb128 0x8
|
||||
.uleb128 0x3a
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3b
|
||||
.uleb128 0xb
|
||||
.uleb128 0x6e
|
||||
.uleb128 0x8
|
||||
.uleb128 0x49
|
||||
.uleb128 0x13
|
||||
.uleb128 0x11
|
||||
.uleb128 0x1f01
|
||||
.uleb128 0x12
|
||||
.uleb128 0x7
|
||||
.uleb128 0x40
|
||||
.uleb128 0x18
|
||||
.uleb128 0x2116
|
||||
.uleb128 0x19
|
||||
.byte 0
|
||||
.byte 0
|
||||
.uleb128 0xc
|
||||
.uleb128 0x34
|
||||
.byte 0
|
||||
.uleb128 0x3
|
||||
.uleb128 0x8
|
||||
.uleb128 0x3a
|
||||
.uleb128 0xb
|
||||
.uleb128 0x3b
|
||||
.uleb128 0xb
|
||||
.uleb128 0x49
|
||||
.uleb128 0x20
|
||||
.uleb128 0x3f
|
||||
.uleb128 0x19
|
||||
.uleb128 0x2
|
||||
.uleb128 0x18
|
||||
.byte 0
|
||||
.byte 0
|
||||
.byte 0
|
||||
.section .debug_gnu_pubnames,"",@progbits
|
||||
.Ldebug_pubnames0:
|
||||
.long 0x20
|
||||
.value 0x2
|
||||
.long .Lskeleton_debug_info0
|
||||
.long 0xcf
|
||||
.long 0x9d
|
||||
.byte 0x30
|
||||
.string "t16a"
|
||||
.long 0xbd
|
||||
.byte 0x20
|
||||
.string "c3"
|
||||
.long 0
|
||||
.section .debug_gnu_pubtypes,"",@progbits
|
||||
.Ldebug_pubtypes0:
|
||||
.long 0x29
|
||||
.value 0x2
|
||||
.long .Lskeleton_debug_info0
|
||||
.long 0xcf
|
||||
.long 0x8e
|
||||
.byte 0x90
|
||||
.string "int"
|
||||
.long 0x95
|
||||
.byte 0x90
|
||||
.string "bool"
|
||||
.long 0
|
||||
.byte 0x10
|
||||
.string "C3"
|
||||
.long 0
|
||||
.section .debug_aranges,"",@progbits
|
||||
.long 0x2c
|
||||
.value 0x2
|
||||
.long .Lskeleton_debug_info0
|
||||
.byte 0x8
|
||||
.byte 0
|
||||
.value 0
|
||||
.value 0
|
||||
.quad .Ltext0
|
||||
.quad .Letext0-.Ltext0
|
||||
.quad 0
|
||||
.quad 0
|
||||
.section .debug_line,"",@progbits
|
||||
.Ldebug_line0:
|
||||
.section .debug_line.dwo,"e",@progbits
|
||||
.Lskeleton_debug_line0:
|
||||
.long .LELT0-.LSLT0
|
||||
.LSLT0:
|
||||
.value 0x4
|
||||
.long .LELTP0-.LASLTP0
|
||||
.LASLTP0:
|
||||
.byte 0x1
|
||||
.byte 0x1
|
||||
.byte 0x1
|
||||
.byte 0xf6
|
||||
.byte 0xf2
|
||||
.byte 0xd
|
||||
.byte 0
|
||||
.byte 0x1
|
||||
.byte 0x1
|
||||
.byte 0x1
|
||||
.byte 0x1
|
||||
.byte 0
|
||||
.byte 0
|
||||
.byte 0
|
||||
.byte 0x1
|
||||
.byte 0
|
||||
.byte 0
|
||||
.byte 0x1
|
||||
.byte 0
|
||||
.string "dwp_test_1b.cc"
|
||||
.uleb128 0
|
||||
.uleb128 0
|
||||
.uleb128 0
|
||||
.string "dwp_test.h"
|
||||
.uleb128 0
|
||||
.uleb128 0
|
||||
.uleb128 0
|
||||
.byte 0
|
||||
.LELTP0:
|
||||
.LELT0:
|
||||
.section .debug_addr,"",@progbits
|
||||
.Ldebug_addr0:
|
||||
.quad .LFB1
|
||||
.quad c3
|
||||
.ident "GCC: (Google_crosstoolv16-gcc-4.7.x-grtev3) 4.7.x-google 20120720 (prerelease)"
|
||||
.section .note.GNU-stack,"",@progbits
|
144
gold/testsuite/dwp_test_2.cc
Normal file
144
gold/testsuite/dwp_test_2.cc
Normal file
@ -0,0 +1,144 @@
|
||||
// dwp_test_2.cc -- a test case for dwp
|
||||
|
||||
// Copyright 2012 Free Software Foundation, Inc.
|
||||
// Written by Cary Coutant <ccoutant@google.com>.
|
||||
|
||||
// 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.
|
||||
|
||||
// Adapted from two_file_test_2.cc.
|
||||
|
||||
#include "dwp_test.h"
|
||||
|
||||
// 1 Code in file 1 calls code in file 2.
|
||||
|
||||
int
|
||||
C1::t1_2()
|
||||
{
|
||||
return 123;
|
||||
}
|
||||
|
||||
bool
|
||||
C1::t1a()
|
||||
{
|
||||
return t1_2() == 123;
|
||||
}
|
||||
|
||||
// 2 Code in file 1 refers to global data in file 2.
|
||||
|
||||
int v2 = 456;
|
||||
|
||||
// 3 Code in file 1 referes to common symbol in file 2. This is
|
||||
// initialized at runtime to 789.
|
||||
|
||||
int v3;
|
||||
|
||||
// 4 Code in file 1 refers to offset within global data in file 2.
|
||||
|
||||
char v4[] = "Hello, world";
|
||||
|
||||
// 5 Code in file 1 refers to offset within common symbol in file 2.
|
||||
// This is initialized at runtime to a copy of v4.
|
||||
|
||||
char v5[13];
|
||||
|
||||
// 6 Data in file 1 refers to global data in file 2. This reuses v2.
|
||||
|
||||
// 7 Data in file 1 refers to common symbol in file 2. This reuses v3.
|
||||
|
||||
// 8 Data in file 1 refers to offset within global data in file 2.
|
||||
// This reuses v4.
|
||||
|
||||
// 9 Data in file 1 refers to offset within common symbol in file 2.
|
||||
// This reuses v5.
|
||||
|
||||
// 10 Data in file 1 refers to function in file 2.
|
||||
|
||||
int
|
||||
f10()
|
||||
{
|
||||
return 135;
|
||||
}
|
||||
|
||||
// 11 Pass function pointer from file 1 to file 2.
|
||||
|
||||
int
|
||||
f11b(int (*pfn)())
|
||||
{
|
||||
return (*pfn)();
|
||||
}
|
||||
|
||||
// 12 Compare address of function for equality in both files.
|
||||
|
||||
bool
|
||||
(*C3::f4())()
|
||||
{
|
||||
return &t12;
|
||||
}
|
||||
|
||||
// 13 Compare address of inline function for equality in both files.
|
||||
|
||||
void
|
||||
(*f13())()
|
||||
{
|
||||
return &f13i;
|
||||
}
|
||||
|
||||
// 14 Compare string constants in file 1 and file 2.
|
||||
|
||||
const char*
|
||||
f14()
|
||||
{
|
||||
return TEST_STRING_CONSTANT;
|
||||
}
|
||||
|
||||
// 15 Compare wide string constants in file 1 and file 2.
|
||||
|
||||
const wchar_t*
|
||||
f15()
|
||||
{
|
||||
return TEST_WIDE_STRING_CONSTANT;
|
||||
}
|
||||
|
||||
// 17 File 1 checks array of string constants defined in file 2.
|
||||
|
||||
const char* t17data[T17_COUNT] =
|
||||
{
|
||||
"a", "b", "c", "d", "e"
|
||||
};
|
||||
|
||||
// 18 File 1 checks string constants referenced directly in file 2.
|
||||
|
||||
const char*
|
||||
f18(int i)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0:
|
||||
return "a";
|
||||
case 1:
|
||||
return "b";
|
||||
case 2:
|
||||
return "c";
|
||||
case 3:
|
||||
return "d";
|
||||
case 4:
|
||||
return "e";
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
1714
gold/testsuite/dwp_test_2.s
Normal file
1714
gold/testsuite/dwp_test_2.s
Normal file
File diff suppressed because it is too large
Load Diff
63
gold/testsuite/dwp_test_2.sh
Executable file
63
gold/testsuite/dwp_test_2.sh
Executable file
@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
|
||||
# dwp_test_2.sh -- Test the dwp tool.
|
||||
|
||||
# Copyright 2012 Free Software Foundation, Inc.
|
||||
# Written by Cary Coutant <ccoutant@google.com>.
|
||||
|
||||
# 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.
|
||||
|
||||
check()
|
||||
{
|
||||
if ! grep -q "$2" "$1"
|
||||
then
|
||||
echo "Did not find expected output:"
|
||||
echo " $2"
|
||||
echo ""
|
||||
echo "Actual error output below:"
|
||||
cat "$1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_num()
|
||||
{
|
||||
n=$(grep -c "$2" "$1")
|
||||
if test "$n" -ne "$3"
|
||||
then
|
||||
echo "Found $n occurrences (should find $3):"
|
||||
echo " $2"
|
||||
echo ""
|
||||
echo "Actual error output below:"
|
||||
cat "$1"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
STDOUT="dwp_test_2.stdout"
|
||||
|
||||
check $STDOUT "^Contents of the .debug_info.dwo section"
|
||||
check_num $STDOUT "DW_TAG_compile_unit" 4
|
||||
check_num $STDOUT "DW_TAG_type_unit" 3
|
||||
check_num $STDOUT "DW_AT_name.*: C1" 3
|
||||
check_num $STDOUT "DW_AT_name.*: C2" 2
|
||||
check_num $STDOUT "DW_AT_name.*: C3" 3
|
||||
check_num $STDOUT "DW_AT_name.*: testcase1" 6
|
||||
check_num $STDOUT "DW_AT_name.*: testcase2" 6
|
||||
check_num $STDOUT "DW_AT_name.*: testcase3" 6
|
||||
check_num $STDOUT "DW_AT_name.*: testcase4" 4
|
59
gold/testsuite/dwp_test_main.cc
Normal file
59
gold/testsuite/dwp_test_main.cc
Normal file
@ -0,0 +1,59 @@
|
||||
// dwp_test_main.cc -- a test case for dwp
|
||||
|
||||
// Copyright 2012 Free Software Foundation, Inc.
|
||||
// Written by Cary Coutant <ccoutant@google.com>.
|
||||
|
||||
// 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.
|
||||
|
||||
// Adapted from two_file_test_main.cc.
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "dwp_test.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
C1 c1;
|
||||
C2 c2;
|
||||
|
||||
// Initialize common data.
|
||||
v3 = 789;
|
||||
for (int i = 0; i < 13; ++i)
|
||||
v5[i] = v4[i];
|
||||
|
||||
assert(c1.testcase1());
|
||||
assert(c1.t1a());
|
||||
assert(c1.testcase2());
|
||||
assert(c1.testcase3());
|
||||
assert(c1.testcase4());
|
||||
assert(c2.testcase1());
|
||||
assert(c2.testcase2());
|
||||
assert(c2.testcase3());
|
||||
assert(c2.testcase4());
|
||||
assert(c3.testcase1());
|
||||
assert(c3.testcase2());
|
||||
assert(c3.testcase3());
|
||||
assert(t12());
|
||||
assert(t13());
|
||||
assert(t16());
|
||||
assert(t16a());
|
||||
assert(t17());
|
||||
assert(t18());
|
||||
return 0;
|
||||
}
|
1399
gold/testsuite/dwp_test_main.s
Normal file
1399
gold/testsuite/dwp_test_main.s
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user