// two_file_test_1.cc -- a two file test case for gold, file 1 of 2
-// Copyright 2006, 2007 Free Software Foundation, Inc.
+// Copyright (C) 2006-2019 Free Software Foundation, Inc.
// Written by Ian Lance Taylor <iant@google.com>.
// This file is part of gold.
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
// MA 02110-1301, USA.
+// For incremental linking tests, this file needs to be compiled with
+// -fno-exceptions -fno-asynchronous-unwind-tables.
+
// This tests references between files. This is file 1, and
// two_file_test_2.cc is file 2. We test in several different ways:
// 12 Compare address of function for equality in both files.
// 13 Compare address of inline function for equality in both files.
// 14 Compare string constants in file 1 and file 2.
+// 15 Compare wide string constants in file 1 and file 2.
+// 16 Call a function directly after its address has been taken.
+// 17 File 1 checks array of string constants defined in file 2.
+// 18 File 1 checks string constants referenced in code in file 2.
#include "two_file_test.h"
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;
+}