139287Ssos/* common_test_1_v1.c -- test common symbol sorting 239643Syokota 339287Ssos Copyright (C) 2008-2017 Free Software Foundation, Inc. 439287Ssos Written by Ian Lance Taylor <iant@google.com> 5146736Sdelphij 6146736Sdelphij This file is part of gold. 7146736Sdelphij 839287Ssos This program is free software; you can redistribute it and/or modify 939287Ssos it under the terms of the GNU General Public License as published by 1039287Ssos the Free Software Foundation; either version 3 of the License, or 1139287Ssos (at your option) any later version. 1239643Syokota 1339643Syokota This program is distributed in the hope that it will be useful, 1439287Ssos but WITHOUT ANY WARRANTY; without even the implied warranty of 1539287Ssos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1639287Ssos GNU General Public License for more details. 1739287Ssos 1839643Syokota You should have received a copy of the GNU General Public License 1939643Syokota along with this program; if not, write to the Free Software 2039643Syokota Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, 2139643Syokota MA 02110-1301, USA. 2239643Syokota 2339643Syokota This is a test of a common symbol in the main program and a 2439643Syokota versioned symbol in a shared library. The common symbol in the 2539643Syokota main program should override the shared library symbol. 2639643Syokota 2739643Syokota This file is a modified version of the real test case, to be used 2839287Ssos while testing the --incremental option. */ 2939287Ssos 30119420Sobrien#include <assert.h> 31119420Sobrien 32119420Sobrien/* Common symbols should be sorted by size, largest first, and then by 33162711Sru alignment, largest first. We mix up the names, because gas seems 3439287Ssos to sort common symbols roughly by name. */ 3539287Ssos 3639287Ssosint c9[90]; 3739287Ssosint c8[80]; 3851404Syokotaint c7[70]; 3939287Ssosint c6[60]; 4039287Ssosint c5[10]; 4139287Ssosint c4[20]; 4266834Sphkint c3[30]; 4366834Sphkint c2[40]; 4491140Stanimuraint c1[50]; 4591140Stanimura 4691140Stanimuraint a1 __attribute__ ((aligned (1 << 9))); 4791140Stanimuraint a2 __attribute__ ((aligned (1 << 8))); 4891140Stanimuraint a3 __attribute__ ((aligned (1 << 7))); 4939287Ssosint a4 __attribute__ ((aligned (1 << 6))); 5042504Syokotaint a5 __attribute__ ((aligned (1 << 1))); 5142504Syokotaint a6 __attribute__ ((aligned (1 << 2))); 5239287Ssosint a7 __attribute__ ((aligned (1 << 3))); 5378161Speterint a8 __attribute__ ((aligned (1 << 4))); 5478161Speterint a9 __attribute__ ((aligned (1 << 5))); 5542504Syokota 5648104Syokotaint 5742504Syokotamain (int argc __attribute__ ((unused)), char** argv __attribute__ ((unused))) 5842504Syokota{ 5942504Syokota /* These tests are deliberately incorrect. */ 6042504Syokota assert (c5 < c4); 6148104Syokota assert (c4 < c3); 6242504Syokota assert (c3 < c2); 6342504Syokota assert (c2 < c1); 6442504Syokota assert (c1 < c6); 6542504Syokota assert (c6 < c7); 6642504Syokota assert (c7 < c8); 6742504Syokota assert (c8 < c9); 6842504Syokota 6942504Syokota assert (&a1 > &a2); 7048104Syokota assert (&a2 > &a3); 7142504Syokota assert (&a3 > &a4); 7242504Syokota assert (&a4 > &a9); 7342504Syokota assert (&a9 > &a8); 7442504Syokota assert (&a8 > &a7); 7542504Syokota assert (&a7 > &a6); 7642504Syokota assert (&a6 > &a5); 7742504Syokota 7842504Syokota return 0; 7942504Syokota} 8042504Syokota