Makefile.am 135 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412
  1. # Process this file with automake to generate Makefile.in
  2. # As far as I can tell automake testing support assumes that the build
  3. # system and the host system are the same. So these tests will not
  4. # work when building with a cross-compiler.
  5. # Ignore warning about AM_PROG_CC_C_O due to large_CFLAGS
  6. AUTOMAKE_OPTIONS = foreign -Wno-portability
  7. # This is where we get zlib from. zlib is in ../../zlib unless we were
  8. # configured with --with-system-zlib, in which case ../../zlib either
  9. # doesn't exist or not configured.
  10. ZLIB = -L../../zlib -lz
  11. # The two_file_test tests -fmerge-constants, so we simply always turn
  12. # it on. For compilers that do not support the command-line option,
  13. # we assume they just always emit SHF_MERGE sections unconditionally.
  14. AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
  15. AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(MERGE_CONSTANTS_FLAG)
  16. AM_CPPFLAGS = \
  17. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../../include \
  18. -I$(srcdir)/../../elfcpp -I.. \
  19. -DLOCALEDIR="\"$(datadir)/locale\"" \
  20. @INCINTL@
  21. # Some versions of GCC now automatically enable linker plugins,
  22. # but we want to run our tests without GCC's plugins.
  23. if HAVE_NO_USE_LINKER_PLUGIN
  24. OPT_NO_PLUGINS = -fno-use-linker-plugin
  25. endif
  26. # COMPILE1, LINK1, CXXCOMPILE1, CXXLINK1 are renamed from COMPILE, LINK,
  27. # CXXCOMPILE and CXXLINK generated by automake 1.11.1. FIXME: they should
  28. # be updated if they are different from automake used by gold.
  29. COMPILE1 = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
  30. $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
  31. LINK1 = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(OPT_NO_PLUGINS) \
  32. $(AM_LDFLAGS) $(LDFLAGS) -o $@
  33. CXXCOMPILE1 = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
  34. $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
  35. CXXLINK1 = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(OPT_NO_PLUGINS) \
  36. $(AM_LDFLAGS) $(LDFLAGS) -o $@
  37. # Strip out -Wp,-D_FORTIFY_SOURCE=, which is irrelevant for the gold
  38. # testsuite and incompatible with -O0 used in gold tests, from
  39. # COMPILE, LINK, CXXCOMPILE and CXXLINK.
  40. COMPILE = `echo $(COMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9[0-9]]*//'`
  41. LINK = `echo $(LINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
  42. CXXCOMPILE = `echo $(CXXCOMPILE1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
  43. CXXLINK = `echo $(CXXLINK1) | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[0-9][0-9]*//'`
  44. # Strip out -static-libgcc and -static-libstdc++ options, for tests
  45. # that must have these libraries linked dynamically. The -shared-libgcc
  46. # option does not work correctly, and there is no -shared-libstdc++ option.
  47. # (See GCC PR 55781 and PR 55782.)
  48. CXXLINK_S = `echo $(CXXLINK1) | sed -e 's/-static-lib\\(gcc\\|stdc++\\)//g'`
  49. TEST_READELF = $(top_builddir)/../binutils/readelf
  50. TEST_OBJDUMP = $(top_builddir)/../binutils/objdump
  51. TEST_OBJCOPY = $(top_builddir)/../binutils/objcopy
  52. TEST_CXXFILT = $(top_builddir)/../binutils/cxxfilt
  53. TEST_STRIP = $(top_builddir)/../binutils/strip-new
  54. TEST_AR = $(top_builddir)/../binutils/ar
  55. TEST_NM = $(top_builddir)/../binutils/nm-new
  56. TEST_AS = $(top_builddir)/../gas/as-new
  57. if PLUGINS
  58. LIBDL = -ldl
  59. endif
  60. if THREADS
  61. THREADSLIB = -lpthread
  62. endif
  63. if OMP_SUPPORT
  64. TLS_TEST_C_CFLAGS = -fopenmp
  65. endif
  66. # 'make clean' is good about deleting some intermediate files (such as
  67. # .o's), but not all of them (such as .so's and .err files). We
  68. # improve on that here. automake-1.9 info docs say "mostlyclean" is
  69. # the right choice for files 'make' builds that people rebuild.
  70. MOSTLYCLEANFILES = *.so *.syms *.stdout
  71. # Export make variables to the shell scripts so that they can see
  72. # (for example) DEFAULT_TARGET.
  73. .EXPORT_ALL_VARIABLES:
  74. # We will add to these later, for each individual test. Note
  75. # that we add each test under check_SCRIPTS or check_PROGRAMS;
  76. # the TESTS variable is automatically populated from these.
  77. check_SCRIPTS =
  78. check_DATA =
  79. check_PROGRAMS =
  80. BUILT_SOURCES =
  81. TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
  82. # ---------------------------------------------------------------------
  83. # These tests test the internals of gold (unittests).
  84. # Infrastucture needed for the unittests
  85. check_LIBRARIES = libgoldtest.a
  86. libgoldtest_a_SOURCES = test.cc testmain.cc testfile.cc
  87. DEPENDENCIES = \
  88. libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL_DEP)
  89. LDADD = libgoldtest.a ../libgold.a ../../libiberty/libiberty.a $(LIBINTL) \
  90. $(THREADSLIB) $(LIBDL) $(ZLIB)
  91. # The unittests themselves
  92. if NATIVE_OR_CROSS_LINKER
  93. if GCC
  94. # Infrastucture needed for the unittests: a directory where the linker
  95. # is named 'ld'. This is because the -B flag appends 'ld' to its arg.
  96. gcctestdir/ld: ../ld-new
  97. test -d gcctestdir || mkdir -p gcctestdir
  98. rm -f gcctestdir/ld
  99. (cd gcctestdir && $(LN_S) ../../ld-new ld)
  100. # Some tests require the latest features of an in-tree assembler.
  101. gcctestdir/as: $(TEST_AS)
  102. test -d gcctestdir || mkdir -p gcctestdir
  103. rm -f gcctestdir/as
  104. (cd gcctestdir && $(LN_S) $(abs_top_builddir)/../gas/as-new as)
  105. endif GCC
  106. check_PROGRAMS += object_unittest
  107. object_unittest_SOURCES = object_unittest.cc
  108. check_PROGRAMS += binary_unittest
  109. binary_unittest_SOURCES = binary_unittest.cc
  110. check_PROGRAMS += leb128_unittest
  111. leb128_unittest_SOURCES = leb128_unittest.cc
  112. endif NATIVE_OR_CROSS_LINKER
  113. # ---------------------------------------------------------------------
  114. # These tests test the output of gold (end-to-end tests). In
  115. # particular, they make sure that gold can link "difficult" object
  116. # files, and the resulting object files run correctly. These can only
  117. # run if we've built ld-new for the native architecture (that is,
  118. # we're not cross-compiling it), since we run ld-new as part of these
  119. # tests. We use the gcc-specific flag '-B' to use our linker instead
  120. # of the default linker, which is why we only run our tests under gcc.
  121. if NATIVE_LINKER
  122. if GCC
  123. # Each of these .o's is a useful, small complete program. They're
  124. # particularly useful for making sure ld-new's flags do what they're
  125. # supposed to (hence their names), but are used for many tests that
  126. # don't actually involve analyzing input data.
  127. flagstest_debug.o: constructor_test.cc
  128. $(CXXCOMPILE) -O0 -g -c -o $@ $<
  129. flagstest_ndebug.o: constructor_test.cc
  130. $(CXXCOMPILE) -O0 -c -o $@ $<
  131. check_SCRIPTS += incremental_test.sh
  132. check_DATA += incremental_test.stdout
  133. MOSTLYCLEANFILES += incremental_test incremental_test.cmdline
  134. incremental_test_1.o: incremental_test_1.c
  135. $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  136. incremental_test_2.o: incremental_test_2.c
  137. $(COMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  138. incremental_test: incremental_test_1.o incremental_test_2.o gcctestdir/ld
  139. $(LINK) -Bgcctestdir/ -Wl,--incremental-full -Wl,-z,norelro incremental_test_1.o incremental_test_2.o -Wl,-debug 2> incremental_test.cmdline
  140. incremental_test.stdout: incremental_test ../incremental-dump
  141. ../incremental-dump incremental_test > $@
  142. check_SCRIPTS += gc_comdat_test.sh
  143. check_DATA += gc_comdat_test.stdout
  144. MOSTLYCLEANFILES += gc_comdat_test
  145. gc_comdat_test_1.o: gc_comdat_test_1.cc
  146. $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  147. gc_comdat_test_2.o: gc_comdat_test_2.cc
  148. $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  149. gc_comdat_test: gc_comdat_test_1.o gc_comdat_test_2.o gcctestdir/ld
  150. $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_comdat_test_1.o gc_comdat_test_2.o
  151. gc_comdat_test.stdout: gc_comdat_test
  152. $(TEST_NM) -C gc_comdat_test > gc_comdat_test.stdout
  153. check_SCRIPTS += gc_tls_test.sh
  154. check_DATA += gc_tls_test.stdout
  155. MOSTLYCLEANFILES += gc_tls_test
  156. gc_tls_test.o: gc_tls_test.cc
  157. $(CXXCOMPILE) -O0 -c -g -o $@ $<
  158. gc_tls_test:gc_tls_test.o gcctestdir/ld
  159. $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_tls_test.o
  160. gc_tls_test.stdout: gc_tls_test
  161. $(TEST_NM) -C gc_tls_test > gc_tls_test.stdout
  162. check_SCRIPTS += gc_orphan_section_test.sh
  163. check_DATA += gc_orphan_section_test.stdout
  164. MOSTLYCLEANFILES += gc_orphan_section_test
  165. gc_orphan_section_test.o: gc_orphan_section_test.cc
  166. $(CXXCOMPILE) -O0 -c -g -o $@ $<
  167. gc_orphan_section_test:gc_orphan_section_test.o gcctestdir/ld
  168. $(CXXLINK) -Bgcctestdir/ -Wl,--gc-sections gc_orphan_section_test.o
  169. gc_orphan_section_test.stdout: gc_orphan_section_test
  170. $(TEST_NM) gc_orphan_section_test > gc_orphan_section_test.stdout
  171. check_SCRIPTS += pr14265.sh
  172. check_DATA += pr14265.stdout
  173. MOSTLYCLEANFILES += pr14265
  174. pr14265.o: pr14265.c
  175. $(COMPILE) -O0 -c -o $@ $<
  176. pr14265: pr14265.o
  177. $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,-T,$(srcdir)/pr14265.t -o $@ $<
  178. pr14265.stdout: pr14265
  179. $(TEST_NM) --format=bsd --numeric-sort $< > $@
  180. check_SCRIPTS += gc_dynamic_list_test.sh
  181. check_DATA += gc_dynamic_list_test.stdout
  182. MOSTLYCLEANFILES += gc_dynamic_list_test
  183. gc_dynamic_list_test.o: gc_dynamic_list_test.c
  184. $(COMPILE) -c -ffunction-sections -o $@ $<
  185. gc_dynamic_list_test: gc_dynamic_list_test.o gcctestdir/ld $(srcdir)/gc_dynamic_list_test.t
  186. $(LINK) -Bgcctestdir/ -Wl,--gc-sections -Wl,--dynamic-list,$(srcdir)/gc_dynamic_list_test.t gc_dynamic_list_test.o
  187. gc_dynamic_list_test.stdout: gc_dynamic_list_test
  188. $(TEST_NM) gc_dynamic_list_test > $@
  189. check_SCRIPTS += icf_test.sh
  190. check_DATA += icf_test.map
  191. MOSTLYCLEANFILES += icf_test icf_test.map
  192. icf_test.o: icf_test.cc
  193. $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  194. icf_test: icf_test.o gcctestdir/ld
  195. $(CXXLINK) -o icf_test -Bgcctestdir/ -Wl,--icf=all,-Map,icf_test.map icf_test.o
  196. icf_test.map: icf_test
  197. @touch icf_test.map
  198. check_SCRIPTS += icf_keep_unique_test.sh
  199. check_DATA += icf_keep_unique_test.stdout
  200. MOSTLYCLEANFILES += icf_keep_unique_test
  201. icf_keep_unique_test.o: icf_keep_unique_test.cc
  202. $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  203. icf_keep_unique_test: icf_keep_unique_test.o gcctestdir/ld
  204. $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all -Wl,--keep-unique,_Z11unique_funcv icf_keep_unique_test.o
  205. icf_keep_unique_test.stdout: icf_keep_unique_test
  206. $(TEST_NM) -C $< > $@
  207. check_SCRIPTS += icf_safe_test.sh
  208. check_DATA += icf_safe_test_1.stdout icf_safe_test_2.stdout icf_safe_test.map
  209. MOSTLYCLEANFILES += icf_safe_test icf_safe_test.map
  210. icf_safe_test.o: icf_safe_test.cc
  211. $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  212. icf_safe_test: icf_safe_test.o gcctestdir/ld
  213. $(CXXLINK) -o icf_safe_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_test.map icf_safe_test.o
  214. icf_safe_test.map: icf_safe_test
  215. @touch icf_safe_test.map
  216. icf_safe_test_1.stdout: icf_safe_test
  217. $(TEST_NM) $< > $@
  218. icf_safe_test_2.stdout: icf_safe_test
  219. $(TEST_READELF) -h $< > $@
  220. check_SCRIPTS += icf_safe_so_test.sh
  221. check_DATA += icf_safe_so_test_1.stdout icf_safe_so_test_2.stdout icf_safe_so_test.map
  222. MOSTLYCLEANFILES += icf_safe_so_test icf_safe_so_test.map
  223. icf_safe_so_test.o: icf_safe_so_test.cc
  224. $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
  225. icf_safe_so_test: icf_safe_so_test.o gcctestdir/ld
  226. $(CXXLINK) -o icf_safe_so_test -Bgcctestdir/ -Wl,--icf=safe,-Map,icf_safe_so_test.map icf_safe_so_test.o -fPIC -shared
  227. icf_safe_so_test.map:
  228. @touch icf_safe_so_test.map
  229. icf_safe_so_test_1.stdout: icf_safe_so_test
  230. $(TEST_NM) $< > $@
  231. icf_safe_so_test_2.stdout: icf_safe_so_test
  232. $(TEST_READELF) -h $< > $@
  233. check_SCRIPTS += final_layout.sh
  234. check_DATA += final_layout.stdout
  235. MOSTLYCLEANFILES += final_layout final_layout_sequence.txt final_layout_script.lds
  236. final_layout.o: final_layout.cc
  237. $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
  238. final_layout_sequence.txt:
  239. (echo "*_Z3barv*" && echo ".text._Z3bazv" && echo "*_Z3foov*" && echo "*global_varb*" && echo "*global_vara*" && echo "*global_varc*") > final_layout_sequence.txt
  240. final_layout_script.lds:
  241. (echo "SECTIONS { .text : { *(.text*) } .got : { *(.got .toc) } .sbss : { *(.sbss*) } .bss : { *(.bss*) } }") > final_layout_script.lds
  242. final_layout: final_layout.o final_layout_sequence.txt final_layout_script.lds gcctestdir/ld
  243. $(CXXLINK) -Bgcctestdir/ -Wl,--section-ordering-file,final_layout_sequence.txt -Wl,-T,final_layout_script.lds final_layout.o
  244. final_layout.stdout: final_layout
  245. $(TEST_NM) -n --synthetic final_layout > final_layout.stdout
  246. check_SCRIPTS += text_section_grouping.sh
  247. check_DATA += text_section_grouping.stdout text_section_no_grouping.stdout
  248. MOSTLYCLEANFILES += text_section_grouping text_section_no_grouping
  249. text_section_grouping.o: text_section_grouping.cc
  250. $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  251. text_section_grouping: text_section_grouping.o gcctestdir/ld
  252. $(CXXLINK) -Bgcctestdir/ text_section_grouping.o
  253. text_section_no_grouping: text_section_grouping.o gcctestdir/ld
  254. $(CXXLINK) -Bgcctestdir/ -Wl,--no-text-reorder text_section_grouping.o
  255. text_section_grouping.stdout: text_section_grouping
  256. $(TEST_NM) -n --synthetic text_section_grouping > text_section_grouping.stdout
  257. text_section_no_grouping.stdout: text_section_no_grouping
  258. $(TEST_NM) -n --synthetic text_section_no_grouping > text_section_no_grouping.stdout
  259. check_SCRIPTS += section_sorting_name.sh
  260. check_DATA += section_sorting_name.stdout
  261. MOSTLYCLEANFILES += section_sorting_name
  262. section_sorting_name.o: section_sorting_name.cc
  263. $(CXXCOMPILE) -O0 -c -ffunction-sections -g -o $@ $<
  264. section_sorting_name: section_sorting_name.o gcctestdir/ld
  265. $(CXXLINK) -Bgcctestdir/ -Wl,--sort-section=name section_sorting_name.o
  266. section_sorting_name.stdout: section_sorting_name
  267. $(TEST_NM) -n --synthetic section_sorting_name > section_sorting_name.stdout
  268. check_PROGRAMS += icf_virtual_function_folding_test
  269. MOSTLYCLEANFILES += icf_virtual_function_folding_test icf_virtual_function_folding_test.map
  270. icf_virtual_function_folding_test.o: icf_virtual_function_folding_test.cc
  271. $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIE -g -o $@ $<
  272. icf_virtual_function_folding_test: icf_virtual_function_folding_test.o gcctestdir/ld
  273. $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_virtual_function_folding_test.o -pie
  274. check_SCRIPTS += icf_preemptible_functions_test.sh
  275. check_DATA += icf_preemptible_functions_test.stdout
  276. MOSTLYCLEANFILES += icf_preemptible_functions_test
  277. icf_preemptible_functions_test.o: icf_preemptible_functions_test.cc
  278. $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
  279. icf_preemptible_functions_test: icf_preemptible_functions_test.o gcctestdir/ld
  280. $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_preemptible_functions_test.o -fPIC -shared
  281. icf_preemptible_functions_test.stdout: icf_preemptible_functions_test
  282. $(TEST_NM) icf_preemptible_functions_test > icf_preemptible_functions_test.stdout
  283. check_SCRIPTS += icf_string_merge_test.sh
  284. check_DATA += icf_string_merge_test.stdout
  285. MOSTLYCLEANFILES += icf_string_merge_test
  286. icf_string_merge_test.o: icf_string_merge_test.cc
  287. $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
  288. icf_string_merge_test: icf_string_merge_test.o gcctestdir/ld
  289. $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_string_merge_test.o
  290. icf_string_merge_test.stdout: icf_string_merge_test
  291. $(TEST_NM) icf_string_merge_test > icf_string_merge_test.stdout
  292. check_SCRIPTS += icf_sht_rel_addend_test.sh
  293. check_DATA += icf_sht_rel_addend_test.stdout
  294. MOSTLYCLEANFILES += icf_sht_rel_addend_test
  295. icf_sht_rel_addend_test_1.o: icf_sht_rel_addend_test_1.cc
  296. $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
  297. icf_sht_rel_addend_test_2.o: icf_sht_rel_addend_test_2.cc
  298. $(CXXCOMPILE) -O0 -c -ffunction-sections -fPIC -g -o $@ $<
  299. icf_sht_rel_addend_test: icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o gcctestdir/ld
  300. $(CXXLINK) -Bgcctestdir/ -Wl,--icf=all icf_sht_rel_addend_test_1.o icf_sht_rel_addend_test_2.o
  301. icf_sht_rel_addend_test.stdout: icf_sht_rel_addend_test
  302. $(TEST_NM) icf_sht_rel_addend_test > icf_sht_rel_addend_test.stdout
  303. check_PROGRAMS += large_symbol_alignment
  304. large_symbol_alignment_SOURCES = large_symbol_alignment.cc
  305. large_symbol_alignment_DEPENDENCIES = gcctestdir/ld
  306. large_symbol_alignment_LDFLAGS = -Bgcctestdir/
  307. large_symbol_alignment_LDADD =
  308. check_SCRIPTS += merge_string_literals.sh
  309. check_DATA += merge_string_literals.stdout
  310. MOSTLYCLEANFILES += merge_string_literals
  311. merge_string_literals_1.o: merge_string_literals_1.cc
  312. $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
  313. merge_string_literals_2.o: merge_string_literals_2.cc
  314. $(CXXCOMPILE) -O2 -c -fPIC -g -o $@ $<
  315. merge_string_literals: merge_string_literals_1.o merge_string_literals_2.o gcctestdir/ld
  316. $(CXXLINK) -Bgcctestdir/ merge_string_literals_1.o merge_string_literals_2.o -O2 -shared -nostdlib
  317. merge_string_literals.stdout: merge_string_literals
  318. $(TEST_OBJDUMP) -s -j.rodata merge_string_literals > merge_string_literals.stdout
  319. check_PROGRAMS += basic_test
  320. check_PROGRAMS += basic_pic_test
  321. basic_test.o: basic_test.cc
  322. $(CXXCOMPILE) -O0 -c -o $@ $<
  323. basic_test: basic_test.o gcctestdir/ld
  324. $(CXXLINK) -Bgcctestdir/ basic_test.o
  325. check_PROGRAMS += eh_test
  326. eh_test_a.o: eh_test_a.cc
  327. $(CXXCOMPILE) -O0 -c -o $@ $<
  328. eh_test_b.o: eh_test_b.cc
  329. $(CXXCOMPILE) -O0 -c -o $@ $<
  330. eh_test: eh_test_a.o eh_test_b.o gcctestdir/ld
  331. $(CXXLINK_S) -Bgcctestdir/ eh_test_a.o eh_test_b.o
  332. if HAVE_STATIC
  333. check_PROGRAMS += basic_static_test
  334. basic_static_test: basic_test.o gcctestdir/ld
  335. $(CXXLINK) -Bgcctestdir/ -static basic_test.o
  336. endif
  337. basic_pic_test.o: basic_test.cc
  338. $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
  339. basic_pic_test: basic_pic_test.o gcctestdir/ld
  340. $(CXXLINK) -Bgcctestdir/ basic_pic_test.o
  341. if HAVE_STATIC
  342. check_PROGRAMS += basic_static_pic_test
  343. basic_static_pic_test: basic_pic_test.o gcctestdir/ld
  344. $(CXXLINK) -Bgcctestdir/ -static basic_pic_test.o
  345. endif
  346. check_PROGRAMS += basic_pie_test
  347. basic_pie_test.o: basic_test.cc
  348. $(CXXCOMPILE) -O0 -c -fpie -o $@ $<
  349. basic_pie_test: basic_pie_test.o gcctestdir/ld
  350. $(CXXLINK) -Bgcctestdir/ -pie basic_pie_test.o
  351. check_PROGRAMS += constructor_test
  352. constructor_test_SOURCES = constructor_test.cc
  353. constructor_test_DEPENDENCIES = gcctestdir/ld
  354. constructor_test_LDFLAGS = -Bgcctestdir/
  355. constructor_test_LDADD =
  356. if HAVE_STATIC
  357. check_PROGRAMS += constructor_static_test
  358. constructor_static_test_SOURCES = $(constructor_test_SOURCES)
  359. constructor_static_test_DEPENDENCIES = $(constructor_test_DEPENDENCIES)
  360. constructor_static_test_LDFLAGS = $(constructor_test_LDFLAGS) -static
  361. constructor_static_test_LDADD = $(constructor_test_LDADD)
  362. endif
  363. check_PROGRAMS += two_file_test
  364. check_PROGRAMS += two_file_pic_test
  365. two_file_test_SOURCES = \
  366. two_file_test_1.cc \
  367. two_file_test_1b.cc \
  368. two_file_test_2.cc \
  369. two_file_test_main.cc \
  370. two_file_test.h
  371. two_file_test_DEPENDENCIES = gcctestdir/ld
  372. two_file_test_LDFLAGS = -Bgcctestdir/
  373. two_file_test_LDADD =
  374. if HAVE_STATIC
  375. check_PROGRAMS += two_file_static_test
  376. two_file_static_test_SOURCES = $(two_file_test_SOURCES)
  377. two_file_static_test_DEPENDENCIES = $(two_file_test_DEPENDENCIES)
  378. two_file_static_test_LDFLAGS = $(two_file_test_LDFLAGS) -static
  379. two_file_static_test_LDADD = $(two_file_test_LDADD)
  380. endif
  381. two_file_pic_test_SOURCES = two_file_test_main.cc
  382. two_file_pic_test_DEPENDENCIES = \
  383. gcctestdir/ld two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
  384. two_file_pic_test_LDFLAGS = -Bgcctestdir/
  385. two_file_pic_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
  386. check_PROGRAMS += two_file_shared_1_test
  387. check_PROGRAMS += two_file_shared_2_test
  388. check_PROGRAMS += two_file_shared_1_pic_2_test
  389. check_PROGRAMS += two_file_shared_2_pic_1_test
  390. check_PROGRAMS += two_file_same_shared_test
  391. check_PROGRAMS += two_file_separate_shared_12_test
  392. check_PROGRAMS += two_file_separate_shared_21_test
  393. two_file_test_1_pic.o: two_file_test_1.cc
  394. $(CXXCOMPILE) -c -fpic -o $@ $<
  395. two_file_test_1b_pic.o: two_file_test_1b.cc
  396. $(CXXCOMPILE) -c -fpic -o $@ $<
  397. two_file_test_2_pic.o: two_file_test_2.cc
  398. $(CXXCOMPILE) -c -fpic -o $@ $<
  399. two_file_shared_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o gcctestdir/ld
  400. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o
  401. two_file_shared_2.so: two_file_test_2_pic.o gcctestdir/ld
  402. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2_pic.o
  403. two_file_shared.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o gcctestdir/ld
  404. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2_pic.o
  405. two_file_shared_1_test_SOURCES = two_file_test_2.cc two_file_test_main.cc
  406. two_file_shared_1_test_DEPENDENCIES = gcctestdir/ld two_file_shared_1.so
  407. two_file_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  408. two_file_shared_1_test_LDADD = two_file_shared_1.so
  409. two_file_shared_2_test_SOURCES = two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
  410. two_file_shared_2_test_DEPENDENCIES = gcctestdir/ld two_file_shared_2.so
  411. two_file_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  412. two_file_shared_2_test_LDADD = two_file_shared_2.so
  413. two_file_shared_1_pic_2_test_SOURCES = two_file_test_main.cc
  414. two_file_shared_1_pic_2_test_DEPENDENCIES = \
  415. gcctestdir/ld two_file_shared_2.so two_file_test_1_pic.o two_file_test_1b_pic.o
  416. two_file_shared_1_pic_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  417. two_file_shared_1_pic_2_test_LDADD = two_file_test_1_pic.o two_file_test_1b_pic.o two_file_shared_2.so
  418. two_file_shared_2_pic_1_test_SOURCES = two_file_test_main.cc
  419. two_file_shared_2_pic_1_test_DEPENDENCIES = \
  420. gcctestdir/ld two_file_shared_1.so two_file_test_2_pic.o
  421. two_file_shared_2_pic_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  422. two_file_shared_2_pic_1_test_LDADD = two_file_test_2_pic.o two_file_shared_1.so
  423. two_file_same_shared_test_SOURCES = two_file_test_main.cc
  424. two_file_same_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared.so
  425. two_file_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  426. two_file_same_shared_test_LDADD = two_file_shared.so
  427. two_file_separate_shared_12_test_SOURCES = two_file_test_main.cc
  428. two_file_separate_shared_12_test_DEPENDENCIES = \
  429. gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
  430. two_file_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  431. two_file_separate_shared_12_test_LDADD = \
  432. two_file_shared_1.so two_file_shared_2.so
  433. two_file_separate_shared_21_test_SOURCES = two_file_test_main.cc
  434. two_file_separate_shared_21_test_DEPENDENCIES = \
  435. gcctestdir/ld two_file_shared_1.so two_file_shared_2.so
  436. two_file_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  437. two_file_separate_shared_21_test_LDADD = \
  438. two_file_shared_2.so two_file_shared_1.so
  439. check_PROGRAMS += two_file_relocatable_test
  440. two_file_relocatable_test_SOURCES = two_file_test_main.cc
  441. two_file_relocatable_test_DEPENDENCIES = \
  442. gcctestdir/ld two_file_relocatable.o
  443. two_file_relocatable_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  444. two_file_relocatable_test_LDADD = two_file_relocatable.o
  445. two_file_relocatable.o: gcctestdir/ld two_file_test_1.o two_file_test_1b.o two_file_test_2.o
  446. gcctestdir/ld -r -o $@ two_file_test_1.o two_file_test_1b.o two_file_test_2.o
  447. check_PROGRAMS += two_file_pie_test
  448. two_file_test_1_pie.o: two_file_test_1.cc
  449. $(CXXCOMPILE) -c -fpie -o $@ $<
  450. two_file_test_1b_pie.o: two_file_test_1b.cc
  451. $(CXXCOMPILE) -c -fpie -o $@ $<
  452. two_file_test_2_pie.o: two_file_test_2.cc
  453. $(CXXCOMPILE) -c -fpie -o $@ $<
  454. two_file_test_main_pie.o: two_file_test_main.cc
  455. $(CXXCOMPILE) -c -fpie -o $@ $<
  456. two_file_pie_test: two_file_test_1_pie.o two_file_test_1b_pie.o \
  457. two_file_test_2_pie.o two_file_test_main_pie.o gcctestdir/ld
  458. $(CXXLINK) -Bgcctestdir/ -pie two_file_test_1_pie.o two_file_test_1b_pie.o two_file_test_2_pie.o two_file_test_main_pie.o
  459. check_PROGRAMS += pie_copyrelocs_test
  460. pie_copyrelocs_test_SOURCES = pie_copyrelocs_test.cc
  461. pie_copyrelocs_test_DEPENDENCIES = gcctestdir/ld pie_copyrelocs_shared_test.so
  462. pie_copyrelocs_test_CXXFLAGS = -fno-exceptions -fno-asynchronous-unwind-tables
  463. pie_copyrelocs_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -pie
  464. pie_copyrelocs_test_LDADD = pie_copyrelocs_shared_test.so
  465. pie_copyrelocs_shared_test.o: pie_copyrelocs_shared_test.cc
  466. $(CXXCOMPILE) -O2 -fpic -c -o $@ $<
  467. pie_copyrelocs_shared_test.so: pie_copyrelocs_shared_test.o gcctestdir/ld
  468. $(CXXLINK) -Bgcctestdir/ -shared pie_copyrelocs_shared_test.o
  469. check_PROGRAMS += weak_unresolved_symbols_test
  470. weak_unresolved_symbols_test_SOURCES = weak_unresolved_symbols_test.cc
  471. weak_unresolved_symbols_test_CXXFLAGS = -fPIE
  472. weak_unresolved_symbols_test_LDFLAGS = -Bgcctestdir/ -pie -Wl,--weak-unresolved-symbols
  473. check_SCRIPTS += two_file_shared.sh
  474. check_DATA += two_file_shared.dbg
  475. MOSTLYCLEANFILES += two_file_shared.dbg
  476. two_file_shared.dbg: two_file_shared.so
  477. $(TEST_READELF) -w $< >$@ 2>/dev/null
  478. # The nonpic tests will fail on platforms which can not put non-PIC
  479. # code into shared libraries, so we just don't run them in that case.
  480. if FN_PTRS_IN_SO_WITHOUT_PIC
  481. check_PROGRAMS += two_file_shared_1_nonpic_test
  482. check_PROGRAMS += two_file_shared_2_nonpic_test
  483. check_PROGRAMS += two_file_same_shared_nonpic_test
  484. check_PROGRAMS += two_file_separate_shared_12_nonpic_test
  485. check_PROGRAMS += two_file_separate_shared_21_nonpic_test
  486. check_PROGRAMS += two_file_mixed_shared_test
  487. check_PROGRAMS += two_file_mixed_2_shared_test
  488. two_file_shared_1_nonpic.so: two_file_test_1.o gcctestdir/ld
  489. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o -Wl,-z,notext
  490. two_file_shared_2_nonpic.so: two_file_test_2.o gcctestdir/ld
  491. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_2.o
  492. two_file_shared_nonpic.so: two_file_test_1.o two_file_test_1b.o two_file_test_2.o gcctestdir/ld
  493. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b.o two_file_test_2.o -Wl,-z,notext
  494. two_file_shared_mixed.so: two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o gcctestdir/ld
  495. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o two_file_test_2.o -Wl,-z,notext
  496. two_file_shared_mixed_1.so: two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so gcctestdir/ld
  497. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1.o two_file_test_1b_pic.o two_file_shared_2.so -Wl,-z,notext
  498. two_file_shared_1_nonpic_test_SOURCES = \
  499. two_file_test_2.cc two_file_test_main.cc
  500. two_file_shared_1_nonpic_test_DEPENDENCIES = \
  501. gcctestdir/ld two_file_shared_1_nonpic.so
  502. two_file_shared_1_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  503. two_file_shared_1_nonpic_test_LDADD = two_file_shared_1_nonpic.so
  504. two_file_shared_2_nonpic_test_SOURCES = \
  505. two_file_test_1.cc two_file_test_1b.cc two_file_test_main.cc
  506. two_file_shared_2_nonpic_test_DEPENDENCIES = \
  507. gcctestdir/ld two_file_shared_2_nonpic.so
  508. two_file_shared_2_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  509. two_file_shared_2_nonpic_test_LDADD = two_file_shared_2_nonpic.so
  510. two_file_same_shared_nonpic_test_SOURCES = two_file_test_main.cc
  511. two_file_same_shared_nonpic_test_DEPENDENCIES = \
  512. gcctestdir/ld two_file_shared_nonpic.so
  513. two_file_same_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  514. two_file_same_shared_nonpic_test_LDADD = two_file_shared_nonpic.so
  515. two_file_separate_shared_12_nonpic_test_SOURCES = two_file_test_main.cc
  516. two_file_separate_shared_12_nonpic_test_DEPENDENCIES = \
  517. gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
  518. two_file_separate_shared_12_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  519. two_file_separate_shared_12_nonpic_test_LDADD = \
  520. two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
  521. two_file_separate_shared_21_nonpic_test_SOURCES = two_file_test_main.cc
  522. two_file_separate_shared_21_nonpic_test_DEPENDENCIES = \
  523. gcctestdir/ld two_file_shared_1_nonpic.so two_file_shared_2_nonpic.so
  524. two_file_separate_shared_21_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  525. two_file_separate_shared_21_nonpic_test_LDADD = \
  526. two_file_shared_2_nonpic.so two_file_shared_1_nonpic.so
  527. two_file_mixed_shared_test_SOURCES = two_file_test_main.cc
  528. two_file_mixed_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed.so
  529. two_file_mixed_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  530. two_file_mixed_shared_test_LDADD = two_file_shared_mixed.so
  531. two_file_mixed_2_shared_test_SOURCES = two_file_test_main.cc
  532. two_file_mixed_2_shared_test_DEPENDENCIES = gcctestdir/ld two_file_shared_mixed_1.so two_file_shared_2.so
  533. two_file_mixed_2_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  534. two_file_mixed_2_shared_test_LDADD = two_file_shared_mixed_1.so two_file_shared_2.so
  535. check_PROGRAMS += two_file_mixed_pie_test
  536. two_file_mixed_pie_test: two_file_test_1.o two_file_test_1b_pie.o \
  537. two_file_test_main_pie.o two_file_shared_2.so gcctestdir/ld
  538. $(CXXLINK) -Bgcctestdir/ -Wl,-R,. -pie two_file_test_1.o two_file_test_1b_pie.o two_file_test_main_pie.o two_file_shared_2.so
  539. endif FN_PTRS_IN_SO_WITHOUT_PIC
  540. check_PROGRAMS += two_file_strip_test
  541. two_file_strip_test: two_file_test
  542. $(TEST_STRIP) -o two_file_strip_test two_file_test
  543. check_PROGRAMS += two_file_same_shared_strip_test
  544. two_file_same_shared_strip_test_SOURCES = two_file_test_main.cc
  545. two_file_same_shared_strip_test_DEPENDENCIES = \
  546. gcctestdir/ld two_file_shared_strip.so
  547. two_file_same_shared_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R.
  548. two_file_same_shared_strip_test_LDADD = two_file_shared_strip.so
  549. two_file_shared_strip.so: two_file_shared.so
  550. $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
  551. check_PROGRAMS += common_test_1
  552. common_test_1_SOURCES = common_test_1.c
  553. common_test_1_DEPENDENCIES = gcctestdir/ld
  554. common_test_1_LDFLAGS = -Bgcctestdir/
  555. common_test_1_LDADD =
  556. check_PROGRAMS += common_test_2
  557. common_test_2_SOURCES = common_test_1.c
  558. common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
  559. common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  560. common_test_2_LDADD = common_test_2.so common_test_3.so
  561. common_test_2_pic.o: common_test_2.c
  562. $(COMPILE) -c -fpic -o $@ $<
  563. common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
  564. $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
  565. common_test_3_pic.o: common_test_3.c
  566. $(COMPILE) -c -fpic -o $@ $<
  567. common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
  568. $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
  569. check_PROGRAMS += exception_test
  570. check_PROGRAMS += exception_shared_1_test
  571. check_PROGRAMS += exception_shared_2_test
  572. check_PROGRAMS += exception_same_shared_test
  573. check_PROGRAMS += exception_separate_shared_12_test
  574. check_PROGRAMS += exception_separate_shared_21_test
  575. exception_test_1_pic.o: exception_test_1.cc
  576. $(CXXCOMPILE) -c -fpic -o $@ $<
  577. exception_test_2_pic.o: exception_test_2.cc
  578. $(CXXCOMPILE) -c -fpic -o $@ $<
  579. exception_shared_1.so: exception_test_1_pic.o gcctestdir/ld
  580. $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o
  581. exception_shared_2.so: exception_test_2_pic.o gcctestdir/ld
  582. $(CXXLINK) -Bgcctestdir/ -shared exception_test_2_pic.o
  583. exception_shared.so: exception_test_1_pic.o exception_test_2_pic.o gcctestdir/ld
  584. $(CXXLINK) -Bgcctestdir/ -shared exception_test_1_pic.o exception_test_2_pic.o
  585. exception_test_SOURCES = \
  586. exception_test_main.cc \
  587. exception_test_1.cc \
  588. exception_test_2.cc \
  589. exception_test.h
  590. exception_test_DEPENDENCIES = gcctestdir/ld
  591. exception_test_LDFLAGS = -Bgcctestdir/
  592. exception_test_LDADD =
  593. if HAVE_STATIC
  594. check_PROGRAMS += exception_static_test
  595. exception_static_test_SOURCES = $(exception_test_SOURCES)
  596. exception_static_test_DEPENDENCIES = $(exception_test_DEPENDENCIES)
  597. exception_static_test_LDFLAGS = $(exception_test_LDFLAGS) -static
  598. exception_static_test_LDADD = $(exception_test_LDADD)
  599. endif
  600. exception_shared_1_test_SOURCES = exception_test_2.cc exception_test_main.cc
  601. exception_shared_1_test_DEPENDENCIES = gcctestdir/ld exception_shared_1.so
  602. exception_shared_1_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  603. exception_shared_1_test_LDADD = exception_shared_1.so
  604. exception_shared_2_test_SOURCES = exception_test_1.cc exception_test_main.cc
  605. exception_shared_2_test_DEPENDENCIES = gcctestdir/ld exception_shared_2.so
  606. exception_shared_2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  607. exception_shared_2_test_LDADD = exception_shared_2.so
  608. exception_same_shared_test_SOURCES = exception_test_main.cc
  609. exception_same_shared_test_DEPENDENCIES = gcctestdir/ld exception_shared.so
  610. exception_same_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  611. exception_same_shared_test_LDADD = exception_shared.so
  612. exception_separate_shared_12_test_SOURCES = exception_test_main.cc
  613. exception_separate_shared_12_test_DEPENDENCIES = \
  614. gcctestdir/ld exception_shared_1.so exception_shared_2.so
  615. exception_separate_shared_12_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
  616. -Wl,--no-as-needed
  617. exception_separate_shared_12_test_LDADD = \
  618. exception_shared_1.so exception_shared_2.so
  619. exception_separate_shared_21_test_SOURCES = exception_test_main.cc
  620. exception_separate_shared_21_test_DEPENDENCIES = \
  621. gcctestdir/ld exception_shared_1.so exception_shared_2.so
  622. exception_separate_shared_21_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,. \
  623. -Wl,--no-as-needed
  624. exception_separate_shared_21_test_LDADD = \
  625. exception_shared_2.so exception_shared_1.so
  626. check_PROGRAMS += weak_test
  627. weak_test_SOURCES = weak_test.cc
  628. weak_test_DEPENDENCIES = gcctestdir/ld
  629. weak_test_LDFLAGS = -Bgcctestdir/
  630. weak_test_LDADD =
  631. check_PROGRAMS += weak_undef_test
  632. MOSTLYCLEANFILES += alt/weak_undef_lib.so
  633. weak_undef_test_SOURCES = weak_undef_test.cc
  634. weak_undef_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib.so alt/weak_undef_lib.so
  635. weak_undef_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
  636. weak_undef_test_LDADD = -L . weak_undef_lib.so
  637. weak_undef_file1.o: weak_undef_file1.cc
  638. $(CXXCOMPILE) -c -fpic -o $@ $<
  639. weak_undef_file2.o: weak_undef_file2.cc
  640. $(CXXCOMPILE) -c -fpic -o $@ $<
  641. weak_undef_lib.so: weak_undef_file1.o
  642. $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1.o
  643. alt/weak_undef_lib.so: weak_undef_file2.o
  644. test -d alt || mkdir -p alt
  645. $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2.o
  646. check_PROGRAMS += weak_undef_test_2
  647. weak_undef_test_2_SOURCES = weak_undef_test_2.cc
  648. weak_undef_test_2_DEPENDENCIES = gcctestdir/ld libweak_undef_2.a
  649. weak_undef_test_2_LDFLAGS = -Bgcctestdir/ -u weak_undef_2
  650. weak_undef_test_2_LDADD = -L . -lweak_undef_2
  651. MOSTLYCLEANFILES += libweak_undef_2.a
  652. libweak_undef_2.a: weak_undef_file3.o weak_undef_file4.o
  653. $(TEST_AR) rc $@ $^
  654. weak_undef_file3.o: weak_undef_file3.cc
  655. $(CXXCOMPILE) -c -o $@ $<
  656. weak_undef_file4.o: weak_undef_file4.cc
  657. $(CXXCOMPILE) -c -o $@ $<
  658. if FN_PTRS_IN_SO_WITHOUT_PIC
  659. check_PROGRAMS += weak_undef_nonpic_test
  660. MOSTLYCLEANFILES += alt/weak_undef_lib_nonpic.so
  661. weak_undef_nonpic_test_SOURCES = weak_undef_test.cc
  662. weak_undef_nonpic_test_DEPENDENCIES = gcctestdir/ld weak_undef_lib_nonpic.so alt/weak_undef_lib_nonpic.so
  663. weak_undef_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,alt
  664. weak_undef_nonpic_test_LDADD = -L . weak_undef_lib_nonpic.so
  665. weak_undef_file1_nonpic.o: weak_undef_file1.cc
  666. $(CXXCOMPILE) -c -o $@ $<
  667. weak_undef_file2_nonpic.o: weak_undef_file2.cc
  668. $(CXXCOMPILE) -c -o $@ $<
  669. weak_undef_lib_nonpic.so: weak_undef_file1_nonpic.o
  670. $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file1_nonpic.o -Wl,-z,notext
  671. alt/weak_undef_lib_nonpic.so: weak_undef_file2_nonpic.o
  672. test -d alt || mkdir -p alt
  673. $(CXXLINK) -Bgcctestdir/ -shared weak_undef_file2_nonpic.o -Wl,-z,notext
  674. endif FN_PTRS_IN_SO_WITHOUT_PIC
  675. check_PROGRAMS += weak_alias_test
  676. weak_alias_test_SOURCES = weak_alias_test_main.cc
  677. weak_alias_test_DEPENDENCIES = \
  678. gcctestdir/ld weak_alias_test_1.so weak_alias_test_2.so \
  679. weak_alias_test_3.o weak_alias_test_4.so weak_alias_test_5.so
  680. weak_alias_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  681. weak_alias_test_LDADD = \
  682. weak_alias_test_1.so weak_alias_test_2.so weak_alias_test_3.o \
  683. weak_alias_test_4.so weak_alias_test_5.so
  684. weak_alias_test_1_pic.o: weak_alias_test_1.cc
  685. $(CXXCOMPILE) -c -fpic -o $@ $<
  686. weak_alias_test_1.so: weak_alias_test_1_pic.o gcctestdir/ld
  687. $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_1_pic.o
  688. weak_alias_test_2_pic.o: weak_alias_test_2.cc
  689. $(CXXCOMPILE) -c -fpic -o $@ $<
  690. weak_alias_test_2.so: weak_alias_test_2_pic.o gcctestdir/ld
  691. $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_2_pic.o
  692. weak_alias_test_3.o: weak_alias_test_3.cc
  693. $(CXXCOMPILE) -c -o $@ $<
  694. weak_alias_test_4_pic.o: weak_alias_test_4.cc
  695. $(CXXCOMPILE) -c -fpic -o $@ $<
  696. weak_alias_test_4.so: weak_alias_test_4_pic.o gcctestdir/ld
  697. $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_4_pic.o
  698. weak_alias_test_5_pic.o: weak_alias_test_5.cc
  699. $(CXXCOMPILE) -c -fpic -o $@ $<
  700. weak_alias_test_5.so: weak_alias_test_5_pic.o $(srcdir)/weak_alias_test.script gcctestdir/ld
  701. $(CXXLINK) -Bgcctestdir/ -shared weak_alias_test_5_pic.o \
  702. -Wl,--version-script,$(srcdir)/weak_alias_test.script
  703. check_SCRIPTS += weak_plt.sh
  704. check_PROGRAMS += weak_plt
  705. check_DATA += weak_plt_shared.so
  706. weak_plt_main_pic.o: weak_plt_main.cc
  707. $(CXXCOMPILE) -c -fpic -o $@ $<
  708. weak_plt: weak_plt_main_pic.o gcctestdir/ld
  709. $(CXXLINK) -Bgcctestdir/ weak_plt_main_pic.o
  710. weak_plt_shared_pic.o: weak_plt_shared.cc
  711. $(CXXCOMPILE) -c -fpic -o $@ $<
  712. weak_plt_shared.so: weak_plt_shared_pic.o gcctestdir/ld
  713. $(CXXLINK) -Bgcctestdir/ -shared weak_plt_shared_pic.o
  714. check_PROGRAMS += copy_test
  715. copy_test_SOURCES = copy_test.cc
  716. copy_test_DEPENDENCIES = gcctestdir/ld copy_test_1.so copy_test_2.so
  717. copy_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  718. copy_test_LDADD = copy_test_1.so copy_test_2.so
  719. copy_test_1_pic.o: copy_test_1.cc
  720. $(CXXCOMPILE) -c -fpic -o $@ $<
  721. copy_test_1.so: gcctestdir/ld copy_test_1_pic.o
  722. $(CXXLINK) -Bgcctestdir/ -shared copy_test_1_pic.o
  723. copy_test_2_pic.o: copy_test_2.cc
  724. $(CXXCOMPILE) -c -fpic -o $@ $<
  725. copy_test_2.so: gcctestdir/ld copy_test_2_pic.o
  726. $(CXXLINK) -Bgcctestdir/ -shared copy_test_2_pic.o
  727. if TLS
  728. check_PROGRAMS += tls_test
  729. check_PROGRAMS += tls_pic_test
  730. check_PROGRAMS += tls_pie_test
  731. check_PROGRAMS += tls_pie_pic_test
  732. check_PROGRAMS += tls_shared_test
  733. check_PROGRAMS += tls_shared_ie_test
  734. check_PROGRAMS += tls_shared_gd_to_ie_test
  735. tls_test_pic.o: tls_test.cc
  736. $(CXXCOMPILE) -c -fpic -o $@ $<
  737. tls_test_file2_pic.o: tls_test_file2.cc
  738. $(CXXCOMPILE) -c -fpic -o $@ $<
  739. tls_test_c_pic.o: tls_test_c.c
  740. $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
  741. tls_test_shared.so: tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o gcctestdir/ld
  742. $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -Wl,-z,defs
  743. tls_test_shared2.so: tls_test_file2_pic.o gcctestdir/ld
  744. $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_pic.o
  745. tls_test_pic_ie.o: tls_test.cc
  746. $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
  747. tls_test_file2_pic_ie.o: tls_test_file2.cc
  748. $(CXXCOMPILE) -c -fpic -ftls-model=initial-exec -o $@ $<
  749. tls_test_c_pic_ie.o: tls_test_c.c
  750. $(COMPILE) -c -fpic -ftls-model=initial-exec $(TLS_TEST_C_CFLAGS) -o $@ $<
  751. tls_test_ie_shared.so: tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o gcctestdir/ld
  752. $(CXXLINK) -Bgcctestdir/ -shared tls_test_pic_ie.o tls_test_file2_pic_ie.o tls_test_c_pic_ie.o
  753. tls_test_SOURCES = tls_test.cc tls_test_file2.cc tls_test_main.cc tls_test.h
  754. tls_test_DEPENDENCIES = gcctestdir/ld tls_test_c.o
  755. tls_test_LDFLAGS = -Bgcctestdir/
  756. tls_test_LDADD = tls_test_c.o -lpthread
  757. tls_test_c.o: tls_test_c.c
  758. $(COMPILE) -c $(TLS_TEST_C_CFLAGS) -o $@ $<
  759. tls_pic_test_SOURCES = tls_test_main.cc
  760. tls_pic_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o tls_test_file2_pic.o \
  761. tls_test_c_pic.o
  762. tls_pic_test_LDFLAGS = -Bgcctestdir/
  763. tls_pic_test_LDADD = tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o \
  764. -lpthread
  765. tls_test_main_pie.o: tls_test_main.cc tls_test.h
  766. $(CXXCOMPILE) -c -fpie -o $@ $<
  767. tls_test_pie.o: tls_test.cc tls_test.h
  768. $(CXXCOMPILE) -c -fpie -o $@ $<
  769. tls_test_file2_pie.o: tls_test_file2.cc tls_test.h
  770. $(CXXCOMPILE) -c -fpie -o $@ $<
  771. tls_test_c_pie.o: tls_test_c.c
  772. $(COMPILE) -c -fpic $(TLS_TEST_C_CFLAGS) -o $@ $<
  773. tls_pie_test: tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o \
  774. tls_test_c_pie.o gcctestdir/ld
  775. $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pie.o tls_test_file2_pie.o tls_test_c_pie.o -lpthread
  776. check_SCRIPTS += tls_pie_test.sh
  777. check_DATA += tls_pie_test.stdout
  778. tls_pie_test.stdout: tls_pie_test
  779. $(TEST_READELF) -rW $< > $@ 2>/dev/null
  780. tls_pie_pic_test: tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o \
  781. tls_test_c_pic.o gcctestdir/ld
  782. $(CXXLINK) -Bgcctestdir/ -pie tls_test_main_pie.o tls_test_pic.o tls_test_file2_pic.o tls_test_c_pic.o -lpthread
  783. tls_shared_test_SOURCES = tls_test_main.cc
  784. tls_shared_test_DEPENDENCIES = gcctestdir/ld tls_test_shared.so
  785. tls_shared_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  786. tls_shared_test_LDADD = tls_test_shared.so -lpthread
  787. tls_shared_ie_test_SOURCES = tls_test_main.cc
  788. tls_shared_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_ie_shared.so
  789. tls_shared_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  790. tls_shared_ie_test_LDADD = tls_test_ie_shared.so -lpthread
  791. tls_shared_gd_to_ie_test_SOURCES = tls_test_main.cc
  792. tls_shared_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_pic.o \
  793. tls_test_c_pic.o tls_test_shared2.so
  794. tls_shared_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  795. tls_shared_gd_to_ie_test_LDADD = tls_test_pic.o tls_test_c_pic.o \
  796. tls_test_shared2.so -lpthread
  797. if TLS_GNU2_DIALECT
  798. check_PROGRAMS += tls_shared_gnu2_gd_to_ie_test
  799. tls_test_gnu2.o: tls_test.cc
  800. $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
  801. tls_test_file2_gnu2.o: tls_test_file2.cc
  802. $(CXXCOMPILE) -c -fpic -mtls-dialect=gnu2 -o $@ $<
  803. tls_test_c_gnu2.o: tls_test_c.c
  804. $(COMPILE) -c -fpic -mtls-dialect=gnu2 $(TLS_TEST_C_CFLAGS) -o $@ $<
  805. tls_test_gnu2_shared2.so: tls_test_file2_gnu2.o gcctestdir/ld
  806. $(CXXLINK) -Bgcctestdir/ -shared tls_test_file2_gnu2.o
  807. tls_shared_gnu2_gd_to_ie_test_SOURCES = tls_test_main.cc
  808. tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2.o \
  809. tls_test_c_gnu2.o tls_test_gnu2_shared2.so
  810. tls_shared_gnu2_gd_to_ie_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  811. tls_shared_gnu2_gd_to_ie_test_LDADD = tls_test_gnu2.o tls_test_c_gnu2.o \
  812. tls_test_gnu2_shared2.so -lpthread
  813. if TLS_DESCRIPTORS
  814. check_PROGRAMS += tls_shared_gnu2_test
  815. tls_test_gnu2_shared.so: tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o gcctestdir/ld
  816. $(CXXLINK) -Bgcctestdir/ -shared tls_test_gnu2.o tls_test_file2_gnu2.o tls_test_c_gnu2.o
  817. tls_shared_gnu2_test_SOURCES = tls_test_main.cc
  818. tls_shared_gnu2_test_DEPENDENCIES = gcctestdir/ld tls_test_gnu2_shared.so
  819. tls_shared_gnu2_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  820. tls_shared_gnu2_test_LDADD = tls_test_gnu2_shared.so -lpthread
  821. endif TLS_DESCRIPTORS
  822. endif TLS_GNU2_DIALECT
  823. if HAVE_STATIC
  824. if STATIC_TLS
  825. check_PROGRAMS += tls_static_test
  826. check_PROGRAMS += tls_static_pic_test
  827. tls_static_test_SOURCES = $(tls_test_SOURCES)
  828. tls_static_test_DEPENDENCIES = $(tls_test_DEPENDENCIES)
  829. tls_static_test_LDFLAGS = $(tls_test_LDFLAGS) -static
  830. tls_static_test_LDADD = $(tls_test_LDADD)
  831. tls_static_pic_test_SOURCES = $(tls_pic_test_SOURCES)
  832. tls_static_pic_test_DEPENDENCIES = $(tls_pic_test_DEPENDENCIES)
  833. tls_static_pic_test_LDFLAGS = $(tls_pic_test_LDFLAGS) -static
  834. tls_static_pic_test_LDADD = $(tls_pic_test_LDADD)
  835. endif
  836. endif
  837. if FN_PTRS_IN_SO_WITHOUT_PIC
  838. check_PROGRAMS += tls_shared_nonpic_test
  839. tls_test_shared_nonpic.so: tls_test.o tls_test_file2.o tls_test_c.o gcctestdir/ld
  840. $(CXXLINK) -Bgcctestdir/ -shared tls_test.o tls_test_file2.o tls_test_c.o -Wl,-z,notext
  841. tls_shared_nonpic_test_SOURCES = tls_test_main.cc
  842. tls_shared_nonpic_test_DEPENDENCIES = gcctestdir/ld tls_test_shared_nonpic.so
  843. tls_shared_nonpic_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  844. tls_shared_nonpic_test_LDADD = tls_test_shared_nonpic.so -lpthread
  845. endif FN_PTRS_IN_SO_WITHOUT_PIC
  846. endif TLS
  847. if DEFAULT_TARGET_X86_64
  848. check_SCRIPTS += x86_64_mov_to_lea.sh
  849. check_DATA += x86_64_mov_to_lea1.stdout x86_64_mov_to_lea2.stdout \
  850. x86_64_mov_to_lea3.stdout x86_64_mov_to_lea4.stdout \
  851. x86_64_mov_to_lea5.stdout x86_64_mov_to_lea6.stdout \
  852. x86_64_mov_to_lea7.stdout x86_64_mov_to_lea8.stdout \
  853. x86_64_mov_to_lea9.stdout x86_64_mov_to_lea10.stdout \
  854. x86_64_mov_to_lea11.stdout x86_64_mov_to_lea12.stdout \
  855. x86_64_mov_to_lea13.stdout x86_64_mov_to_lea14.stdout
  856. MOSTLYCLEANFILES += x86_64_mov_to_lea1 x86_64_mov_to_lea2 \
  857. x86_64_mov_to_lea3 x86_64_mov_to_lea4 x86_64_mov_to_lea5 \
  858. x86_64_mov_to_lea6 x86_64_mov_to_lea7 x86_64_mov_to_lea8 \
  859. x86_64_mov_to_lea9 x86_64_mov_to_lea10 x86_64_mov_to_lea11 \
  860. x86_64_mov_to_lea12 x86_64_mov_to_lea13 x86_64_mov_to_lea14
  861. x86_64_mov_to_lea1.o: x86_64_mov_to_lea1.s
  862. $(TEST_AS) --64 -o $@ $<
  863. x86_64_mov_to_lea2.o: x86_64_mov_to_lea1.s
  864. $(TEST_AS) --x32 -o $@ $<
  865. x86_64_mov_to_lea3.o: x86_64_mov_to_lea2.s
  866. $(TEST_AS) --x32 -o $@ $<
  867. x86_64_mov_to_lea4.o: x86_64_mov_to_lea2.s
  868. $(TEST_AS) --64 -o $@ $<
  869. x86_64_mov_to_lea5.o: x86_64_mov_to_lea3.s
  870. $(TEST_AS) --x32 -o $@ $<
  871. x86_64_mov_to_lea6.o: x86_64_mov_to_lea3.s
  872. $(TEST_AS) --64 -o $@ $<
  873. x86_64_mov_to_lea7.o: x86_64_mov_to_lea4.s
  874. $(TEST_AS) --x32 -o $@ $<
  875. x86_64_mov_to_lea8.o: x86_64_mov_to_lea4.s
  876. $(TEST_AS) --64 -o $@ $<
  877. x86_64_mov_to_lea1: x86_64_mov_to_lea1.o
  878. ../ld-new -Bsymbolic -shared -melf_x86_64 -o $@ $<
  879. x86_64_mov_to_lea2: x86_64_mov_to_lea1.o
  880. ../ld-new -pie -melf_x86_64 -o $@ $<
  881. x86_64_mov_to_lea3: x86_64_mov_to_lea1.o
  882. ../ld-new -melf_x86_64 -o $@ $<
  883. x86_64_mov_to_lea4: x86_64_mov_to_lea2.o
  884. ../ld-new -Bsymbolic -shared -melf32_x86_64 -o $@ $<
  885. x86_64_mov_to_lea5: x86_64_mov_to_lea2.o
  886. ../ld-new -pie -melf32_x86_64 -o $@ $<
  887. x86_64_mov_to_lea6: x86_64_mov_to_lea2.o
  888. ../ld-new -melf32_x86_64 -o $@ $<
  889. x86_64_mov_to_lea7: x86_64_mov_to_lea3.o
  890. ../ld-new -melf32_x86_64 -pie -o $@ $<
  891. x86_64_mov_to_lea8: x86_64_mov_to_lea4.o
  892. ../ld-new -melf_x86_64 -pie -o $@ $<
  893. x86_64_mov_to_lea9: x86_64_mov_to_lea5.o
  894. ../ld-new -melf32_x86_64 -o $@ $<
  895. x86_64_mov_to_lea10: x86_64_mov_to_lea6.o
  896. ../ld-new -melf_x86_64 -o $@ $<
  897. x86_64_mov_to_lea11: x86_64_mov_to_lea2.o
  898. ../ld-new -melf32_x86_64 -shared -o $@ $<
  899. x86_64_mov_to_lea12: x86_64_mov_to_lea1.o
  900. ../ld-new -melf_x86_64 -shared -o $@ $<
  901. x86_64_mov_to_lea13: x86_64_mov_to_lea7.o
  902. ../ld-new -melf32_x86_64 -shared -o $@ $<
  903. x86_64_mov_to_lea14: x86_64_mov_to_lea8.o
  904. ../ld-new -melf_x86_64 -shared -o $@ $<
  905. x86_64_mov_to_lea1.stdout: x86_64_mov_to_lea1
  906. $(TEST_OBJDUMP) -dw $< > $@
  907. x86_64_mov_to_lea2.stdout: x86_64_mov_to_lea2
  908. $(TEST_OBJDUMP) -dw $< > $@
  909. x86_64_mov_to_lea3.stdout: x86_64_mov_to_lea3
  910. $(TEST_OBJDUMP) -dw $< > $@
  911. x86_64_mov_to_lea4.stdout: x86_64_mov_to_lea4
  912. $(TEST_OBJDUMP) -dw $< > $@
  913. x86_64_mov_to_lea5.stdout: x86_64_mov_to_lea5
  914. $(TEST_OBJDUMP) -dw $< > $@
  915. x86_64_mov_to_lea6.stdout: x86_64_mov_to_lea6
  916. $(TEST_OBJDUMP) -dw $< > $@
  917. x86_64_mov_to_lea7.stdout: x86_64_mov_to_lea7
  918. $(TEST_OBJDUMP) -dw $< > $@
  919. x86_64_mov_to_lea8.stdout: x86_64_mov_to_lea8
  920. $(TEST_OBJDUMP) -dw $< > $@
  921. x86_64_mov_to_lea9.stdout: x86_64_mov_to_lea9
  922. $(TEST_OBJDUMP) -dw $< > $@
  923. x86_64_mov_to_lea10.stdout: x86_64_mov_to_lea10
  924. $(TEST_OBJDUMP) -dw $< > $@
  925. x86_64_mov_to_lea11.stdout: x86_64_mov_to_lea11
  926. $(TEST_OBJDUMP) -dw $< > $@
  927. x86_64_mov_to_lea12.stdout: x86_64_mov_to_lea12
  928. $(TEST_OBJDUMP) -dw $< > $@
  929. x86_64_mov_to_lea13.stdout: x86_64_mov_to_lea13
  930. $(TEST_OBJDUMP) -dw $< > $@
  931. x86_64_mov_to_lea14.stdout: x86_64_mov_to_lea14
  932. $(TEST_OBJDUMP) -dw $< > $@
  933. endif DEFAULT_TARGET_X86_64
  934. if DEFAULT_TARGET_I386
  935. check_SCRIPTS += i386_mov_to_lea.sh
  936. check_DATA += i386_mov_to_lea1.stdout i386_mov_to_lea2.stdout \
  937. i386_mov_to_lea3.stdout i386_mov_to_lea4.stdout \
  938. i386_mov_to_lea5.stdout i386_mov_to_lea6.stdout \
  939. i386_mov_to_lea7.stdout i386_mov_to_lea8.stdout
  940. MOSTLYCLEANFILES += i386_mov_to_lea1 i386_mov_to_lea2 i386_mov_to_lea3 \
  941. i386_mov_to_lea4 i386_mov_to_lea5 i386_mov_to_lea6 \
  942. i386_mov_to_lea7 i386_mov_to_lea8
  943. i386_mov_to_lea1.o: i386_mov_to_lea1.s
  944. $(TEST_AS) --32 -o $@ $<
  945. i386_mov_to_lea2.o: i386_mov_to_lea2.s
  946. $(TEST_AS) --32 -o $@ $<
  947. i386_mov_to_lea3.o: i386_mov_to_lea3.s
  948. $(TEST_AS) --32 -o $@ $<
  949. i386_mov_to_lea4.o: i386_mov_to_lea4.s
  950. $(TEST_AS) --32 -o $@ $<
  951. i386_mov_to_lea5.o: i386_mov_to_lea5.s
  952. $(TEST_AS) --32 -o $@ $<
  953. i386_mov_to_lea1: i386_mov_to_lea1.o
  954. ../ld-new -Bsymbolic -shared -melf_i386 -o $@ $<
  955. i386_mov_to_lea2: i386_mov_to_lea1.o
  956. ../ld-new -pie -melf_i386 -o $@ $<
  957. i386_mov_to_lea3: i386_mov_to_lea1.o
  958. ../ld-new -melf_i386 -o $@ $<
  959. i386_mov_to_lea4: i386_mov_to_lea1.o
  960. ../ld-new -melf_i386 -shared -o $@ $<
  961. i386_mov_to_lea5: i386_mov_to_lea2.o
  962. ../ld-new -melf_i386 -shared -o $@ $<
  963. i386_mov_to_lea6: i386_mov_to_lea3.o
  964. ../ld-new -melf_i386 -shared -o $@ $<
  965. i386_mov_to_lea7: i386_mov_to_lea4.o
  966. ../ld-new -melf_i386 -shared -o $@ $<
  967. i386_mov_to_lea8: i386_mov_to_lea5.o
  968. ../ld-new -melf_i386 -shared -o $@ $<
  969. i386_mov_to_lea1.stdout: i386_mov_to_lea1
  970. $(TEST_OBJDUMP) -dw $< > $@
  971. i386_mov_to_lea2.stdout: i386_mov_to_lea2
  972. $(TEST_OBJDUMP) -dw $< > $@
  973. i386_mov_to_lea3.stdout: i386_mov_to_lea3
  974. $(TEST_OBJDUMP) -dw $< > $@
  975. i386_mov_to_lea4.stdout: i386_mov_to_lea4
  976. $(TEST_OBJDUMP) -dw $< > $@
  977. i386_mov_to_lea5.stdout: i386_mov_to_lea5
  978. $(TEST_OBJDUMP) -dw $< > $@
  979. i386_mov_to_lea6.stdout: i386_mov_to_lea6
  980. $(TEST_OBJDUMP) -dw $< > $@
  981. i386_mov_to_lea7.stdout: i386_mov_to_lea7
  982. $(TEST_OBJDUMP) -dw $< > $@
  983. i386_mov_to_lea8.stdout: i386_mov_to_lea8
  984. $(TEST_OBJDUMP) -dw $< > $@
  985. endif DEFAULT_TARGET_I386
  986. check_PROGRAMS += many_sections_test
  987. many_sections_test_SOURCES = many_sections_test.cc
  988. many_sections_test_DEPENDENCIES = gcctestdir/ld
  989. many_sections_test_LDFLAGS = -Bgcctestdir/ -rdynamic
  990. many_sections_test_LDADD =
  991. BUILT_SOURCES += many_sections_define.h
  992. MOSTLYCLEANFILES += many_sections_define.h
  993. many_sections_define.h:
  994. (for i in `seq 1 70000`; do \
  995. echo "int var_$$i __attribute__((section(\"section_$$i\"))) = $$i;"; \
  996. done) > $@.tmp
  997. mv -f $@.tmp $@
  998. BUILT_SOURCES += many_sections_check.h
  999. MOSTLYCLEANFILES += many_sections_check.h
  1000. many_sections_check.h:
  1001. (for i in `seq 1 1000 70000`; do \
  1002. echo "assert(var_$$i == $$i);"; \
  1003. done) > $@.tmp
  1004. mv -f $@.tmp $@
  1005. check_PROGRAMS += many_sections_r_test
  1006. many_sections_r_test.o: many_sections_test.o gcctestdir/ld
  1007. gcctestdir/ld -r -o $@ many_sections_test.o
  1008. many_sections_r_test: many_sections_r_test.o gcctestdir/ld
  1009. $(CXXLINK) -Bgcctestdir/ many_sections_r_test.o $(LIBS)
  1010. check_PROGRAMS += initpri1
  1011. initpri1_SOURCES = initpri1.c
  1012. initpri1_DEPENDENCIES = gcctestdir/ld
  1013. initpri1_LDFLAGS = -Bgcctestdir/
  1014. initpri1_LDADD =
  1015. check_PROGRAMS += initpri2
  1016. initpri2_SOURCES = initpri2.c
  1017. initpri2_DEPENDENCIES = gcctestdir/ld
  1018. initpri2_LDFLAGS = -Bgcctestdir/ -Wl,--ctors-in-init-array
  1019. initpri2_LDADD =
  1020. check_PROGRAMS += initpri3a
  1021. initpri3a_SOURCES = initpri3.c
  1022. initpri3a_DEPENDENCIES = gcctestdir/ld
  1023. initpri3a_LDFLAGS = -Bgcctestdir/
  1024. initpri3a_LDADD =
  1025. # This test fails on targets not using .ctors and .dtors sections (e.g. ARM
  1026. # EABI). Given that gcc is moving towards using .init_array in all cases,
  1027. # this test is commented out. A better fix would be checking whether gcc
  1028. # uses .ctors or .init_array sections in configure.
  1029. # check_PROGRAMS += initpri3b
  1030. # initpri3b_SOURCES = initpri3.c
  1031. # initpri3b_DEPENDENCIES = gcctestdir/ld
  1032. # initpri3b_LDFLAGS = -Bgcctestdir/ -Wl,--no-ctors-in-init-array
  1033. # initpri3b_LDADD =
  1034. # Test --detect-odr-violations
  1035. check_SCRIPTS += debug_msg.sh
  1036. # Create the data files that debug_msg.sh analyzes.
  1037. check_DATA += debug_msg.err
  1038. MOSTLYCLEANFILES += debug_msg.err
  1039. debug_msg.o: debug_msg.cc
  1040. $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/debug_msg.cc
  1041. odr_violation1.o: odr_violation1.cc
  1042. $(CXXCOMPILE) -O0 -g -c -w -o $@ $(srcdir)/odr_violation1.cc
  1043. # Compile with different optimization flags to check that rearranged
  1044. # instructions don't cause a false positive.
  1045. odr_violation2.o: odr_violation2.cc
  1046. $(CXXCOMPILE) -O2 -g -c -w -o $@ $(srcdir)/odr_violation2.cc
  1047. debug_msg.err: debug_msg.o odr_violation1.o odr_violation2.o gcctestdir/ld
  1048. @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o "2>$@"
  1049. @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg debug_msg.o odr_violation1.o odr_violation2.o 2>$@; \
  1050. then \
  1051. echo 1>&2 "Link of debug_msg should have failed"; \
  1052. rm -f $@; \
  1053. exit 1; \
  1054. fi
  1055. # Test error message when a vtable is undefined.
  1056. check_SCRIPTS += missing_key_func.sh
  1057. check_DATA += missing_key_func.err
  1058. MOSTLYCLEANFILES += missing_key_func.err
  1059. missing_key_func.o: missing_key_func.cc
  1060. $(CXXCOMPILE) -O0 -g -c -o $@ $(srcdir)/missing_key_func.cc
  1061. missing_key_func.err: missing_key_func.o gcctestdir/ld
  1062. @echo $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o "2>$@"
  1063. @if $(CXXLINK) -Bgcctestdir/ -o missing_key_func missing_key_func.o 2>$@; \
  1064. then \
  1065. echo 1>&2 "Link of missing_key_func should have failed"; \
  1066. rm -f $@; \
  1067. exit 1; \
  1068. fi
  1069. # Check that --detect-odr-violations works with compressed debug sections.
  1070. check_DATA += debug_msg_cdebug.err
  1071. MOSTLYCLEANFILES += debug_msg_cdebug.err
  1072. debug_msg_cdebug.o: debug_msg.cc gcctestdir/as
  1073. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/debug_msg.cc
  1074. odr_violation1_cdebug.o: odr_violation1.cc gcctestdir/as
  1075. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation1.cc
  1076. odr_violation2_cdebug.o: odr_violation2.cc gcctestdir/as
  1077. $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections -c -w -o $@ $(srcdir)/odr_violation2.cc
  1078. debug_msg_cdebug.err: debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o gcctestdir/ld
  1079. @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o "2>$@"
  1080. @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug.o odr_violation1_cdebug.o odr_violation2_cdebug.o 2>$@; \
  1081. then \
  1082. echo 1>&2 "Link of debug_msg_cdebug should have failed"; \
  1083. rm -f $@; \
  1084. exit 1; \
  1085. fi
  1086. check_DATA += debug_msg_cdebug_gabi.err
  1087. MOSTLYCLEANFILES += debug_msg_cdebug_gabi.err
  1088. debug_msg_cdebug_gabi.o: debug_msg.cc gcctestdir/as
  1089. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/debug_msg.cc
  1090. odr_violation1_cdebug_gabi.o: odr_violation1.cc gcctestdir/as
  1091. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation1.cc
  1092. odr_violation2_cdebug_gabi.o: odr_violation2.cc gcctestdir/as
  1093. $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/odr_violation2.cc
  1094. debug_msg_cdebug_gabi.err: debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o gcctestdir/ld
  1095. @echo $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o "2>$@"
  1096. @if $(CXXLINK) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_cdebug_gabi debug_msg_cdebug_gabi.o odr_violation1_cdebug_gabi.o odr_violation2_cdebug_gabi.o 2>$@; \
  1097. then \
  1098. echo 1>&2 "Link of debug_msg_cdebug_gabi should have failed"; \
  1099. rm -f $@; \
  1100. exit 1; \
  1101. fi
  1102. # See if we can also detect problems when we're linking .so's, not .o's.
  1103. check_DATA += debug_msg_so.err
  1104. MOSTLYCLEANFILES += debug_msg_so.err
  1105. debug_msg.so: debug_msg.cc gcctestdir/ld
  1106. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
  1107. odr_violation1.so: odr_violation1.cc gcctestdir/ld
  1108. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
  1109. odr_violation2.so: odr_violation2.cc gcctestdir/ld
  1110. $(CXXCOMPILE) -Bgcctestdir/ -O2 -g -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
  1111. debug_msg_so.err: debug_msg.so odr_violation1.so odr_violation2.so gcctestdir/ld
  1112. @echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so "2>$@"
  1113. @if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_so debug_msg.so odr_violation1.so odr_violation2.so 2>$@; \
  1114. then \
  1115. echo 1>&2 "Link of debug_msg_so should have failed"; \
  1116. rm -f $@; \
  1117. exit 1; \
  1118. fi
  1119. # We also want to make sure we do something reasonable when there's no
  1120. # debug info available. For the best test, we use .so's.
  1121. check_DATA += debug_msg_ndebug.err
  1122. MOSTLYCLEANFILES += debug_msg_ndebug.err
  1123. debug_msg_ndebug.so: debug_msg.cc gcctestdir/ld
  1124. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/debug_msg.cc
  1125. odr_violation1_ndebug.so: odr_violation1.cc gcctestdir/ld
  1126. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation1.cc
  1127. odr_violation2_ndebug.so: odr_violation2.cc gcctestdir/ld
  1128. $(CXXCOMPILE) -Bgcctestdir/ -O2 -g0 -shared -fPIC -w -o $@ $(srcdir)/odr_violation2.cc
  1129. debug_msg_ndebug.err: debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so gcctestdir/ld
  1130. @echo $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so -shared-libgcc -Bdynamic -lstdc++ "2>$@"
  1131. @if $(CXXLINK_S) -Bgcctestdir/ -Wl,--detect-odr-violations -o debug_msg_ndebug debug_msg_ndebug.so odr_violation1_ndebug.so odr_violation2_ndebug.so -shared-libgcc -Bdynamic -lstdc++ 2>$@; \
  1132. then \
  1133. echo 1>&2 "Link of debug_msg_ndebug should have failed"; \
  1134. rm -f $@; \
  1135. exit 1; \
  1136. fi
  1137. # Similar to --detect-odr-violations: check for undefined symbols in .so's
  1138. check_SCRIPTS += undef_symbol.sh
  1139. check_DATA += undef_symbol.err
  1140. MOSTLYCLEANFILES += undef_symbol.err
  1141. undef_symbol.o: undef_symbol.cc
  1142. $(CXXCOMPILE) -O0 -g -c -fPIC $<
  1143. undef_symbol.so: undef_symbol.o gcctestdir/ld
  1144. $(CXXLINK) -Bgcctestdir/ -shared undef_symbol.o
  1145. undef_symbol.err: undef_symbol_main.o undef_symbol.so gcctestdir/ld
  1146. @echo $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so "2>$@"
  1147. @if $(CXXLINK) -Bgcctestdir/ -o undef_symbol_test undef_symbol_main.o undef_symbol.so 2>$@; \
  1148. then \
  1149. echo 1>&2 "Link of undef_symbol_test should have failed"; \
  1150. rm -f $@; \
  1151. exit 1; \
  1152. fi
  1153. # Test -o when emitting to a special file (such as something in /dev).
  1154. check_PROGRAMS += flagstest_o_specialfile
  1155. flagstest_o_specialfile: flagstest_debug.o gcctestdir/ld
  1156. $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< 2>&1 | cat > $@
  1157. chmod a+x $@
  1158. test -s $@
  1159. # Test --compress-debug-sections.
  1160. check_PROGRAMS += flagstest_compress_debug_sections_none
  1161. check_DATA += flagstest_compress_debug_sections_none.stdout
  1162. flagstest_compress_debug_sections_none: flagstest_debug.o gcctestdir/ld
  1163. $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=none
  1164. test -s $@
  1165. # Dump DWARF debug sections.
  1166. flagstest_compress_debug_sections_none.stdout: flagstest_compress_debug_sections_none
  1167. $(TEST_READELF) -w $< > $@.tmp
  1168. mv -f $@.tmp $@
  1169. check_PROGRAMS += flagstest_compress_debug_sections
  1170. check_DATA += flagstest_compress_debug_sections.stdout \
  1171. flagstest_compress_debug_sections.cmp \
  1172. flagstest_compress_debug_sections.check
  1173. flagstest_compress_debug_sections: flagstest_debug.o gcctestdir/ld
  1174. $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib
  1175. test -s $@
  1176. # Test --compress-debug-sections with --build-id=tree.
  1177. check_PROGRAMS += flagstest_compress_debug_sections_and_build_id_tree
  1178. flagstest_compress_debug_sections_and_build_id_tree: flagstest_debug.o gcctestdir/ld
  1179. $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib \
  1180. -Wl,--build-id=tree \
  1181. -Wl,--build-id-chunk-size-for-treehash=4096 \
  1182. -Wl,--build-id-min-file-size-for-treehash=0
  1183. test -s $@
  1184. # Dump compressed DWARF debug sections.
  1185. flagstest_compress_debug_sections.stdout: flagstest_compress_debug_sections
  1186. $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
  1187. mv -f $@.tmp $@
  1188. # Check there are compressed DWARF .debug_* sections.
  1189. flagstest_compress_debug_sections.check: flagstest_compress_debug_sections
  1190. $(TEST_READELF) -SW $< | egrep ".debug_.* C *" > $@.tmp
  1191. mv -f $@.tmp $@
  1192. # Compare DWARF debug info.
  1193. flagstest_compress_debug_sections.cmp: flagstest_compress_debug_sections.stdout \
  1194. flagstest_compress_debug_sections_none.stdout
  1195. cmp flagstest_compress_debug_sections.stdout \
  1196. flagstest_compress_debug_sections_none.stdout > $@.tmp
  1197. mv -f $@.tmp $@
  1198. check_PROGRAMS += flagstest_compress_debug_sections_gnu
  1199. check_DATA += flagstest_compress_debug_sections_gnu.stdout \
  1200. flagstest_compress_debug_sections_gnu.cmp \
  1201. flagstest_compress_debug_sections_gnu.check
  1202. flagstest_compress_debug_sections_gnu: flagstest_debug.o gcctestdir/ld
  1203. $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gnu
  1204. test -s $@
  1205. # Dump compressed DWARF debug sections.
  1206. flagstest_compress_debug_sections_gnu.stdout: flagstest_compress_debug_sections_gnu
  1207. $(TEST_READELF) -w $< | sed -e "s/.zdebug_/.debug_/" > $@.tmp
  1208. mv -f $@.tmp $@
  1209. # Check there are compressed DWARF .zdebug_* sections.
  1210. flagstest_compress_debug_sections_gnu.check: flagstest_compress_debug_sections_gnu
  1211. $(TEST_READELF) -SW $< | grep ".zdebug_" > $@.tmp
  1212. mv -f $@.tmp $@
  1213. # Compare DWARF debug info.
  1214. flagstest_compress_debug_sections_gnu.cmp: flagstest_compress_debug_sections_gnu.stdout \
  1215. flagstest_compress_debug_sections_none.stdout
  1216. cmp flagstest_compress_debug_sections_gnu.stdout \
  1217. flagstest_compress_debug_sections_none.stdout > $@.tmp
  1218. mv -f $@.tmp $@
  1219. check_PROGRAMS += flagstest_compress_debug_sections_gabi
  1220. check_DATA += flagstest_compress_debug_sections_gabi.stdout \
  1221. flagstest_compress_debug_sections_gabi.cmp \
  1222. flagstest_compress_debug_sections_gabi.check
  1223. flagstest_compress_debug_sections_gabi: flagstest_debug.o gcctestdir/ld
  1224. $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,--compress-debug-sections=zlib-gabi
  1225. test -s $@
  1226. # Dump compressed DWARF debug sections.
  1227. flagstest_compress_debug_sections_gabi.stdout: flagstest_compress_debug_sections_gabi
  1228. $(TEST_READELF) -w $< > $@.tmp
  1229. mv -f $@.tmp $@
  1230. # Check there are compressed DWARF .debug_* sections.
  1231. flagstest_compress_debug_sections_gabi.check: flagstest_compress_debug_sections_gabi
  1232. $(TEST_READELF) -tW $< | grep "COMPRESSED" > $@.tmp
  1233. mv -f $@.tmp $@
  1234. # Compare DWARF debug info.
  1235. flagstest_compress_debug_sections_gabi.cmp: flagstest_compress_debug_sections_gabi.stdout \
  1236. flagstest_compress_debug_sections_none.stdout
  1237. cmp flagstest_compress_debug_sections_gabi.stdout \
  1238. flagstest_compress_debug_sections_none.stdout > $@.tmp
  1239. mv -f $@.tmp $@
  1240. # The specialfile output has a tricky case when we also compress debug
  1241. # sections, because it requires output-file resizing.
  1242. check_PROGRAMS += flagstest_o_specialfile_and_compress_debug_sections
  1243. flagstest_o_specialfile_and_compress_debug_sections: flagstest_debug.o \
  1244. gcctestdir/ld
  1245. $(CXXLINK) -Bgcctestdir/ -o /dev/stdout $< -Wl,--compress-debug-sections=zlib 2>&1 | cat > $@
  1246. chmod a+x $@
  1247. test -s $@
  1248. check_SCRIPTS += pr18689.sh
  1249. check_DATA += pr18689.stdout
  1250. MOSTLYCLEANFILES += pr18689a.o pr18689b.o
  1251. pr18689.stdout: pr18689b.o
  1252. $(TEST_READELF) -SW $< > $@
  1253. pr18689a.o: pr18689.o ../ld-new
  1254. ../ld-new -r -o $@ $<
  1255. pr18689b.o: pr18689a.o ../ld-new
  1256. ../ld-new -r -o $@ $<
  1257. pr18689.o: pr18689.c gcctestdir/as
  1258. $(COMPILE) -Bgcctestdir/ -ggdb3 -g -Wa,--compress-debug-sections=zlib-gabi -c -w -o $@ $(srcdir)/pr18689.c
  1259. # Test -TText and -Tdata.
  1260. check_PROGRAMS += flagstest_o_ttext_1
  1261. flagstest_o_ttext_1: flagstest_debug.o gcctestdir/ld
  1262. $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400000 -Wl,-Tdata,0x800000
  1263. # This version won't be runnable, because there is no way to put the
  1264. # PT_PHDR segment at file offset 0. We just make sure that we can
  1265. # build it without error.
  1266. check_DATA += flagstest_o_ttext_2
  1267. MOSTLYCLEANFILES += flagstest_o_ttext_2
  1268. flagstest_o_ttext_2: flagstest_debug.o gcctestdir/ld
  1269. $(CXXLINK) -Bgcctestdir/ -o $@ $< -Wl,-Ttext,0x400010 -Wl,-Tdata,0x800010
  1270. # Test symbol versioning.
  1271. check_PROGRAMS += ver_test
  1272. ver_test_SOURCES = ver_test_main.cc
  1273. ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
  1274. ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1275. ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
  1276. ver_test_1.so: ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so gcctestdir/ld
  1277. $(CXXLINK) -Bgcctestdir/ -shared ver_test_1.o ver_test_2.so ver_test_3.o ver_test_4.so
  1278. ver_test_2.so: ver_test_2.o $(srcdir)/ver_test_2.script ver_test_4.so gcctestdir/ld
  1279. $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_2.script -Wl,-R,. ver_test_2.o ver_test_4.so
  1280. ver_test_4.so: ver_test_4.o $(srcdir)/ver_test_4.script gcctestdir/ld
  1281. $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o
  1282. ver_test_1.o: ver_test_1.cc
  1283. $(CXXCOMPILE) -c -fpic -o $@ $<
  1284. ver_test_2.o: ver_test_2.cc
  1285. $(CXXCOMPILE) -c -fpic -o $@ $<
  1286. ver_test_3.o: ver_test_3.cc
  1287. $(CXXCOMPILE) -c -fpic -o $@ $<
  1288. ver_test_4.o: ver_test_4.cc
  1289. $(CXXCOMPILE) -c -fpic -o $@ $<
  1290. check_SCRIPTS += ver_test_1.sh
  1291. check_DATA += ver_test_1.syms
  1292. ver_test_1.syms: ver_test_1.so
  1293. $(TEST_READELF) -s $< >$@ 2>/dev/null
  1294. check_PROGRAMS += ver_test_2
  1295. ver_test_2_SOURCES = ver_test_main_2.cc
  1296. ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
  1297. ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1298. ver_test_2_LDADD = ver_test_4.so ver_test_2.so
  1299. check_SCRIPTS += ver_test_2.sh
  1300. check_DATA += ver_test_2.syms
  1301. ver_test_2.syms: ver_test_2
  1302. $(TEST_READELF) -s $< >$@ 2>/dev/null
  1303. check_SCRIPTS += ver_test_4.sh
  1304. check_DATA += ver_test_4.syms
  1305. ver_test_4.syms: ver_test_4.so
  1306. $(TEST_READELF) -s $< >$@ 2>/dev/null
  1307. ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld
  1308. $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so
  1309. ver_test_5.o: ver_test_5.cc
  1310. $(CXXCOMPILE) -c -fpic -o $@ $<
  1311. check_SCRIPTS += ver_test_5.sh
  1312. check_DATA += ver_test_5.syms
  1313. ver_test_5.syms: ver_test_5.so
  1314. $(TEST_READELF) -s $< >$@ 2>/dev/null
  1315. check_PROGRAMS += ver_test_6
  1316. ver_test_6_SOURCES = ver_test_6.c
  1317. ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so
  1318. ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1319. ver_test_6_LDADD = ver_test_2.so
  1320. ver_test_7.so: ver_test_4.o $(srcdir)/ver_test_4.script ver_test_7.o gcctestdir/ld
  1321. $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_4.script ver_test_4.o ver_test_7.o
  1322. ver_test_7.o: ver_test_7.cc
  1323. $(CXXCOMPILE) -c -fpic -o $@ $<
  1324. check_SCRIPTS += ver_test_7.sh
  1325. check_DATA += ver_test_7.syms
  1326. ver_test_7.syms: ver_test_7.so
  1327. $(TEST_READELF) -s $< >$@ 2>/dev/null
  1328. check_PROGRAMS += ver_test_8
  1329. ver_test_8_SOURCES = two_file_test_main.cc
  1330. ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
  1331. ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1332. ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
  1333. ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld
  1334. $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
  1335. ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
  1336. $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
  1337. check_PROGRAMS += ver_test_9
  1338. ver_test_9_SOURCES = ver_test_main.cc
  1339. ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
  1340. ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1341. ver_test_9_LDADD = ver_test_9.so
  1342. ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
  1343. $(CXXLINK) -Bgcctestdir/ -shared -Wl,-R,. ver_test_9.o ver_test_5.so ver_test_4.so
  1344. ver_test_9.o: ver_test_9.cc
  1345. $(CXXCOMPILE) -c -fpic -o $@ $<
  1346. check_SCRIPTS += ver_test_10.sh
  1347. check_DATA += ver_test_10.syms
  1348. ver_test_10.syms: ver_test_10.so
  1349. $(TEST_READELF) -s $< >$@ 2>/dev/null
  1350. ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script
  1351. $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.o
  1352. check_PROGRAMS += ver_test_11
  1353. MOSTLYCLEANFILES += ver_test_11.a
  1354. ver_test_11_SOURCES = ver_test_main_2.cc
  1355. ver_test_11_DEPENDENCIES = gcctestdir/ld ver_test_11.a
  1356. ver_test_11_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1357. ver_test_11_LDADD = ver_test_11.a
  1358. ver_test_11.a: ver_test_1.o ver_test_2.o ver_test_4.o
  1359. $(TEST_AR) rc $@ $^
  1360. check_PROGRAMS += ver_test_12
  1361. ver_test_12_SOURCES = ver_test_main_2.cc
  1362. ver_test_12_DEPENDENCIES = gcctestdir/ld ver_test_12.o
  1363. ver_test_12_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1364. ver_test_12_LDADD = ver_test_12.o
  1365. ver_test_12.o: gcctestdir/ld ver_test_1.o ver_test_2.o ver_test_4.o
  1366. gcctestdir/ld -r -o $@ ver_test_1.o ver_test_2.o ver_test_4.o
  1367. check_SCRIPTS += ver_test_13.sh
  1368. check_DATA += ver_test_13.syms
  1369. ver_test_13.syms: ver_test_13.so
  1370. $(TEST_READELF) -s $< >$@ 2>/dev/null
  1371. ver_test_13.so: gcctestdir/ld ver_test_13.o ver_test_13.script
  1372. $(LINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_13.script ver_test_13.o
  1373. ver_test_13.o: ver_test_13.c
  1374. $(COMPILE) -c -fpic -o $@ $<
  1375. check_PROGRAMS += protected_1
  1376. protected_1_SOURCES = \
  1377. protected_main_1.cc protected_main_2.cc protected_main_3.cc
  1378. protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so
  1379. protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1380. protected_1_LDADD = protected_1.so
  1381. protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
  1382. $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
  1383. protected_1_pic.o: protected_1.cc
  1384. $(CXXCOMPILE) -c -fpic -o $@ $<
  1385. protected_2_pic.o: protected_2.cc
  1386. $(CXXCOMPILE) -c -fpic -o $@ $<
  1387. protected_3_pic.o: protected_3.cc
  1388. $(CXXCOMPILE) -c -fpic -o $@ $<
  1389. check_PROGRAMS += protected_2
  1390. protected_2_SOURCES = protected_main_1.cc protected_3.cc
  1391. protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so
  1392. protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1393. protected_2_LDADD = protected_1.so
  1394. check_DATA += protected_3.err
  1395. MOSTLYCLEANFILES += protected_3.err
  1396. protected_4_pic.o: protected_4.cc
  1397. $(CXXCOMPILE) -c -fpic -o $@ $<
  1398. protected_3.err: protected_4_pic.o gcctestdir/ld
  1399. @echo $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o "2>$@"
  1400. @if $(CXXLINK) -Bgcctestdir/ -shared -o protected_4.so protected_4_pic.o 2>$@; then \
  1401. echo 1>&2 "Link of protected_4.so should have failed"; \
  1402. rm -f $@; \
  1403. exit 1; \
  1404. fi
  1405. check_PROGRAMS += relro_test
  1406. check_SCRIPTS += relro_test.sh
  1407. check_DATA += relro_test.stdout
  1408. relro_test_SOURCES = relro_test_main.cc
  1409. relro_test_DEPENDENCIES = gcctestdir/ld relro_test.so
  1410. relro_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1411. relro_test_LDADD = relro_test.so
  1412. relro_test.so: gcctestdir/ld relro_test_pic.o
  1413. $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro relro_test_pic.o
  1414. relro_test_pic.o: relro_test.cc
  1415. $(CXXCOMPILE) -c -fpic -o $@ $<
  1416. relro_test.stdout: relro_test.so
  1417. $(TEST_READELF) -SlW relro_test.so > relro_test.stdout
  1418. check_PROGRAMS += relro_now_test
  1419. relro_now_test_SOURCES = relro_test_main.cc
  1420. relro_now_test_DEPENDENCIES = gcctestdir/ld relro_now_test.so
  1421. relro_now_test_LDFLAGS = -Bgcctestdir -Wl,-R,. -Wl,-z,relro -Wl,-z,now
  1422. relro_now_test_LDADD = relro_now_test.so
  1423. relro_now_test.so: gcctestdir/ld relro_test_pic.o
  1424. $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-z,now relro_test_pic.o
  1425. check_PROGRAMS += relro_strip_test
  1426. relro_strip_test_SOURCES = relro_test_main.cc
  1427. relro_strip_test_DEPENDENCIES = gcctestdir/ld relro_strip_test.so
  1428. relro_strip_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1429. relro_strip_test_LDADD = relro_strip_test.so
  1430. relro_strip_test.so: relro_test.so
  1431. $(TEST_STRIP) -o $@ $<
  1432. check_PROGRAMS += relro_script_test
  1433. relro_script_test_SOURCES = relro_test_main.cc
  1434. relro_script_test_DEPENDENCIES = gcctestdir/ld relro_script_test.so
  1435. relro_script_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1436. relro_script_test_LDADD = relro_script_test.so
  1437. relro_script_test.so: gcctestdir/ld relro_script_test.t relro_test_pic.o
  1438. $(CXXLINK) -Bgcctestdir/ -shared -Wl,-z,relro -Wl,-T,$(srcdir)/relro_script_test.t relro_test_pic.o
  1439. check_PROGRAMS += script_test_1
  1440. script_test_1_SOURCES = script_test_1a.cc script_test_1b.cc
  1441. script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
  1442. script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_1.t
  1443. script_test_1_LDADD =
  1444. check_PROGRAMS += script_test_2
  1445. script_test_2_SOURCES = script_test_2.cc script_test_2a.cc script_test_2b.cc
  1446. script_test_2_DEPENDENCIES = gcctestdir/ld script_test_2.t
  1447. script_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -Wl,-T,$(srcdir)/script_test_2.t
  1448. script_test_2_LDADD =
  1449. check_PROGRAMS += justsyms
  1450. justsyms_SOURCES = justsyms_1.cc
  1451. justsyms_DEPENDENCIES = gcctestdir/ld justsyms_2r.o
  1452. justsyms_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_2r.o
  1453. justsyms_LDADD =
  1454. justsyms_2.o: justsyms_2.cc
  1455. $(CXXCOMPILE) -c -o $@ $<
  1456. justsyms_2r.o: justsyms_2.o gcctestdir/ld $(srcdir)/justsyms.t
  1457. gcctestdir/ld -o $@ -r -T $(srcdir)/justsyms.t justsyms_2.o
  1458. check_PROGRAMS += justsyms_exec
  1459. justsyms_exec_SOURCES = justsyms_exec.c
  1460. justsyms_exec_DEPENDENCIES = gcctestdir/ld justsyms_lib
  1461. justsyms_exec_LDFLAGS = -Bgcctestdir/ -Wl,-R,justsyms_lib
  1462. justsyms_exec_LDADD =
  1463. MOSTLYCLEANFILES += justsyms_lib
  1464. justsyms_lib.o: justsyms_lib.c
  1465. $(COMPILE) -c -o $@ $<
  1466. justsyms_lib: justsyms_lib.o gcctestdir/ld
  1467. gcctestdir/ld -o $@ -Ttext=0x1000200 -Tdata=0x2000000 -e exported_func justsyms_lib.o
  1468. check_PROGRAMS += binary_test
  1469. MOSTLYCLEANFILES += binary.txt
  1470. binary_test_SOURCES = binary_test.cc
  1471. binary_test_DEPENDENCIES = gcctestdir/ld binary.txt
  1472. binary_test_LDFLAGS = -Bgcctestdir/ -Wl,--format,binary,binary.txt,--format,elf
  1473. binary_test_LDADD =
  1474. # Copy the file to the build directory to avoid worrying about the
  1475. # full pathname in the generated symbols.
  1476. binary.txt: $(srcdir)/binary.in
  1477. rm -f $@
  1478. $(LN_S) $< $@
  1479. check_SCRIPTS += ver_matching_test.sh
  1480. check_DATA += ver_matching_test.stdout
  1481. MOSTLYCLEANFILES += ver_matching_test.stdout
  1482. ver_matching_def.so: ver_matching_def_pic.o $(srcdir)/version_script.map gcctestdir/ld
  1483. $(CXXLINK) -O0 -Bgcctestdir/ -shared ver_matching_def_pic.o -Wl,--version-script=$(srcdir)/version_script.map
  1484. ver_matching_def_pic.o: ver_matching_def.cc
  1485. $(CXXCOMPILE) -O0 -c -fpic -o $@ $<
  1486. ver_matching_test.stdout: ver_matching_def.so
  1487. $(TEST_OBJDUMP) -T ver_matching_def.so | $(TEST_CXXFILT) > ver_matching_test.stdout
  1488. check_PROGRAMS += script_test_3
  1489. check_SCRIPTS += script_test_3.sh
  1490. check_DATA += script_test_3.stdout
  1491. MOSTLYCLEANFILES += script_test_3.stdout
  1492. script_test_3: basic_test.o gcctestdir/ld script_test_3.t
  1493. $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_3.t
  1494. script_test_3.stdout: script_test_3
  1495. $(TEST_READELF) -SlW script_test_3 > script_test_3.stdout
  1496. check_PROGRAMS += tls_phdrs_script_test
  1497. tls_phdrs_script_test_SOURCES = $(tls_test_SOURCES)
  1498. tls_phdrs_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_3.t
  1499. tls_phdrs_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_3.t
  1500. tls_phdrs_script_test_LDADD = $(tls_test_LDADD)
  1501. check_SCRIPTS += script_test_4.sh
  1502. check_DATA += script_test_4.stdout
  1503. MOSTLYCLEANFILES += script_test_4
  1504. script_test_4: basic_test.o gcctestdir/ld $(srcdir)/script_test_4.t
  1505. $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_4.t
  1506. script_test_4.stdout: script_test_4
  1507. $(TEST_READELF) -SlW script_test_4 > script_test_4.stdout
  1508. check_PROGRAMS += tls_script_test
  1509. tls_script_test_SOURCES = $(tls_test_SOURCES)
  1510. tls_script_test_DEPENDENCIES = $(tls_test_DEPENDENCIES) $(srcdir)/script_test_4.t
  1511. tls_script_test_LDFLAGS = $(tls_test_LDFLAGS) -Wl,-T,$(srcdir)/script_test_4.t
  1512. tls_script_test_LDADD = $(tls_test_LDADD)
  1513. check_SCRIPTS += script_test_5.sh
  1514. check_DATA += script_test_5.stdout
  1515. MOSTLYCLEANFILES += script_test_5
  1516. script_test_5: script_test_5.o gcctestdir/ld $(srcdir)/script_test_5.t
  1517. $(CXXLINK) -Bgcctestdir/ script_test_5.o -Wl,-T,$(srcdir)/script_test_5.t
  1518. script_test_5.stdout: script_test_5
  1519. $(TEST_READELF) -SW script_test_5 > script_test_5.stdout
  1520. check_SCRIPTS += script_test_6.sh
  1521. check_DATA += script_test_6.stdout
  1522. MOSTLYCLEANFILES += script_test_6
  1523. script_test_6: basic_test.o gcctestdir/ld $(srcdir)/script_test_6.t
  1524. $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_6.t \
  1525. -Wl,-Ttext=0x10001000 -Wl,-Tdata=0x10200000 -Wl,-Tbss=0x10400000
  1526. script_test_6.stdout: script_test_6
  1527. $(TEST_READELF) -SlW script_test_6 > script_test_6.stdout
  1528. check_SCRIPTS += script_test_7.sh
  1529. check_DATA += script_test_7.stdout
  1530. MOSTLYCLEANFILES += script_test_7
  1531. script_test_7: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
  1532. $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t
  1533. script_test_7.stdout: script_test_7
  1534. $(TEST_READELF) -SlW script_test_7 > script_test_7.stdout
  1535. check_SCRIPTS += script_test_8.sh
  1536. check_DATA += script_test_8.stdout
  1537. MOSTLYCLEANFILES += script_test_8
  1538. script_test_8: basic_test.o gcctestdir/ld $(srcdir)/script_test_7.t
  1539. $(CXXLINK) -Bgcctestdir/ basic_test.o -Wl,-T,$(srcdir)/script_test_7.t \
  1540. -Wl,-Ttext=0x20001000 -Wl,-Tdata=0x20200000 -Wl,-Tbss=0x20400000
  1541. script_test_8.stdout: script_test_8
  1542. $(TEST_READELF) -SlW script_test_8 > script_test_8.stdout
  1543. check_SCRIPTS += script_test_9.sh
  1544. check_DATA += script_test_9.stdout
  1545. MOSTLYCLEANFILES += script_test_9
  1546. script_test_9.o: script_test_9.cc
  1547. $(CXXCOMPILE) -O0 -c -o $@ $<
  1548. script_test_9: gcctestdir/ld $(srcdir)/script_test_9.t script_test_9.o
  1549. $(CXXLINK) -Bgcctestdir/ script_test_9.o -Wl,-T,$(srcdir)/script_test_9.t
  1550. script_test_9.stdout: script_test_9
  1551. $(TEST_READELF) -lW script_test_9 > script_test_9.stdout
  1552. # Test scripts with a relocatable link.
  1553. # The -g option is necessary to trigger a bug where a section
  1554. # declared in a script file is assigned a non-zero starting address.
  1555. check_PROGRAMS += script_test_11
  1556. script_test_11: gcctestdir/ld script_test_11_r.o
  1557. $(LINK) -Bgcctestdir/ script_test_11_r.o
  1558. script_test_11_r.o: gcctestdir/ld $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
  1559. gcctestdir/ld -r -o $@ -T $(srcdir)/script_test_11.t script_test_11a.o script_test_11b.o
  1560. script_test_11a.o: script_test_11a.c
  1561. $(COMPILE) -c -g -o $@ $<
  1562. script_test_11b.o: script_test_11b.c
  1563. $(COMPILE) -c -g -o $@ $<
  1564. # Test difference between "*(a b)" and "*(a) *(b)" in input section spec.
  1565. check_PROGRAMS += script_test_12
  1566. script_test_12: gcctestdir/ld $(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
  1567. $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12.t script_test_12a.o script_test_12b.o
  1568. check_PROGRAMS += script_test_12i
  1569. script_test_12i: gcctestdir/ld $(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
  1570. $(LINK) -Bgcctestdir/ -Wl,-T,$(srcdir)/script_test_12i.t script_test_12a.o script_test_12b.o
  1571. script_test_12a.o: script_test_12a.c
  1572. $(COMPILE) -O0 -c -o $@ $<
  1573. script_test_12b.o: script_test_12b.c
  1574. $(COMPILE) -O0 -c -o $@ $<
  1575. # Test --dynamic-list, --dynamic-list-data, --dynamic-list-cpp-new,
  1576. # and --dynamic-list-cpp-typeinfo
  1577. check_SCRIPTS += dynamic_list.sh
  1578. check_DATA += dynamic_list.stdout
  1579. MOSTLYCLEANFILES += dynamic_list dynamic_list.stdout
  1580. dynamic_list: basic_test.o gcctestdir/ld $(srcdir)/dynamic_list.t
  1581. $(CXXLINK) -Bgcctestdir/ basic_test.o \
  1582. -Wl,--dynamic-list $(srcdir)/dynamic_list.t \
  1583. -Wl,--dynamic-list-data \
  1584. -Wl,--dynamic-list-cpp-new \
  1585. -Wl,--dynamic-list-cpp-typeinfo
  1586. dynamic_list.stdout: dynamic_list
  1587. $(TEST_READELF) -W --dyn-syms dynamic_list > dynamic_list.stdout
  1588. check_PROGRAMS += dynamic_list_2
  1589. dynamic_list_2_SOURCES = dynamic_list_2.cc
  1590. dynamic_list_2_DEPENDENCIES = gcctestdir/ld dynamic_list_lib1.so dynamic_list_lib2.so
  1591. dynamic_list_2_LDFLAGS = -Bgcctestdir/ -L. -Wl,-R,. -Wl,--no-as-needed
  1592. dynamic_list_2_LDADD = dynamic_list_lib1.so dynamic_list_lib2.so
  1593. dynamic_list_lib1.so: gcctestdir/ld dynamic_list_lib1.o
  1594. $(CXXLINK) -Bgcctestdir/ -shared dynamic_list_lib1.o
  1595. dynamic_list_lib1.o: dynamic_list_lib1.cc
  1596. $(CXXCOMPILE) -c -fpic -o $@ $<
  1597. dynamic_list_lib2.so: gcctestdir/ld dynamic_list_lib2.o $(srcdir)/dynamic_list_2.t
  1598. $(CXXLINK) -Bgcctestdir/ -shared -Wl,-Bsymbolic-functions -Wl,--dynamic-list,$(srcdir)/dynamic_list_2.t dynamic_list_lib2.o
  1599. dynamic_list_lib2.o: dynamic_list_lib2.cc
  1600. $(CXXCOMPILE) -c -fpic -o $@ $<
  1601. check_PROGRAMS += thin_archive_test_1
  1602. MOSTLYCLEANFILES += libthin1.a libthin3.a libthinall.a \
  1603. alt/thin_archive_test_2.o alt/thin_archive_test_4.o \
  1604. alt/libthin2.a alt/libthin4.a
  1605. thin_archive_test_1_SOURCES = thin_archive_main.cc
  1606. thin_archive_test_1_DEPENDENCIES = gcctestdir/ld libthin1.a alt/libthin2.a
  1607. thin_archive_test_1_LDFLAGS = -Bgcctestdir/ -Lalt
  1608. thin_archive_test_1_LDADD = libthin1.a -lthin2
  1609. check_PROGRAMS += thin_archive_test_2
  1610. thin_archive_test_2_SOURCES = thin_archive_main.cc
  1611. thin_archive_test_2_DEPENDENCIES = gcctestdir/ld libthinall.a
  1612. thin_archive_test_2_LDFLAGS = -Bgcctestdir/ -L.
  1613. thin_archive_test_2_LDADD = -lthinall
  1614. libthin1.a: thin_archive_test_1.o alt/thin_archive_test_2.o
  1615. rm -f $@
  1616. $(TEST_AR) crT $@ $^
  1617. alt/libthin2.a: thin_archive_test_3.o alt/thin_archive_test_4.o
  1618. rm -f $@
  1619. $(TEST_AR) crT $@ $^
  1620. libthin3.a: thin_archive_test_1.o alt/thin_archive_test_4.o
  1621. rm -f $@
  1622. $(TEST_AR) crT $@ $^
  1623. alt/libthin4.a: alt/thin_archive_test_2.o thin_archive_test_3.o
  1624. rm -f $@
  1625. $(TEST_AR) crT $@ $^
  1626. libthinall.a: libthin3.a alt/libthin4.a
  1627. rm -f $@
  1628. $(TEST_AR) crT $@ $^
  1629. alt/thin_archive_test_2.o: thin_archive_test_2.cc
  1630. test -d alt || mkdir -p alt
  1631. $(CXXCOMPILE) -c -o $@ $<
  1632. alt/thin_archive_test_4.o: thin_archive_test_4.cc
  1633. test -d alt || mkdir -p alt
  1634. $(CXXCOMPILE) -c -o $@ $<
  1635. if PLUGINS
  1636. check_PROGRAMS += plugin_test_1
  1637. check_SCRIPTS += plugin_test_1.sh
  1638. check_DATA += plugin_test_1.err
  1639. MOSTLYCLEANFILES += plugin_test_1.err
  1640. plugin_test_1: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms gcctestdir/ld plugin_test.so
  1641. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms 2>plugin_test_1.err
  1642. plugin_test_1.err: plugin_test_1
  1643. @touch plugin_test_1.err
  1644. check_PROGRAMS += plugin_test_2
  1645. check_SCRIPTS += plugin_test_2.sh
  1646. check_DATA += plugin_test_2.err
  1647. MOSTLYCLEANFILES += plugin_test_2.err
  1648. plugin_test_2: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
  1649. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,-R,.,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_shared_2.so 2>plugin_test_2.err
  1650. plugin_test_2.err: plugin_test_2
  1651. @touch plugin_test_2.err
  1652. check_PROGRAMS += plugin_test_3
  1653. check_SCRIPTS += plugin_test_3.sh
  1654. check_DATA += plugin_test_3.err
  1655. MOSTLYCLEANFILES += plugin_test_3.err
  1656. plugin_test_3: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms gcctestdir/ld plugin_test.so
  1657. $(CXXLINK) -Bgcctestdir/ -Wl,--export-dynamic -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms empty.o.syms 2>plugin_test_3.err
  1658. plugin_test_3.err: plugin_test_3
  1659. @touch plugin_test_3.err
  1660. check_PROGRAMS += plugin_test_4
  1661. check_SCRIPTS += plugin_test_4.sh
  1662. check_DATA += plugin_test_4.err
  1663. MOSTLYCLEANFILES += plugin_test_4.a plugin_test_4.err
  1664. plugin_test_4: two_file_test_main.o plugin_test_4.a gcctestdir/ld plugin_test.so
  1665. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o -Wl,--whole-archive,plugin_test_4.a,--no-whole-archive 2>plugin_test_4.err
  1666. plugin_test_4.err: plugin_test_4
  1667. @touch plugin_test_4.err
  1668. plugin_test_4.a: two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
  1669. $(TEST_AR) cr $@ $^
  1670. check_PROGRAMS += plugin_test_5
  1671. plugin_test_5: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms unused.o.syms gcctestdir/ld plugin_test.so
  1672. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv",--gc-sections two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms unused.o.syms
  1673. check_PROGRAMS += plugin_test_6
  1674. check_SCRIPTS += plugin_test_6.sh
  1675. check_DATA += plugin_test_6.err
  1676. MOSTLYCLEANFILES += plugin_test_6.err
  1677. plugin_test_6: plugin_common_test_1.o.syms plugin_common_test_2.o.syms gcctestdir/ld plugin_test.so
  1678. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o.syms 2>plugin_test_6.err
  1679. plugin_test_6.err: plugin_test_6
  1680. @touch plugin_test_6.err
  1681. check_PROGRAMS += plugin_test_7
  1682. check_SCRIPTS += plugin_test_7.sh
  1683. check_DATA += plugin_test_7.err plugin_test_7.o.syms
  1684. MOSTLYCLEANFILES += plugin_test_7.err
  1685. plugin_test_7: plugin_test_7_1.o plugin_test_7_1.o.syms plugin_test_7_2.o gcctestdir/ld plugin_test.so
  1686. $(LINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--gc-sections,--print-gc-sections plugin_test_7_1.o.syms plugin_test_7_2.o 2>plugin_test_7.err
  1687. plugin_test_7.o.syms: plugin_test_7
  1688. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1689. plugin_test_7_1.o: plugin_test_7_1.c
  1690. $(COMPILE) -DLTO -O0 -c -ffunction-sections -fdata-sections -o $@ $<
  1691. plugin_test_7_1_orig.o: plugin_test_7_1.c
  1692. $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
  1693. plugin_test_7_1.o.syms: plugin_test_7_1_orig.o
  1694. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1695. plugin_test_7_2.o: plugin_test_7_2.c
  1696. $(COMPILE) -O0 -c -ffunction-sections -fdata-sections -o $@ $<
  1697. plugin_test_7.err: plugin_test_7
  1698. # Test plugins with -r.
  1699. check_PROGRAMS += plugin_test_8
  1700. plugin_test_8.o: two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o ../ld-new plugin_test.so
  1701. ../ld-new -r -o $@ --no-demangle --plugin "./plugin_test.so" two_file_test_main.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o
  1702. plugin_test_8: plugin_test_8.o gcctestdir/ld
  1703. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle plugin_test_8.o
  1704. # Test that symbols known in the IR file but not in the replacement file
  1705. # produce an unresolved symbol error.
  1706. check_DATA += plugin_test_9.err
  1707. MOSTLYCLEANFILES += plugin_test_9.err
  1708. plugin_test_9.err: two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms gcctestdir/ld plugin_test.so
  1709. @echo $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms "2>$@"
  1710. @if $(CXXLINK) -Bgcctestdir/ -o plugin_test_9 -Wl,--no-demangle,--plugin,"./plugin_test.so" two_file_test_main.o two_file_test_1c.o.syms two_file_test_2.o.syms 2>$@; then \
  1711. echo 1>&2 "Link of plugin_test_9 should have failed"; \
  1712. rm -f $@; \
  1713. exit 1; \
  1714. fi
  1715. # Make a .syms file that claims to define the symbol _Z4t16av.
  1716. two_file_test_1c.o.syms: two_file_test_1.o.syms two_file_test_1c.o
  1717. cp two_file_test_1.o.syms $@.tmp
  1718. grep "_Z4t16av" two_file_test_1b.o.syms >> $@.tmp
  1719. mv -f $@.tmp $@
  1720. # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av.
  1721. MOSTLYCLEANFILES += two_file_test_1c.o
  1722. two_file_test_1c.o: two_file_test_1.o
  1723. cp two_file_test_1.o $@
  1724. check_PROGRAMS += plugin_test_10
  1725. check_SCRIPTS += plugin_test_10.sh
  1726. check_DATA += plugin_test_10.sections
  1727. MOSTLYCLEANFILES += plugin_test_10.sections
  1728. plugin_test_10: plugin_common_test_1.o.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
  1729. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.o.syms plugin_common_test_2.o
  1730. plugin_test_10.sections: plugin_test_10
  1731. $(TEST_READELF) -SW $< >$@ 2>/dev/null
  1732. check_PROGRAMS += plugin_test_11
  1733. check_SCRIPTS += plugin_test_11.sh
  1734. check_DATA += plugin_test_11.err
  1735. MOSTLYCLEANFILES += plugin_test_11.err plugin_test_thin.a
  1736. PLUGIN_TEST_11_SYMS = two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2.o.syms
  1737. plugin_test_11: two_file_test_main.o plugin_test_thin.a gcctestdir/ld plugin_test.so $(PLUGIN_TEST_11_SYMS)
  1738. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o plugin_test_thin.a 2>plugin_test_11.err
  1739. plugin_test_11.err: plugin_test_11
  1740. @touch plugin_test_11.err
  1741. plugin_test_thin.a: two_file_test_1.o two_file_test_1b.o two_file_test_2.o
  1742. rm -f $@
  1743. $(TEST_AR) crT $@ $^
  1744. plugin_test.so: plugin_test.o
  1745. $(LINK) -Bgcctestdir/ -shared plugin_test.o
  1746. plugin_test.o: plugin_test.c
  1747. $(COMPILE) -O0 -c -fpic -o $@ $<
  1748. two_file_test_main.o.syms: two_file_test_main.o
  1749. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1750. two_file_test_1.o.syms: two_file_test_1.o
  1751. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1752. two_file_test_1b.o.syms: two_file_test_1b.o
  1753. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1754. two_file_test_2.o.syms: two_file_test_2.o
  1755. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1756. plugin_common_test_1.o.syms: plugin_common_test_1.o
  1757. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1758. plugin_common_test_2.o.syms: plugin_common_test_2.o
  1759. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1760. empty.o.syms:
  1761. @echo "" >$@
  1762. @echo "Symbol table" >>$@
  1763. if TLS
  1764. check_PROGRAMS += plugin_test_tls
  1765. check_SCRIPTS += plugin_test_tls.sh
  1766. check_DATA += plugin_test_tls.err
  1767. MOSTLYCLEANFILES += plugin_test_tls.err
  1768. plugin_test_tls: two_file_test_tls.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2_tls.o.syms gcctestdir/ld plugin_test.so
  1769. $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_tls.o two_file_test_1.o.syms two_file_test_1b.o.syms two_file_test_2_tls.o.syms 2>plugin_test_tls.err
  1770. plugin_test_tls.err: plugin_test_tls
  1771. @touch plugin_test_tls.err
  1772. two_file_test_2_tls.o.syms: two_file_test_2_tls.o
  1773. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1774. endif TLS
  1775. MOSTLYCLEANFILES += unused.c
  1776. unused.o.syms: unused.o
  1777. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1778. @echo " 1: 00000000 4 FUNC GLOBAL DEFAULT 1 UNUSED" >>$@
  1779. unused.o: unused.c
  1780. $(COMPILE) -c -o $@ $<
  1781. unused.c:
  1782. @cp /dev/null $@
  1783. check_SCRIPTS += plugin_final_layout.sh
  1784. check_DATA += plugin_final_layout.stdout plugin_final_layout_readelf.stdout
  1785. MOSTLYCLEANFILES += plugin_final_layout
  1786. plugin_final_layout.o: plugin_final_layout.cc
  1787. $(CXXCOMPILE) -O0 -c -ffunction-sections -fdata-sections -g -o $@ $<
  1788. plugin_final_layout: plugin_final_layout.o plugin_section_order.so gcctestdir/ld
  1789. $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_section_order.so" plugin_final_layout.o
  1790. plugin_final_layout.stdout: plugin_final_layout
  1791. $(TEST_NM) -n --synthetic plugin_final_layout > plugin_final_layout.stdout
  1792. plugin_final_layout_readelf.stdout: plugin_final_layout
  1793. $(TEST_READELF) -Wl plugin_final_layout > plugin_final_layout_readelf.stdout
  1794. plugin_section_order.so: plugin_section_order.o
  1795. $(LINK) -Bgcctestdir/ -shared plugin_section_order.o
  1796. plugin_section_order.o: plugin_section_order.c
  1797. $(COMPILE) -O0 -c -fpic -o $@ $<
  1798. endif PLUGINS
  1799. check_PROGRAMS += exclude_libs_test
  1800. check_SCRIPTS += exclude_libs_test.sh
  1801. check_DATA += exclude_libs_test.syms
  1802. MOSTLYCLEANFILES += exclude_libs_test.syms libexclude_libs_test_1.a \
  1803. libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
  1804. exclude_libs_test_SOURCES = exclude_libs_test.c
  1805. exclude_libs_test_DEPENDENCIES = gcctestdir/ld libexclude_libs_test_1.a \
  1806. libexclude_libs_test_2.a alt/libexclude_libs_test_3.a
  1807. exclude_libs_test_LDFLAGS = -Bgcctestdir/ -L. -Lalt \
  1808. -Wl,--exclude-libs,dummy:libexclude_libs_test_1 \
  1809. -Wl,--exclude-libs,libexclude_libs_test_3
  1810. exclude_libs_test_LDADD = -lexclude_libs_test_1 -lexclude_libs_test_2 \
  1811. alt/libexclude_libs_test_3.a
  1812. exclude_libs_test.syms: exclude_libs_test
  1813. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1814. libexclude_libs_test_1.a: exclude_libs_test_1.o
  1815. $(TEST_AR) rc $@ $^
  1816. libexclude_libs_test_2.a: exclude_libs_test_2.o
  1817. $(TEST_AR) rc $@ $^
  1818. alt/libexclude_libs_test_3.a: exclude_libs_test_3.o
  1819. test -d alt || mkdir -p alt
  1820. $(TEST_AR) rc $@ $^
  1821. check_PROGRAMS += local_labels_test
  1822. local_labels_test.o: ver_test_6.c
  1823. $(COMPILE) -g -c -Wa,-L -o $@ $<
  1824. local_labels_test: local_labels_test.o
  1825. $(LINK) -Bgcctestdir/ local_labels_test.o
  1826. check_PROGRAMS += discard_locals_test
  1827. check_SCRIPTS += discard_locals_test.sh
  1828. check_DATA += discard_locals_test.syms \
  1829. discard_locals_relocatable_test1.syms \
  1830. discard_locals_relocatable_test2.syms
  1831. MOSTLYCLEANFILES += discard_locals_test.syms \
  1832. discard_locals_relocatable_test1.syms \
  1833. discard_locals_relocatable_test2.syms \
  1834. discard_locals_relocatable_test1.out \
  1835. discard_locals_relocatable_test2.out
  1836. discard_locals_test_SOURCES = discard_locals_test.c
  1837. discard_locals_test_LDFLAGS = -Bgcctestdir/ -Wl,--discard-locals
  1838. discard_locals_test.syms: discard_locals_test
  1839. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1840. # '-Wa,-L' is required to preserve the local label used for testing.
  1841. discard_locals_test.o: discard_locals_test.c
  1842. $(COMPILE) -c -Wa,-L -o $@ $<
  1843. discard_locals_relocatable_test1.syms: discard_locals_relocatable_test1.out
  1844. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1845. discard_locals_relocatable_test.o: discard_locals_relocatable_test.c
  1846. $(COMPILE) -c -Wa,-L -fPIC -o $@ $<
  1847. discard_locals_relocatable_test1.out: discard_locals_relocatable_test.o ../ld-new
  1848. ../ld-new --discard-locals -relocatable -o $@ $<
  1849. discard_locals_relocatable_test2.syms: discard_locals_relocatable_test2.out
  1850. $(TEST_READELF) -sW $< >$@ 2>/dev/null
  1851. discard_locals_relocatable_test2.out: discard_locals_relocatable_test.o ../ld-new
  1852. ../ld-new --discard-all -relocatable -o $@ $<
  1853. if MCMODEL_MEDIUM
  1854. check_PROGRAMS += large
  1855. large_SOURCES = large.c
  1856. large_CFLAGS = -mcmodel=medium
  1857. large_DEPENDENCIES = gcctestdir/ld
  1858. large_LDFLAGS = -Bgcctestdir/
  1859. large_LDADD =
  1860. endif MCMODEL_MEDIUM
  1861. # Test that hidden and internal symbols in the main program cannot be
  1862. # referenced by a shared library.
  1863. check_SCRIPTS += hidden_test.sh
  1864. check_DATA += hidden_test.err
  1865. MOSTLYCLEANFILES += hidden_test hidden_test.err hidden_test.syms
  1866. libhidden.so: hidden_test_1.c gcctestdir/ld
  1867. $(COMPILE) -Bgcctestdir/ -g -shared -fPIC -w -o $@ $(srcdir)/hidden_test_1.c
  1868. hidden_test: hidden_test_main.o libhidden.so gcctestdir/ld
  1869. $(LINK) -Bgcctestdir/ -Wl,-R,. hidden_test_main.o libhidden.so 2>hidden_test.err
  1870. hidden_test.syms: hidden_test
  1871. $(TEST_NM) -D hidden_test > $@
  1872. hidden_test.err: hidden_test
  1873. @touch hidden_test.err
  1874. # Test -retain-symbols-file.
  1875. check_SCRIPTS += retain_symbols_file_test.sh
  1876. check_DATA += retain_symbols_file_test.stdout
  1877. MOSTLYCLEANFILES += retain_symbols_file_test retain_symbols_file_test.in \
  1878. retain_symbols_file_test.stdout
  1879. retain_symbols_file_test.so: basic_pic_test.o gcctestdir/ld
  1880. echo 'main' > retain_symbols_file_test.in
  1881. echo 't1' >> retain_symbols_file_test.in
  1882. echo '_ZN4t16bC1Ev' >> retain_symbols_file_test.in
  1883. echo '_ZNK4t20a3getEv' >> retain_symbols_file_test.in
  1884. echo '_Z3t18v' >> retain_symbols_file_test.in
  1885. echo '__tcf_0' >> retain_symbols_file_test.in
  1886. $(CXXLINK) -Bgcctestdir/ -shared -Wl,-retain-symbols-file,retain_symbols_file_test.in basic_pic_test.o
  1887. retain_symbols_file_test.stdout: retain_symbols_file_test.so
  1888. $(TEST_NM) -C retain_symbols_file_test.so > $@
  1889. # Test that if the output file already exists and is empty,
  1890. # it will get execute permission.
  1891. check_PROGRAMS += permission_test
  1892. permission_test: basic_test.o gcctestdir/ld
  1893. umask 022; \
  1894. rm -f $@; \
  1895. touch $@; \
  1896. chmod 600 $@; \
  1897. $(CXXLINK) -Bgcctestdir/ basic_test.o
  1898. # Check -l:foo.a
  1899. check_PROGRAMS += searched_file_test
  1900. MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
  1901. alt/searched_file_test_lib.a
  1902. searched_file_test_SOURCES = searched_file_test.cc
  1903. searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
  1904. searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
  1905. searched_file_test_LDADD = -l:searched_file_test_lib.a
  1906. searched_file_test_lib.o: searched_file_test_lib.cc
  1907. $(CXXCOMPILE) -c -o $@ $<
  1908. alt/searched_file_test_lib.a: searched_file_test_lib.o
  1909. test -d alt || mkdir -p alt
  1910. $(TEST_AR) rc $@ $^
  1911. # Test that no .gnu.version sections are created when
  1912. # symbol versioning is not used.
  1913. check_SCRIPTS += no_version_test.sh
  1914. check_DATA += no_version_test.stdout
  1915. MOSTLYCLEANFILES += libno_version_test.so no_version_test.stdout
  1916. # We invoke the linker directly since gcc may include additional objects that
  1917. # uses symbol versioning.
  1918. libno_version_test.so: no_version_test.o gcctestdir/ld
  1919. gcctestdir/ld -shared -o $@ no_version_test.o
  1920. no_version_test.o: no_version_test.c
  1921. $(COMPILE) -o $@ -c -fPIC $<
  1922. no_version_test.stdout: libno_version_test.so
  1923. $(TEST_OBJDUMP) -h $< > $@
  1924. # Test STT_GNU_IFUNC symbols.
  1925. if IFUNC
  1926. ifuncmod1.o: ifuncmod1.c
  1927. $(COMPILE) -c -fPIC -o $@ $<
  1928. ifuncmod1.so: ifuncmod1.o gcctestdir/ld
  1929. $(LINK) -Bgcctestdir/ -shared ifuncmod1.o
  1930. ifuncdep1.o: ifuncmod1.c
  1931. $(COMPILE) -c -o $@ $<
  1932. ifuncmain1pic.o: ifuncmain1.c
  1933. $(COMPILE) -c -fPIC -o $@ $<
  1934. ifuncmain1pie.o: ifuncmain1.c
  1935. $(COMPILE) -c -fPIE -o $@ $<
  1936. if HAVE_STATIC
  1937. if IFUNC_STATIC
  1938. check_PROGRAMS += ifuncmain1static
  1939. ifuncmain1static_SOURCES = ifuncmain1.c
  1940. ifuncmain1static_DEPENDENCIES = gcctestdir/ld ifuncdep1.o
  1941. ifuncmain1static_LDFLAGS = -Bgcctestdir/ -static
  1942. ifuncmain1static_LDADD = ifuncdep1.o
  1943. check_PROGRAMS += ifuncmain1picstatic
  1944. ifuncmain1picstatic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
  1945. $(LINK) -Bgcctestdir/ -static ifuncmain1pic.o ifuncmod1.o
  1946. endif
  1947. endif
  1948. check_PROGRAMS += ifuncmain1
  1949. ifuncmain1_SOURCES = ifuncmain1.c
  1950. ifuncmain1_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
  1951. ifuncmain1_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1952. ifuncmain1_LDADD = ifuncmod1.so
  1953. check_PROGRAMS += ifuncmain1pic
  1954. ifuncmain1pic: ifuncmain1pic.o ifuncmod1.so gcctestdir/ld
  1955. $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
  1956. check_PROGRAMS += ifuncmain1vis
  1957. ifuncmain1vis_SOURCES = ifuncmain1vis.c
  1958. ifuncmain1vis_DEPENDENCIES = gcctestdir/ld ifuncmod1.so
  1959. ifuncmain1vis_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  1960. ifuncmain1vis_LDADD = ifuncmod1.so
  1961. check_PROGRAMS += ifuncmain1vispic
  1962. ifuncmain1vispic.o: ifuncmain1vis.c
  1963. $(COMPILE) -c -fPIC -o $@ $<
  1964. ifuncmain1vispic: ifuncmain1vispic.o ifuncmod1.so gcctestdir/ld
  1965. $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.so -Wl,-R,.
  1966. check_PROGRAMS += ifuncmain1staticpic
  1967. ifuncmain1staticpic: ifuncmain1pic.o ifuncmod1.o gcctestdir/ld
  1968. $(LINK) -Bgcctestdir/ ifuncmain1pic.o ifuncmod1.o
  1969. check_PROGRAMS += ifuncmain1pie
  1970. ifuncmain1pie: ifuncmain1pie.o ifuncmod1.so gcctestdir/ld
  1971. $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.so -Wl,-R,.
  1972. check_PROGRAMS += ifuncmain1vispie
  1973. ifuncmain1vispie.o: ifuncmain1vis.c
  1974. $(COMPILE) -c -fPIE -o $@ $<
  1975. ifuncmain1vispie: ifuncmain1vispie.o ifuncmod1.so gcctestdir/ld
  1976. $(LINK) -Bgcctestdir/ -pie ifuncmain1vispie.o ifuncmod1.so -Wl,-R,.
  1977. check_PROGRAMS += ifuncmain1staticpie
  1978. ifuncmain1staticpie: ifuncmain1pie.o ifuncmod1.o gcctestdir/ld
  1979. $(LINK) -Bgcctestdir/ -pie ifuncmain1pie.o ifuncmod1.o
  1980. ifuncmain2pic.o: ifuncmain2.c
  1981. $(COMPILE) -c -fPIC -o $@ $<
  1982. ifuncdep2pic.o: ifuncdep2.c
  1983. $(COMPILE) -c -fPIC -o $@ $<
  1984. if HAVE_STATIC
  1985. if IFUNC_STATIC
  1986. check_PROGRAMS += ifuncmain2static
  1987. ifuncmain2static_SOURCES = ifuncmain2.c ifuncdep2.c
  1988. ifuncmain2static_DEPENDENCIES = gcctestdir/ld
  1989. ifuncmain2static_LDFLAGS = -Bgcctestdir/ -static
  1990. ifuncmain2static_LDADD =
  1991. check_PROGRAMS += ifuncmain2picstatic
  1992. ifuncmain2picstatic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
  1993. $(LINK) -Bgcctestdir/ -static ifuncmain2pic.o ifuncdep2pic.o
  1994. endif
  1995. endif
  1996. check_PROGRAMS += ifuncmain2
  1997. ifuncmain2_SOURCES = ifuncmain2.c ifuncdep2.c
  1998. ifuncmain2_DEPENDENCIES = gcctestdir/ld
  1999. ifuncmain2_LDFLAGS = -Bgcctestdir/
  2000. ifuncmain2_LDADD =
  2001. check_PROGRAMS += ifuncmain2pic
  2002. ifuncmain2pic: ifuncmain2pic.o ifuncdep2pic.o gcctestdir/ld
  2003. $(LINK) -Bgcctestdir/ ifuncmain2pic.o ifuncdep2pic.o
  2004. ifuncmod3.o: ifuncmod3.c
  2005. $(COMPILE) -c -fPIC -o $@ $<
  2006. ifuncmod3.so: ifuncmod3.o gcctestdir/ld
  2007. $(LINK) -Bgcctestdir/ -shared ifuncmod3.o
  2008. check_PROGRAMS += ifuncmain3
  2009. ifuncmain3_SOURCES = ifuncmain3.c
  2010. ifuncmain3_DEPENDENCIES = gcctestdir/ld ifuncmod3.so
  2011. ifuncmain3_LDFLAGS = -Bgcctestdir/ -Wl,--export-dynamic -Wl,-R,.
  2012. ifuncmain3_LDADD = -ldl
  2013. ifuncmain4pic.o: ifuncmain4.c
  2014. $(COMPILE) -c -fPIC -o $@ $<
  2015. if HAVE_STATIC
  2016. if IFUNC_STATIC
  2017. check_PROGRAMS += ifuncmain4static
  2018. ifuncmain4static_SOURCES = ifuncmain4.c
  2019. ifuncmain4static_DEPENDENCIES = gcctestdir/ld
  2020. ifuncmain4static_LDFLAGS = -Bgcctestdir/ -static
  2021. ifuncmain4static_LDADD =
  2022. check_PROGRAMS += ifuncmain4picstatic
  2023. ifuncmain4picstatic: ifuncmain4pic.o gcctestdir/ld
  2024. $(LINK) -Bgcctestdir/ -static ifuncmain4pic.o
  2025. endif
  2026. endif
  2027. check_PROGRAMS += ifuncmain4
  2028. ifuncmain4_SOURCES = ifuncmain4.c
  2029. ifuncmain4_DEPENDENCIES = gcctestdir/ld
  2030. ifuncmain4_LDFLAGS = -Bgcctestdir/
  2031. ifuncmain4_LDADD =
  2032. ifuncmain5pic.o: ifuncmain5.c
  2033. $(COMPILE) -c -fPIC -o $@ $<
  2034. ifuncmain5pie.o: ifuncmain5.c
  2035. $(COMPILE) -c -fPIE -o $@ $<
  2036. ifuncmod5.o: ifuncmod5.c
  2037. $(COMPILE) -c -fPIC -o $@ $<
  2038. ifuncmod5.so: ifuncmod5.o gcctestdir/ld
  2039. $(LINK) -Bgcctestdir/ -shared ifuncmod5.o
  2040. ifuncdep5.o: ifuncmod5.c
  2041. $(COMPILE) -c -o $@ $<
  2042. if HAVE_STATIC
  2043. if IFUNC_STATIC
  2044. check_PROGRAMS += ifuncmain5static
  2045. ifuncmain5static_SOURCES = ifuncmain5.c
  2046. ifuncmain5static_DEPENDENCIES = gcctestdir/ld ifuncdep5.o
  2047. ifuncmain5static_LDFLAGS = -Bgcctestdir/ -static
  2048. ifuncmain5static_LDADD = ifuncdep5.o
  2049. check_PROGRAMS += ifuncmain5picstatic
  2050. ifuncmain5picstatic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
  2051. $(LINK) -Bgcctestdir/ -static ifuncmain5pic.o ifuncmod5.o
  2052. endif
  2053. endif
  2054. check_PROGRAMS += ifuncmain5
  2055. ifuncmain5_SOURCES = ifuncmain5.c
  2056. ifuncmain5_DEPENDENCIES = gcctestdir/ld ifuncmod5.so
  2057. ifuncmain5_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  2058. ifuncmain5_LDADD = ifuncmod5.so
  2059. check_PROGRAMS += ifuncmain5pic
  2060. ifuncmain5pic: ifuncmain5pic.o ifuncmod5.so gcctestdir/ld
  2061. $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.so -Wl,-R,.
  2062. check_PROGRAMS += ifuncmain5staticpic
  2063. ifuncmain5staticpic: ifuncmain5pic.o ifuncmod5.o gcctestdir/ld
  2064. $(LINK) -Bgcctestdir/ ifuncmain5pic.o ifuncmod5.o
  2065. check_PROGRAMS += ifuncmain5pie
  2066. ifuncmain5pie: ifuncmain5pie.o ifuncmod5.so gcctestdir/ld
  2067. $(LINK) -Bgcctestdir/ -pie ifuncmain5pie.o ifuncmod5.so -Wl,-R,.
  2068. ifuncmain6pie.o: ifuncmain6pie.c
  2069. $(COMPILE) -c -fPIE -o $@ $<
  2070. ifuncmod6.o: ifuncmod6.c
  2071. $(COMPILE) -c -fPIC -o $@ $<
  2072. ifuncmod6.so: ifuncmod6.o gcctestdir/ld
  2073. $(LINK) -Bgcctestdir/ -shared ifuncmod6.o
  2074. check_PROGRAMS += ifuncmain6pie
  2075. ifuncmain6pie: ifuncmain6pie.o ifuncmod6.so gcctestdir/ld
  2076. $(LINK) -Bgcctestdir/ -pie ifuncmain6pie.o ifuncmod6.so -Wl,-R,.
  2077. ifuncmain7pic.o: ifuncmain7.c
  2078. $(COMPILE) -c -fPIC -o $@ $<
  2079. ifuncmain7pie.o: ifuncmain7.c
  2080. $(COMPILE) -c -fPIE -o $@ $<
  2081. if HAVE_STATIC
  2082. if IFUNC_STATIC
  2083. check_PROGRAMS += ifuncmain7static
  2084. ifuncmain7static_SOURCES = ifuncmain7.c
  2085. ifuncmain7static_DEPENDENCIES = gcctestdir/ld
  2086. ifuncmain7static_LDFLAGS = -Bgcctestdir/ -static
  2087. ifuncmain7static_LDADD =
  2088. check_PROGRAMS += ifuncmain7picstatic
  2089. ifuncmain7picstatic: ifuncmain7pic.o gcctestdir/ld
  2090. $(LINK) -Bgcctestdir/ -static ifuncmain7pic.o
  2091. endif
  2092. endif
  2093. check_PROGRAMS += ifuncmain7
  2094. ifuncmain7_SOURCES = ifuncmain7.c
  2095. ifuncmain7_DEPENDENCIES = gcctestdir/ld
  2096. ifuncmain7_LDFLAGS = -Bgcctestdir/
  2097. ifuncmain7_LDADD =
  2098. check_PROGRAMS += ifuncmain7pic
  2099. ifuncmain7pic: ifuncmain7pic.o gcctestdir/ld
  2100. $(LINK) -Bgcctestdir/ ifuncmain7pic.o
  2101. check_PROGRAMS += ifuncmain7pie
  2102. ifuncmain7pie: ifuncmain7pie.o gcctestdir/ld
  2103. $(LINK) -Bgcctestdir/ -pie ifuncmain7pie.o
  2104. check_PROGRAMS += ifuncvar
  2105. ifuncvar1_pic.o: ifuncvar1.c
  2106. $(COMPILE) -c -fPIC -o $@ $<
  2107. ifuncvar2_pic.o: ifuncvar2.c
  2108. $(COMPILE) -c -fPIC -o $@ $<
  2109. ifuncvar.so: ifuncvar1_pic.o ifuncvar2_pic.o gcctestdir/ld
  2110. $(LINK) -Bgcctestdir/ -shared ifuncvar1_pic.o ifuncvar2_pic.o
  2111. ifuncvar_SOURCES = ifuncvar3.c
  2112. ifuncvar_DEPENDENCIES = gcctestdir/ld ifuncvar.so
  2113. ifuncvar_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
  2114. ifuncvar_LDADD = ifuncvar.so
  2115. endif IFUNC
  2116. # Test that strong reference to a weak symbol in a DSO remains strong.
  2117. check_SCRIPTS += strong_ref_weak_def.sh
  2118. check_DATA += strong_ref_weak_def.stdout
  2119. MOSTLYCLEANFILES += strong_ref_weak_def_1.so strong_ref_weak_def_2.so \
  2120. strong_ref_weak_def.stdout
  2121. strong_ref_weak_def_2.o: strong_ref_weak_def_2.c
  2122. $(COMPILE) -o $@ -c -fPIC $<
  2123. strong_ref_weak_def_2.so: strong_ref_weak_def_2.o gcctestdir/ld
  2124. gcctestdir/ld -shared -o $@ strong_ref_weak_def_2.o
  2125. strong_ref_weak_def_1.o: strong_ref_weak_def_1.c
  2126. $(COMPILE) -o $@ -c -fPIC $<
  2127. strong_ref_weak_def_1.so: strong_ref_weak_def_1.o strong_ref_weak_def_2.so \
  2128. gcctestdir/ld
  2129. gcctestdir/ld -shared -o $@ strong_ref_weak_def_1.o \
  2130. strong_ref_weak_def_2.so
  2131. strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
  2132. $(TEST_READELF) -sWD $< > $@
  2133. # Test that a strong weak reference remains strong if there is another
  2134. # weak reference in a DSO.
  2135. check_SCRIPTS += dyn_weak_ref.sh
  2136. check_DATA += dyn_weak_ref.stdout
  2137. MOSTLYCLEANFILES += dyn_weak_ref_1.so dyn_weak_ref_2.so \
  2138. dyn_weak_ref.stdout
  2139. dyn_weak_ref_2.o: dyn_weak_ref_2.c
  2140. $(COMPILE) -o $@ -c -fPIC $<
  2141. dyn_weak_ref_2.so: dyn_weak_ref_2.o gcctestdir/ld
  2142. gcctestdir/ld -shared -o $@ dyn_weak_ref_2.o
  2143. dyn_weak_ref_1.o: dyn_weak_ref_1.c
  2144. $(COMPILE) -o $@ -c -fPIC $<
  2145. # We intentionally put dyn_weak_ref_2.so in front of dyn_weak_ref_1.o
  2146. # so that the weak ref there goes to gold's symbol table first.
  2147. dyn_weak_ref_1.so: dyn_weak_ref_1.o dyn_weak_ref_2.so gcctestdir/ld
  2148. gcctestdir/ld -shared -o $@ dyn_weak_ref_2.so dyn_weak_ref_1.o
  2149. dyn_weak_ref.stdout: dyn_weak_ref_1.so
  2150. $(TEST_READELF) -sWD $< > $@
  2151. # Test that --start-lib and --end-lib function correctly.
  2152. check_PROGRAMS += start_lib_test
  2153. MOSTLYCLEANFILES += libstart_lib_test.a
  2154. start_lib_test: start_lib_test_main.o libstart_lib_test.a start_lib_test_2.o start_lib_test_3.o \
  2155. gcctestdir/ld
  2156. $(LINK) -Bgcctestdir/ -o $@ start_lib_test_main.o -L. -lstart_lib_test \
  2157. -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
  2158. libstart_lib_test.a: start_lib_test_1.o
  2159. $(TEST_AR) rc $@ $^
  2160. # Test that MEMORY region support works.
  2161. check_SCRIPTS += memory_test.sh
  2162. check_DATA += memory_test.stdout
  2163. MOSTLYCLEANFILES += memory_test.stdout memory_test memory_test.o
  2164. memory_test.o: memory_test.s
  2165. $(COMPILE) -o $@ -c $<
  2166. memory_test: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t
  2167. $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
  2168. memory_test.stdout: memory_test
  2169. $(TEST_READELF) -lWS $< > $@
  2170. # Test INCLUDE directives in linker scripts.
  2171. # The binary isn't runnable, so we just check that we can build it without errors.
  2172. check_DATA += memory_test_2
  2173. MOSTLYCLEANFILES += memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t
  2174. memory_test_inc_1.t: $(srcdir)/memory_test_inc_1.t.src
  2175. cp $< $@
  2176. memory_test_inc_2.t: $(srcdir)/memory_test_inc_2.t.src
  2177. cp $< $@
  2178. memory_test_inc_3.t: $(srcdir)/memory_test_inc_3.t.src
  2179. cp $< $@
  2180. memory_test_2: memory_test.o gcctestdir/ld $(srcdir)/memory_test.t memory_test_inc_1.t memory_test_inc_2.t memory_test_inc_3.t
  2181. $(LINK) -Bgcctestdir/ -nostartfiles -nostdlib -z max-page-size=0x1000 -z common-page-size=0x1000 -Wl,-T,$(srcdir)/memory_test.t -o $@ memory_test.o
  2182. if HAVE_PUBNAMES
  2183. # Test that --gdb-index functions correctly without gcc-generated pubnames.
  2184. check_SCRIPTS += gdb_index_test_1.sh
  2185. check_DATA += gdb_index_test_1.stdout
  2186. MOSTLYCLEANFILES += gdb_index_test_1.stdout gdb_index_test_1
  2187. gdb_index_test.o: gdb_index_test.cc
  2188. $(CXXCOMPILE) -O0 -g -gno-pubnames -c -o $@ $<
  2189. gdb_index_test_1: gdb_index_test.o gcctestdir/ld
  2190. $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
  2191. gdb_index_test_1.stdout: gdb_index_test_1
  2192. $(TEST_READELF) --debug-dump=gdb_index $< > $@
  2193. # Test that --gdb-index functions correctly with compressed debug sections.
  2194. check_SCRIPTS += gdb_index_test_2.sh
  2195. check_DATA += gdb_index_test_2.stdout
  2196. MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
  2197. gdb_index_test_cdebug.o: gdb_index_test.cc
  2198. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections -c -o $@ $<
  2199. gdb_index_test_2: gdb_index_test_cdebug.o gcctestdir/ld
  2200. $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
  2201. gdb_index_test_2.stdout: gdb_index_test_2
  2202. $(TEST_READELF) --debug-dump=gdb_index $< > $@
  2203. check_SCRIPTS += gdb_index_test_2_gabi.sh
  2204. check_DATA += gdb_index_test_2_gabi.stdout
  2205. MOSTLYCLEANFILES += gdb_index_test_2.stdout gdb_index_test_2
  2206. gdb_index_test_cdebug_gabi.o: gdb_index_test.cc
  2207. $(CXXCOMPILE) -Bgcctestdir/ -O0 -g -Wa,--compress-debug-sections=zlib-gabi -c -o $@ $<
  2208. gdb_index_test_2_gabi: gdb_index_test_cdebug_gabi.o gcctestdir/ld
  2209. $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
  2210. gdb_index_test_2_gabi.stdout: gdb_index_test_2_gabi
  2211. $(TEST_READELF) --debug-dump=gdb_index $< > $@
  2212. # Another simple C test (DW_AT_high_pc encoding) for --gdb-index.
  2213. check_SCRIPTS += gdb_index_test_3.sh
  2214. check_DATA += gdb_index_test_3.stdout
  2215. MOSTLYCLEANFILES += gdb_index_test_3.stdout gdb_index_test_3
  2216. gdb_index_test_3.o: gdb_index_test_3.c
  2217. $(COMPILE) -O0 -g -c -o $@ $<
  2218. gdb_index_test_3: gdb_index_test_3.o gcctestdir/ld
  2219. $(LINK) -Bgcctestdir/ -Wl,--gdb-index,--fatal-warnings $<
  2220. gdb_index_test_3.stdout: gdb_index_test_3
  2221. $(TEST_READELF) --debug-dump=gdb_index $< > $@
  2222. # Test that --gdb-index functions correctly with gcc-generated pubnames.
  2223. check_SCRIPTS += gdb_index_test_4.sh
  2224. check_DATA += gdb_index_test_4.stdout
  2225. MOSTLYCLEANFILES += gdb_index_test_4.stdout gdb_index_test_4
  2226. gdb_index_test_pub.o: gdb_index_test.cc
  2227. $(CXXCOMPILE) -O0 -g -gpubnames -c -o $@ $<
  2228. gdb_index_test_4: gdb_index_test_pub.o gcctestdir/ld
  2229. $(CXXLINK) -Bgcctestdir/ -Wl,--gdb-index $<
  2230. gdb_index_test_4.stdout: gdb_index_test_4
  2231. $(TEST_READELF) --debug-dump=gdb_index $< > $@
  2232. endif HAVE_PUBNAMES
  2233. # Test that __ehdr_start is defined correctly.
  2234. check_PROGRAMS += ehdr_start_test_1
  2235. ehdr_start_test_1_SOURCES = ehdr_start_test.cc
  2236. ehdr_start_test_1_DEPENDENCIES = gcctestdir/ld
  2237. ehdr_start_test_1_CXXFLAGS =
  2238. ehdr_start_test_1_LDFLAGS = -Bgcctestdir/
  2239. ehdr_start_test_1_LDADD =
  2240. # Test that __ehdr_start is defined correctly with a weak reference.
  2241. check_PROGRAMS += ehdr_start_test_2
  2242. ehdr_start_test_2_SOURCES = ehdr_start_test.cc
  2243. ehdr_start_test_2_DEPENDENCIES = gcctestdir/ld
  2244. ehdr_start_test_2_CXXFLAGS = -DEHDR_START_WEAK
  2245. ehdr_start_test_2_LDFLAGS = -Bgcctestdir/
  2246. ehdr_start_test_2_LDADD =
  2247. # Test that __ehdr_start is defined correctly when used with a linker script.
  2248. check_PROGRAMS += ehdr_start_test_3
  2249. ehdr_start_test_3_SOURCES = ehdr_start_test.cc
  2250. ehdr_start_test_3_DEPENDENCIES = gcctestdir/ld $(srcdir)/ehdr_start_test.t
  2251. ehdr_start_test_3_CXXFLAGS = -DEHDR_START_WEAK
  2252. ehdr_start_test_3_LDFLAGS = -Bgcctestdir/ -Wl,-T,$(srcdir)/ehdr_start_test.t
  2253. ehdr_start_test_3_LDADD =
  2254. # Test that __ehdr_start is left undefined when the text segment is not
  2255. # appropriately aligned.
  2256. check_SCRIPTS += ehdr_start_test_4.sh
  2257. check_DATA += ehdr_start_test_4.syms
  2258. MOSTLYCLEANFILES += ehdr_start_test_4
  2259. ehdr_start_test_4.syms: ehdr_start_test_4
  2260. $(TEST_NM) ehdr_start_test_4 > $@
  2261. ehdr_start_test_4: ehdr_start_test_4.o gcctestdir/ld
  2262. $(CXXLINK) -Bgcctestdir/ -Wl,-Ttext=0x100100 $<
  2263. ehdr_start_test_4.o: ehdr_start_test.cc
  2264. $(CXXCOMPILE) -c -DEHDR_START_WEAK -o $@ $<
  2265. # Test that __ehdr_start is not overridden when supplied by the user.
  2266. check_PROGRAMS += ehdr_start_test_5
  2267. ehdr_start_test_5_SOURCES = ehdr_start_test.cc ehdr_start_def.cc
  2268. ehdr_start_test_5_DEPENDENCIES = gcctestdir/ld
  2269. ehdr_start_test_5_CXXFLAGS = -DEHDR_START_USER_DEF
  2270. ehdr_start_test_5_LDFLAGS = -Bgcctestdir/
  2271. ehdr_start_test_5_LDADD =
  2272. # Test that the --defsym option copies the symbol type and visibility.
  2273. check_SCRIPTS += defsym_test.sh
  2274. check_DATA += defsym_test.syms
  2275. MOSTLYCLEANFILES += defsym_test defsym_test.syms
  2276. defsym_test.syms: defsym_test
  2277. $(TEST_READELF) -sW $< > $@
  2278. defsym_test: defsym_test.o gcctestdir/ld
  2279. $(LINK) -Bgcctestdir/ -Wl,--defsym=bar=foo defsym_test.o
  2280. defsym_test.o: defsym_test.c
  2281. $(COMPILE) -c -o $@ $<
  2282. # End-to-end incremental linking tests.
  2283. # Incremental linking is currently supported only on the x86_64 target.
  2284. if DEFAULT_TARGET_X86_64
  2285. two_file_test_1_v1_ndebug.o: two_file_test_1_v1.cc
  2286. $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
  2287. two_file_test_1_ndebug.o: two_file_test_1.cc
  2288. $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
  2289. two_file_test_1b_ndebug.o: two_file_test_1b.cc
  2290. $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
  2291. two_file_test_2_ndebug.o: two_file_test_2.cc
  2292. $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
  2293. two_file_test_main_ndebug.o: two_file_test_main.cc
  2294. $(CXXCOMPILE) -O0 -g0 -c -o $@ $<
  2295. check_PROGRAMS += incremental_test_2
  2296. MOSTLYCLEANFILES += two_file_test_tmp_2.o
  2297. incremental_test_2: two_file_test_1_v1_ndebug.o two_file_test_1_ndebug.o two_file_test_1b_ndebug.o \
  2298. two_file_test_2_ndebug.o two_file_test_main_ndebug.o gcctestdir/ld
  2299. cp -f two_file_test_1_v1_ndebug.o two_file_test_tmp_2.o
  2300. $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
  2301. @sleep 1
  2302. cp -f two_file_test_1_ndebug.o two_file_test_tmp_2.o
  2303. $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_tmp_2.o two_file_test_1b_ndebug.o two_file_test_2_ndebug.o two_file_test_main_ndebug.o
  2304. check_PROGRAMS += incremental_test_3
  2305. MOSTLYCLEANFILES += two_file_test_tmp_3.o
  2306. incremental_test_3: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
  2307. two_file_test_2.o two_file_test_main.o gcctestdir/ld
  2308. cp -f two_file_test_1b_v1.o two_file_test_tmp_3.o
  2309. $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
  2310. @sleep 1
  2311. cp -f two_file_test_1b.o two_file_test_tmp_3.o
  2312. $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_tmp_3.o two_file_test_2.o two_file_test_main.o
  2313. check_PROGRAMS += incremental_test_4
  2314. MOSTLYCLEANFILES += incremental_test_4.base two_file_test_tmp_4.o
  2315. incremental_test_4: two_file_test_1.o two_file_test_1b.o two_file_test_2_v1.o \
  2316. two_file_test_2.o two_file_test_main.o gcctestdir/ld
  2317. cp -f two_file_test_2_v1.o two_file_test_tmp_4.o
  2318. $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
  2319. mv -f incremental_test_4 incremental_test_4.base
  2320. @sleep 1
  2321. cp -f two_file_test_2.o two_file_test_tmp_4.o
  2322. $(CXXLINK) -Wl,--incremental-update,--incremental-base=incremental_test_4.base -Wl,-z,norelro -Bgcctestdir/ two_file_test_1.o two_file_test_1b.o two_file_test_tmp_4.o two_file_test_main.o
  2323. check_PROGRAMS += incremental_test_5
  2324. MOSTLYCLEANFILES += two_file_test_5.a
  2325. incremental_test_5: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
  2326. two_file_test_2.o two_file_test_main.o gcctestdir/ld
  2327. cp -f two_file_test_1b_v1.o two_file_test_tmp_5.o
  2328. $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
  2329. $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
  2330. @sleep 1
  2331. cp -f two_file_test_1b.o two_file_test_tmp_5.o
  2332. $(TEST_AR) rc two_file_test_5.a two_file_test_1.o two_file_test_tmp_5.o two_file_test_2.o
  2333. $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_5.a
  2334. # Test the --incremental-unchanged flag with an archive library.
  2335. # The second link should not update the library.
  2336. check_PROGRAMS += incremental_test_6
  2337. MOSTLYCLEANFILES += two_file_test_6.a
  2338. incremental_test_6: two_file_test_1.o two_file_test_1b_v1.o two_file_test_1b.o \
  2339. two_file_test_2.o two_file_test_main.o gcctestdir/ld
  2340. cp -f two_file_test_1b.o two_file_test_tmp_6.o
  2341. $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
  2342. $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o two_file_test_6.a
  2343. @sleep 1
  2344. cp -f two_file_test_1b_v1.o two_file_test_tmp_6.o
  2345. $(TEST_AR) rc two_file_test_6.a two_file_test_1.o two_file_test_tmp_6.o two_file_test_2.o
  2346. $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ two_file_test_main.o -Wl,--incremental-unchanged two_file_test_6.a -Wl,--incremental-unknown
  2347. check_PROGRAMS += incremental_copy_test
  2348. incremental_copy_test: copy_test_v1.o copy_test.o copy_test_1.so copy_test_2.so
  2349. cp -f copy_test_v1.o copy_test_tmp.o
  2350. $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
  2351. @sleep 1
  2352. cp -f copy_test.o copy_test_tmp.o
  2353. $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ -Wl,-R,. -Wl,--no-as-needed copy_test_tmp.o copy_test_1.so copy_test_2.so
  2354. check_PROGRAMS += incremental_common_test_1
  2355. incremental_common_test_1: common_test_1_v1.o common_test_1_v2.o gcctestdir/ld
  2356. cp -f common_test_1_v1.o common_test_1_tmp.o
  2357. $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
  2358. @sleep 1
  2359. cp -f common_test_1_v2.o common_test_1_tmp.o
  2360. $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ common_test_1_tmp.o
  2361. check_PROGRAMS += incremental_comdat_test_1
  2362. incremental_comdat_test_1: incr_comdat_test_1.o incr_comdat_test_2_v1.o incr_comdat_test_2_v2.o incr_comdat_test_2_v3.o gcctestdir/ld
  2363. cp -f incr_comdat_test_2_v1.o incr_comdat_test_1_tmp.o
  2364. $(CXXLINK) -Wl,--incremental-full,--incremental-patch=100 -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
  2365. @sleep 1
  2366. cp -f incr_comdat_test_2_v2.o incr_comdat_test_1_tmp.o
  2367. $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
  2368. @sleep 1
  2369. cp -f incr_comdat_test_2_v3.o incr_comdat_test_1_tmp.o
  2370. $(CXXLINK) -Wl,--incremental-update -Wl,-z,norelro -Bgcctestdir/ incr_comdat_test_1.o incr_comdat_test_1_tmp.o
  2371. endif DEFAULT_TARGET_X86_64
  2372. if DEFAULT_TARGET_X86_64
  2373. check_PROGRAMS += exception_x86_64_bnd_test
  2374. exception_x86_64_bnd_test_SOURCES = exception_test_main.cc
  2375. exception_x86_64_bnd_test_DEPENDENCIES = gcctestdir/ld exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
  2376. exception_x86_64_bnd_test_LDFLAGS = $(exception_test_LDFLAGS)
  2377. exception_x86_64_bnd_test_LDADD = exception_x86_64_bnd_1.o exception_x86_64_bnd_2.o
  2378. exception_x86_64_bnd_1.o: exception_test_1.cc gcctestdir/as
  2379. $(CXXCOMPILE) -c -fpic -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
  2380. exception_x86_64_bnd_2.o: exception_test_2.cc gcctestdir/as
  2381. $(CXXCOMPILE) -c -Bgcctestdir/ -Wa,-madd-bnd-prefix -o $@ $<
  2382. endif DEFAULT_TARGET_X86_64
  2383. endif GCC
  2384. endif NATIVE_LINKER
  2385. # These tests work with native and cross linkers.
  2386. if NATIVE_OR_CROSS_LINKER
  2387. # Test script section order.
  2388. check_SCRIPTS += script_test_10.sh
  2389. check_DATA += script_test_10.stdout
  2390. MOSTLYCLEANFILES += script_test_10
  2391. script_test_10.o: script_test_10.s
  2392. $(TEST_AS) -o $@ $<
  2393. script_test_10: $(srcdir)/script_test_10.t script_test_10.o gcctestdir/ld
  2394. gcctestdir/ld -o $@ script_test_10.o -T $(srcdir)/script_test_10.t
  2395. script_test_10.stdout: script_test_10
  2396. $(TEST_READELF) -SW script_test_10 > $@
  2397. # These tests work with cross linkers only.
  2398. if DEFAULT_TARGET_I386
  2399. check_SCRIPTS += split_i386.sh
  2400. check_DATA += split_i386_1.stdout split_i386_2.stdout \
  2401. split_i386_3.stdout split_i386_4.stdout split_i386_r.stdout
  2402. SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
  2403. split_i386_1.o: split_i386_1.s
  2404. $(TEST_AS) -o $@ $<
  2405. split_i386_2.o: split_i386_2.s
  2406. $(TEST_AS) -o $@ $<
  2407. split_i386_3.o: split_i386_3.s
  2408. $(TEST_AS) -o $@ $<
  2409. split_i386_4.o: split_i386_4.s
  2410. $(TEST_AS) -o $@ $<
  2411. split_i386_n.o: split_i386_n.s
  2412. $(TEST_AS) -o $@ $<
  2413. split_i386_1: split_i386_1.o split_i386_n.o ../ld-new
  2414. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_1.o split_i386_n.o
  2415. split_i386_1.stdout: split_i386_1
  2416. $(TEST_OBJDUMP) -d $< > $@
  2417. split_i386_2: split_i386_2.o split_i386_n.o ../ld-new
  2418. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_2.o split_i386_n.o
  2419. split_i386_2.stdout: split_i386_2
  2420. $(TEST_OBJDUMP) -d $< > $@
  2421. split_i386_3.stdout: split_i386_3.o split_i386_n.o ../ld-new
  2422. ../ld-new $(SPLIT_DEFSYMS) -o split_i386_3 split_i386_3.o split_i386_n.o > $@ 2>&1 || exit 0
  2423. split_i386_4: split_i386_4.o split_i386_n.o ../ld-new
  2424. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_i386_4.o split_i386_n.o
  2425. split_i386_4.stdout: split_i386_4
  2426. $(TEST_OBJDUMP) -d $< > $@
  2427. split_i386_r.stdout: split_i386_1.o split_i386_n.o ../ld-new
  2428. ../ld-new -r split_i386_1.o split_i386_n.o -o split_i386_r > $@ 2>&1 || exit 0
  2429. MOSTLYCLEANFILES += split_i386_1 split_i386_2 split_i386_3 \
  2430. split_i386_4 split_i386_r
  2431. endif DEFAULT_TARGET_I386
  2432. if DEFAULT_TARGET_X86_64
  2433. check_SCRIPTS += split_x86_64.sh
  2434. check_DATA += split_x86_64_1.stdout split_x86_64_2.stdout \
  2435. split_x86_64_3.stdout split_x86_64_4.stdout split_x86_64_r.stdout
  2436. SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
  2437. split_x86_64_1.o: split_x86_64_1.s
  2438. $(TEST_AS) -o $@ $<
  2439. split_x86_64_2.o: split_x86_64_2.s
  2440. $(TEST_AS) -o $@ $<
  2441. split_x86_64_3.o: split_x86_64_3.s
  2442. $(TEST_AS) -o $@ $<
  2443. split_x86_64_4.o: split_x86_64_4.s
  2444. $(TEST_AS) -o $@ $<
  2445. split_x86_64_n.o: split_x86_64_n.s
  2446. $(TEST_AS) -o $@ $<
  2447. split_x86_64_1: split_x86_64_1.o split_x86_64_n.o ../ld-new
  2448. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_1.o split_x86_64_n.o
  2449. split_x86_64_1.stdout: split_x86_64_1
  2450. $(TEST_OBJDUMP) -d $< > $@
  2451. split_x86_64_2: split_x86_64_2.o split_x86_64_n.o ../ld-new
  2452. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_2.o split_x86_64_n.o
  2453. split_x86_64_2.stdout: split_x86_64_2
  2454. $(TEST_OBJDUMP) -d $< > $@
  2455. split_x86_64_3.stdout: split_x86_64_3.o split_x86_64_n.o ../ld-new
  2456. ../ld-new $(SPLIT_DEFSYMS) -o split_x86_64_3 split_x86_64_3.o split_x86_64_n.o > $@ 2>&1 || exit 0
  2457. split_x86_64_4: split_x86_64_4.o split_x86_64_n.o ../ld-new
  2458. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x86_64_4.o split_x86_64_n.o
  2459. split_x86_64_4.stdout: split_x86_64_4
  2460. $(TEST_OBJDUMP) -d $< > $@
  2461. split_x86_64_r.stdout: split_x86_64_1.o split_x86_64_n.o ../ld-new
  2462. ../ld-new -r split_x86_64_1.o split_x86_64_n.o -o split_x86_64_r > $@ 2>&1 || exit 0
  2463. MOSTLYCLEANFILES += split_x86_64_1 split_x86_64_2 split_x86_64_3 \
  2464. split_x86_64_4 split_x86_64_r
  2465. endif DEFAULT_TARGET_X86_64
  2466. if DEFAULT_TARGET_X32
  2467. check_SCRIPTS += split_x32.sh
  2468. check_DATA += split_x32_1.stdout split_x32_2.stdout \
  2469. split_x32_3.stdout split_x32_4.stdout split_x32_r.stdout
  2470. SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
  2471. split_x32_1.o: split_x32_1.s
  2472. $(TEST_AS) -o $@ $<
  2473. split_x32_2.o: split_x32_2.s
  2474. $(TEST_AS) -o $@ $<
  2475. split_x32_3.o: split_x32_3.s
  2476. $(TEST_AS) -o $@ $<
  2477. split_x32_4.o: split_x32_4.s
  2478. $(TEST_AS) -o $@ $<
  2479. split_x32_n.o: split_x32_n.s
  2480. $(TEST_AS) -o $@ $<
  2481. split_x32_1: split_x32_1.o split_x32_n.o ../ld-new
  2482. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_1.o split_x32_n.o
  2483. split_x32_1.stdout: split_x32_1
  2484. $(TEST_OBJDUMP) -d $< > $@
  2485. split_x32_2: split_x32_2.o split_x32_n.o ../ld-new
  2486. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_2.o split_x32_n.o
  2487. split_x32_2.stdout: split_x32_2
  2488. $(TEST_OBJDUMP) -d $< > $@
  2489. split_x32_3.stdout: split_x32_3.o split_x32_n.o ../ld-new
  2490. ../ld-new $(SPLIT_DEFSYMS) -o split_x32_3 split_x32_3.o split_x32_n.o > $@ 2>&1 || exit 0
  2491. split_x32_4: split_x32_4.o split_x32_n.o ../ld-new
  2492. ../ld-new $(SPLIT_DEFSYMS) -o $@ split_x32_4.o split_x32_n.o
  2493. split_x32_4.stdout: split_x32_4
  2494. $(TEST_OBJDUMP) -d $< > $@
  2495. split_x32_r.stdout: split_x32_1.o split_x32_n.o ../ld-new
  2496. ../ld-new -r split_x32_1.o split_x32_n.o -o split_x32_r > $@ 2>&1 || exit 0
  2497. MOSTLYCLEANFILES += split_x32_1 split_x32_2 split_x32_3 \
  2498. split_x32_4 split_x32_r
  2499. endif DEFAULT_TARGET_X32
  2500. if DEFAULT_TARGET_ARM
  2501. check_SCRIPTS += arm_abs_global.sh
  2502. check_DATA += arm_abs_global.stdout
  2503. arm_abs_lib.o: arm_abs_lib.s
  2504. $(TEST_AS) -march=armv7-a -o $@ $<
  2505. libarm_abs.so: arm_abs_lib.o ../ld-new
  2506. ../ld-new -shared -o $@ arm_abs_lib.o
  2507. arm_abs_global.o: arm_abs_global.s
  2508. $(TEST_AS) -march=armv7-a -o $@ $<
  2509. arm_abs_global: arm_abs_global.o libarm_abs.so ../ld-new
  2510. ../ld-new -o $@ arm_abs_global.o -L. -larm_abs
  2511. arm_abs_global.stdout: arm_abs_global
  2512. $(TEST_READELF) -r $< > $@
  2513. MOSTLYCLEANFILES += arm_abs_global
  2514. check_SCRIPTS += arm_branch_in_range.sh arm_branch_out_of_range.sh
  2515. check_DATA += arm_bl_in_range.stdout arm_bl_out_of_range.stdout \
  2516. thumb_bl_in_range.stdout thumb_bl_out_of_range.stdout \
  2517. thumb2_bl_in_range.stdout thumb2_bl_out_of_range.stdout \
  2518. thumb_blx_in_range.stdout thumb_blx_out_of_range.stdout \
  2519. thumb2_blx_in_range.stdout thumb2_blx_out_of_range.stdout \
  2520. thumb_bl_out_of_range_local.stdout arm_thm_jump11.stdout \
  2521. arm_thm_jump8.stdout
  2522. arm_bl_in_range.stdout: arm_bl_in_range
  2523. $(TEST_OBJDUMP) -D $< > $@
  2524. arm_bl_in_range: arm_bl_in_range.o ../ld-new
  2525. ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
  2526. arm_bl_in_range.o: arm_bl_in_range.s
  2527. $(TEST_AS) -o $@ $<
  2528. arm_bl_out_of_range.stdout: arm_bl_out_of_range
  2529. $(TEST_OBJDUMP) -S $< > $@
  2530. arm_bl_out_of_range: arm_bl_out_of_range.o ../ld-new
  2531. ../ld-new -T $(srcdir)/arm_branch_range.t -o $@ $<
  2532. arm_bl_out_of_range.o: arm_bl_out_of_range.s
  2533. $(TEST_AS) -o $@ $<
  2534. thumb_bl_in_range.stdout: thumb_bl_in_range
  2535. $(TEST_OBJDUMP) -D $< > $@
  2536. thumb_bl_in_range: thumb_bl_in_range.o ../ld-new
  2537. ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
  2538. thumb_bl_in_range.o: thumb_bl_in_range.s
  2539. $(TEST_AS) -o $@ -march=armv5te $<
  2540. thumb_bl_out_of_range.stdout: thumb_bl_out_of_range
  2541. $(TEST_OBJDUMP) -D $< > $@
  2542. thumb_bl_out_of_range: thumb_bl_out_of_range.o ../ld-new
  2543. ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
  2544. thumb_bl_out_of_range.o: thumb_bl_out_of_range.s
  2545. $(TEST_AS) -o $@ -march=armv5te $<
  2546. thumb2_bl_in_range.stdout: thumb2_bl_in_range
  2547. $(TEST_OBJDUMP) -D $< > $@
  2548. thumb2_bl_in_range: thumb2_bl_in_range.o ../ld-new
  2549. ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
  2550. thumb2_bl_in_range.o: thumb_bl_in_range.s
  2551. $(TEST_AS) -o $@ -march=armv7-a $<
  2552. thumb2_bl_out_of_range.stdout: thumb2_bl_out_of_range
  2553. $(TEST_OBJDUMP) -D $< > $@
  2554. thumb2_bl_out_of_range: thumb2_bl_out_of_range.o ../ld-new
  2555. ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
  2556. thumb2_bl_out_of_range.o: thumb_bl_out_of_range.s
  2557. $(TEST_AS) -o $@ -march=armv7-a $<
  2558. thumb_blx_in_range.stdout: thumb_blx_in_range
  2559. $(TEST_OBJDUMP) -D $< > $@
  2560. thumb_blx_in_range: thumb_blx_in_range.o ../ld-new
  2561. ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
  2562. thumb_blx_in_range.o: thumb_blx_in_range.s
  2563. $(TEST_AS) -o $@ -march=armv5te $<
  2564. thumb_blx_out_of_range.stdout: thumb_blx_out_of_range
  2565. $(TEST_OBJDUMP) -D $< > $@
  2566. thumb_blx_out_of_range: thumb_blx_out_of_range.o ../ld-new
  2567. ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
  2568. thumb_blx_out_of_range.o: thumb_blx_out_of_range.s
  2569. $(TEST_AS) -o $@ -march=armv5te $<
  2570. thumb2_blx_in_range.stdout: thumb2_blx_in_range
  2571. $(TEST_OBJDUMP) -D $< > $@
  2572. thumb2_blx_in_range: thumb2_blx_in_range.o ../ld-new
  2573. ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
  2574. thumb2_blx_in_range.o: thumb_blx_in_range.s
  2575. $(TEST_AS) -o $@ -march=armv7-a $<
  2576. thumb2_blx_out_of_range.stdout: thumb2_blx_out_of_range
  2577. $(TEST_OBJDUMP) -D $< > $@
  2578. thumb2_blx_out_of_range: thumb2_blx_out_of_range.o ../ld-new
  2579. ../ld-new -T $(srcdir)/thumb2_branch_range.t -o $@ $<
  2580. thumb2_blx_out_of_range.o: thumb_blx_out_of_range.s
  2581. $(TEST_AS) -o $@ -march=armv7-a $<
  2582. thumb_bl_out_of_range_local.stdout: thumb_bl_out_of_range_local
  2583. $(TEST_OBJDUMP) -D $< > $@
  2584. thumb_bl_out_of_range_local: thumb_bl_out_of_range_local.o ../ld-new
  2585. ../ld-new --no-fix-arm1176 -T $(srcdir)/thumb_branch_range.t -o $@ $<
  2586. thumb_bl_out_of_range_local.o: thumb_bl_out_of_range_local.s
  2587. $(TEST_AS) -o $@ -march=armv5te $<
  2588. arm_thm_jump11.stdout: arm_thm_jump11
  2589. $(TEST_OBJDUMP) -D $< > $@
  2590. arm_thm_jump11: arm_thm_jump11.o ../ld-new
  2591. ../ld-new -T $(srcdir)/arm_thm_jump11.t -o $@ $<
  2592. arm_thm_jump11.o: arm_thm_jump11.s
  2593. $(TEST_AS) -o $@ $<
  2594. arm_thm_jump8.stdout: arm_thm_jump8
  2595. $(TEST_OBJDUMP) -D $< > $@
  2596. arm_thm_jump8: arm_thm_jump8.o ../ld-new
  2597. ../ld-new -T $(srcdir)/arm_thm_jump8.t -o $@ $<
  2598. arm_thm_jump8.o: arm_thm_jump8.s
  2599. $(TEST_AS) -o $@ $<
  2600. MOSTLYCLEANFILES += arm_bl_in_range arm_bl_out_of_range thumb_bl_in_range \
  2601. thumb_bl_out_of_range thumb2_bl_in_range thumb2_bl_out_of_range \
  2602. thumb_blx_in_range thumb_blx_out_of_range thumb2_blx_in_range \
  2603. thumb2_blx_out_of_range thumb_bl_out_of_range_local arm_thm_jump11 \
  2604. arm_thm_jump8
  2605. check_SCRIPTS += arm_fix_v4bx.sh
  2606. check_DATA += arm_fix_v4bx.stdout arm_fix_v4bx_interworking.stdout \
  2607. arm_no_fix_v4bx.stdout
  2608. arm_fix_v4bx.stdout: arm_fix_v4bx
  2609. $(TEST_OBJDUMP) -D -j.text $< > $@
  2610. arm_fix_v4bx: arm_fix_v4bx.o ../ld-new
  2611. ../ld-new --no-fix-arm1176 --fix-v4bx -o $@ $<
  2612. arm_fix_v4bx.o: arm_fix_v4bx.s
  2613. $(TEST_AS) -o $@ $<
  2614. arm_fix_v4bx_interworking.stdout: arm_fix_v4bx_interworking
  2615. $(TEST_OBJDUMP) -D -j.text $< > $@
  2616. arm_fix_v4bx_interworking: arm_fix_v4bx.o ../ld-new
  2617. ../ld-new --no-fix-arm1176 --fix-v4bx-interworking -o $@ $<
  2618. arm_no_fix_v4bx.stdout: arm_no_fix_v4bx
  2619. $(TEST_OBJDUMP) -D -j.text $< > $@
  2620. arm_no_fix_v4bx: arm_fix_v4bx.o ../ld-new
  2621. ../ld-new --no-fix-arm1176 -o $@ $<
  2622. MOSTLYCLEANFILES += arm_fix_v4bx arm_fix_v4bx_interworking arm_no_fix_v4bx
  2623. check_SCRIPTS += arm_attr_merge.sh
  2624. check_DATA += arm_attr_merge_6.stdout arm_attr_merge_6r.stdout \
  2625. arm_attr_merge_7.stdout
  2626. arm_attr_merge_6.stdout: arm_attr_merge_6
  2627. $(TEST_READELF) -A $< > $@
  2628. arm_attr_merge_6: arm_attr_merge_6a.o arm_attr_merge_6b.o
  2629. ../ld-new -o $@ arm_attr_merge_6a.o arm_attr_merge_6b.o
  2630. arm_attr_merge_6a.o: arm_attr_merge_6a.s
  2631. $(TEST_AS) -o $@ $<
  2632. arm_attr_merge_6b.o: arm_attr_merge_6b.s
  2633. $(TEST_AS) -o $@ $<
  2634. arm_attr_merge_6r.stdout: arm_attr_merge_6r
  2635. $(TEST_READELF) -A $< > $@
  2636. arm_attr_merge_6r: arm_attr_merge_6b.o arm_attr_merge_6a.o
  2637. ../ld-new -o $@ arm_attr_merge_6b.o arm_attr_merge_6a.o
  2638. arm_attr_merge_7.stdout: arm_attr_merge_7
  2639. $(TEST_READELF) -A $< > $@
  2640. arm_attr_merge_7: arm_attr_merge_7a.o arm_attr_merge_7b.o
  2641. ../ld-new -o $@ arm_attr_merge_7a.o arm_attr_merge_7b.o
  2642. arm_attr_merge_7a.o: arm_attr_merge_7a.s
  2643. $(TEST_AS) -o $@ $<
  2644. arm_attr_merge_7b.o: arm_attr_merge_7b.s
  2645. $(TEST_AS) -o $@ $<
  2646. MOSTLYCLEANFILES += arm_attr_merge_6 arm_attr_merge_6r arm_attr_merge_7
  2647. # ARM1176 workaround test.
  2648. check_SCRIPTS += arm_fix_1176.sh
  2649. check_DATA += arm_fix_1176_default_v6z.stdout arm_fix_1176_on_v6z.stdout \
  2650. arm_fix_1176_off_v6z.stdout arm_fix_1176_default_v5te.stdout \
  2651. arm_fix_1176_default_v7a.stdout arm_fix_1176_default_1156t2f_s.stdout
  2652. arm_fix_1176_default_v6z.stdout: arm_fix_1176_default_v6z
  2653. $(TEST_OBJDUMP) -D -j.foo $< > $@
  2654. arm_fix_1176_default_v6z: arm_fix_1176_default_v6z.o ../ld-new
  2655. ../ld-new --section-start=.foo=0x2001014 -o $@ $<
  2656. arm_fix_1176_default_v6z.o: arm_fix_1176.s
  2657. $(TEST_AS) -march=armv6z -o $@ $<
  2658. arm_fix_1176_on_v6z.stdout: arm_fix_1176_on_v6z
  2659. $(TEST_OBJDUMP) -D -j.foo $< > $@
  2660. arm_fix_1176_on_v6z: arm_fix_1176_on_v6z.o ../ld-new
  2661. ../ld-new --section-start=.foo=0x2001014 --fix-arm1176 -o $@ $<
  2662. arm_fix_1176_on_v6z.o: arm_fix_1176.s
  2663. $(TEST_AS) -march=armv6z -o $@ $<
  2664. arm_fix_1176_off_v6z.stdout: arm_fix_1176_off_v6z
  2665. $(TEST_OBJDUMP) -D -j.foo $< > $@
  2666. arm_fix_1176_off_v6z: arm_fix_1176_off_v6z.o ../ld-new
  2667. ../ld-new --section-start=.foo=0x2001014 --no-fix-arm1176 -o $@ $<
  2668. arm_fix_1176_off_v6z.o: arm_fix_1176.s
  2669. $(TEST_AS) -march=armv6z -o $@ $<
  2670. arm_fix_1176_default_v5te.stdout: arm_fix_1176_default_v5te
  2671. $(TEST_OBJDUMP) -D -j.foo $< > $@
  2672. arm_fix_1176_default_v5te: arm_fix_1176_default_v5te.o ../ld-new
  2673. ../ld-new --section-start=.foo=0x2001014 -o $@ $<
  2674. arm_fix_1176_default_v5te.o: arm_fix_1176.s
  2675. $(TEST_AS) -march=armv5te -o $@ $<
  2676. arm_fix_1176_default_v7a.stdout: arm_fix_1176_default_v7a
  2677. $(TEST_OBJDUMP) -D -j.foo $< > $@
  2678. arm_fix_1176_default_v7a: arm_fix_1176_default_v7a.o ../ld-new
  2679. ../ld-new --section-start=.foo=0x2001014 -o $@ $<
  2680. arm_fix_1176_default_v7a.o: arm_fix_1176.s
  2681. $(TEST_AS) -march=armv7-a -o $@ $<
  2682. arm_fix_1176_default_1156t2f_s.stdout: arm_fix_1176_default_1156t2f_s
  2683. $(TEST_OBJDUMP) -D -j.foo $< > $@
  2684. arm_fix_1176_default_1156t2f_s: arm_fix_1176_default_1156t2f_s.o ../ld-new
  2685. ../ld-new --section-start=.foo=0x2001014 -o $@ $<
  2686. arm_fix_1176_default_1156t2f_s.o: arm_fix_1176.s
  2687. $(TEST_AS) -mcpu=arm1156t2f-s -o $@ $<
  2688. MOSTLYCLEANFILES += arm_fix_1176_default_v6z arm_fix_1176_on_v6z arm_fix_1176_off_v6z \
  2689. arm_fix_1176_default_v5te arm_fix_1176_default_v7a arm_fix_1176_default_1156t2f_s
  2690. # Cortex-A8 workaround test.
  2691. check_SCRIPTS += arm_cortex_a8.sh
  2692. check_DATA += arm_cortex_a8_b_cond.stdout arm_cortex_a8_b.stdout \
  2693. arm_cortex_a8_bl.stdout arm_cortex_a8_blx.stdout \
  2694. arm_cortex_a8_local.stdout arm_cortex_a8_local_reloc.stdout
  2695. arm_cortex_a8_b_cond.stdout: arm_cortex_a8_b_cond
  2696. $(TEST_OBJDUMP) -D -j.text $< > $@
  2697. arm_cortex_a8_b_cond: arm_cortex_a8_b_cond.o ../ld-new
  2698. ../ld-new -o $@ $<
  2699. arm_cortex_a8_b_cond.o: arm_cortex_a8_b_cond.s
  2700. $(TEST_AS) -o $@ $<
  2701. arm_cortex_a8_b.stdout: arm_cortex_a8_b
  2702. $(TEST_OBJDUMP) -D -j.text $< > $@
  2703. arm_cortex_a8_b: arm_cortex_a8_b.o ../ld-new
  2704. ../ld-new --fix-cortex-a8 -o $@ $<
  2705. arm_cortex_a8_b.o: arm_cortex_a8_b.s
  2706. $(TEST_AS) -o $@ $<
  2707. arm_cortex_a8_bl.stdout: arm_cortex_a8_bl
  2708. $(TEST_OBJDUMP) -D -j.text $< > $@
  2709. arm_cortex_a8_bl: arm_cortex_a8_bl.o ../ld-new
  2710. ../ld-new -o $@ $<
  2711. arm_cortex_a8_bl.o: arm_cortex_a8_bl.s
  2712. $(TEST_AS) -o $@ $<
  2713. arm_cortex_a8_blx.stdout: arm_cortex_a8_blx
  2714. $(TEST_OBJDUMP) -D -j.text $< > $@
  2715. arm_cortex_a8_blx: arm_cortex_a8_blx.o ../ld-new
  2716. ../ld-new -o $@ $<
  2717. arm_cortex_a8_blx.o: arm_cortex_a8_blx.s
  2718. $(TEST_AS) -o $@ $<
  2719. arm_cortex_a8_local.stdout: arm_cortex_a8_local
  2720. $(TEST_OBJDUMP) -D -j.text $< > $@
  2721. arm_cortex_a8_local: arm_cortex_a8_local.o ../ld-new
  2722. ../ld-new -o $@ $<
  2723. arm_cortex_a8_local.o: arm_cortex_a8_local.s
  2724. $(TEST_AS) -o $@ $<
  2725. arm_cortex_a8_local_reloc.stdout: arm_cortex_a8_local_reloc
  2726. $(TEST_OBJDUMP) -D -j.text $< > $@
  2727. arm_cortex_a8_local_reloc: arm_cortex_a8_local_reloc.o ../ld-new
  2728. ../ld-new -o $@ $<
  2729. arm_cortex_a8_local_reloc.o: arm_cortex_a8_local_reloc.s
  2730. $(TEST_AS) -o $@ $<
  2731. MOSTLYCLEANFILES += arm_cortex_a8_b_cond arm_cortex_a8_b arm_cortex_a8_bl \
  2732. arm_cortex_a8_blx arm_cortex_a8_local arm_cortex_a8_local_reloc
  2733. check_SCRIPTS += arm_exidx_test.sh
  2734. check_DATA += arm_exidx_test.stdout
  2735. arm_exidx_test.stdout: arm_exidx_test.so
  2736. $(TEST_READELF) -Sr $< > $@
  2737. arm_exidx_test.so: arm_exidx_test.o ../ld-new
  2738. ../ld-new -shared -o $@ $<
  2739. arm_exidx_test.o: arm_exidx_test.s
  2740. $(TEST_AS) -o $@ $<
  2741. check_SCRIPTS += pr12826.sh
  2742. check_DATA += pr12826.stdout
  2743. pr12826.stdout: pr12826.so
  2744. $(TEST_READELF) -A $< > $@
  2745. pr12826.so: pr12826_1.o pr12826_2.o ../ld-new
  2746. ../ld-new -shared -o $@ $<
  2747. pr12826_1.o: pr12826_1.s
  2748. $(TEST_AS) -o $@ $<
  2749. pr12826_2.o: pr12826_2.s
  2750. $(TEST_AS) -o $@ $<
  2751. check_SCRIPTS += arm_unaligned_reloc.sh
  2752. check_DATA += arm_unaligned_reloc.stdout arm_unaligned_reloc_r.stdout
  2753. arm_unaligned_reloc.stdout: arm_unaligned_reloc
  2754. $(TEST_OBJDUMP) -D $< > $@
  2755. arm_unaligned_reloc_r.stdout: arm_unaligned_reloc_r
  2756. $(TEST_OBJDUMP) -Dr $< > $@
  2757. arm_unaligned_reloc: arm_unaligned_reloc.o ../ld-new
  2758. ../ld-new -o $@ $<
  2759. arm_unaligned_reloc_r: arm_unaligned_reloc.o ../ld-new
  2760. ../ld-new -r -o $@ $<
  2761. arm_unaligned_reloc.o: arm_unaligned_reloc.s
  2762. $(TEST_AS) -o $@ $<
  2763. MOSTLYCLEANFILES += arm_unaligned_reloc arm_unaligned_reloc_r
  2764. # Check ARM to ARM farcall veneers
  2765. check_SCRIPTS += arm_farcall_arm_arm.sh
  2766. check_DATA += arm_farcall_arm_arm.stdout
  2767. arm_farcall_arm_arm.stdout: arm_farcall_arm_arm
  2768. $(TEST_OBJDUMP) -d $< > $@
  2769. arm_farcall_arm_arm: arm_farcall_arm_arm.o ../ld-new
  2770. ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001020 -o $@ $<
  2771. arm_farcall_arm_arm.o: arm_farcall_arm_arm.s
  2772. $(TEST_AS) -o $@ $<
  2773. MOSTLYCLEANFILES += arm_farcall_arm_arm
  2774. # Check ARM to Thumb farcall veneers
  2775. check_SCRIPTS += arm_farcall_arm_thumb.sh
  2776. check_DATA += arm_farcall_arm_thumb.stdout arm_farcall_arm_thumb_5t.stdout
  2777. arm_farcall_arm_thumb.stdout: arm_farcall_arm_thumb
  2778. $(TEST_OBJDUMP) -D $< > $@
  2779. arm_farcall_arm_thumb: arm_farcall_arm_thumb.o ../ld-new
  2780. ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
  2781. arm_farcall_arm_thumb.o: arm_farcall_arm_thumb.s
  2782. $(TEST_AS) -o $@ $<
  2783. arm_farcall_arm_thumb_5t.stdout: arm_farcall_arm_thumb_5t
  2784. $(TEST_OBJDUMP) -D $< > $@
  2785. arm_farcall_arm_thumb_5t: arm_farcall_arm_thumb_5t.o ../ld-new
  2786. ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
  2787. arm_farcall_arm_thumb_5t.o: arm_farcall_arm_thumb.s
  2788. $(TEST_AS) -march=armv5t -o $@ $<
  2789. MOSTLYCLEANFILES += arm_farcall_arm_thumb arm_farcall_arm_thumb_5t
  2790. # Check Thumb to Thumb farcall veneers
  2791. check_SCRIPTS += arm_farcall_thumb_thumb.sh
  2792. check_DATA += arm_farcall_thumb_thumb.stdout \
  2793. arm_farcall_thumb_thumb_5t.stdout \
  2794. arm_farcall_thumb_thumb_7m.stdout \
  2795. arm_farcall_thumb_thumb_6m.stdout
  2796. arm_farcall_thumb_thumb.stdout: arm_farcall_thumb_thumb
  2797. $(TEST_OBJDUMP) -D $< > $@
  2798. arm_farcall_thumb_thumb: arm_farcall_thumb_thumb.o ../ld-new
  2799. ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
  2800. arm_farcall_thumb_thumb.o: arm_farcall_thumb_thumb.s
  2801. $(TEST_AS) -march=armv4t -o $@ $<
  2802. arm_farcall_thumb_thumb_5t.stdout: arm_farcall_thumb_thumb_5t
  2803. $(TEST_OBJDUMP) -D $< > $@
  2804. arm_farcall_thumb_thumb_5t: arm_farcall_thumb_thumb_5t.o ../ld-new
  2805. ../ld-new --no-fix-arm1176 --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
  2806. arm_farcall_thumb_thumb_5t.o: arm_farcall_thumb_thumb.s
  2807. $(TEST_AS) -march=armv5t -o $@ $<
  2808. arm_farcall_thumb_thumb_7m.stdout: arm_farcall_thumb_thumb_7m
  2809. $(TEST_OBJDUMP) -D $< > $@
  2810. arm_farcall_thumb_thumb_7m: arm_farcall_thumb_thumb_7m.o ../ld-new
  2811. ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
  2812. arm_farcall_thumb_thumb_7m.o: arm_farcall_thumb_thumb.s
  2813. $(TEST_AS) -march=armv7-m -o $@ $<
  2814. arm_farcall_thumb_thumb_6m.stdout: arm_farcall_thumb_thumb_6m
  2815. $(TEST_OBJDUMP) -D $< > $@
  2816. arm_farcall_thumb_thumb_6m: arm_farcall_thumb_thumb_6m.o ../ld-new
  2817. ../ld-new --section-start .text=0x1000 --section-start .foo=0x2001014 -o $@ $<
  2818. arm_farcall_thumb_thumb_6m.o: arm_farcall_thumb_thumb.s
  2819. $(TEST_AS) -march=armv6-m -o $@ $<
  2820. MOSTLYCLEANFILES += arm_farcall_thumb_thumb arm_farcall_thumb_thumb_5t \
  2821. arm_farcall_thumb_thumb_7m arm_farcall_thumb_thumb_6m
  2822. # Check Thumb to ARM farcall veneers
  2823. check_SCRIPTS += arm_farcall_thumb_arm.sh
  2824. check_DATA += arm_farcall_thumb_arm.stdout \
  2825. arm_farcall_thumb_arm_5t.stdout
  2826. arm_farcall_thumb_arm.stdout: arm_farcall_thumb_arm
  2827. $(TEST_OBJDUMP) -D $< > $@
  2828. arm_farcall_thumb_arm: arm_farcall_thumb_arm.o ../ld-new
  2829. ../ld-new --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
  2830. arm_farcall_thumb_arm.o: arm_farcall_thumb_arm.s
  2831. $(TEST_AS) -o $@ $<
  2832. arm_farcall_thumb_arm_5t.stdout: arm_farcall_thumb_arm_5t
  2833. $(TEST_OBJDUMP) -D $< > $@
  2834. arm_farcall_thumb_arm_5t: arm_farcall_thumb_arm_5t.o ../ld-new
  2835. ../ld-new --no-fix-arm1176 --section-start .text=0x1c01010 --section-start .foo=0x2001014 -o $@ $<
  2836. arm_farcall_thumb_arm_5t.o: arm_farcall_thumb_arm.s
  2837. $(TEST_AS) -march=armv5t -o $@ $<
  2838. MOSTLYCLEANFILES += arm_farcall_thumb_arm arm_farcall_thumb_arm_5t
  2839. endif DEFAULT_TARGET_ARM
  2840. endif NATIVE_OR_CROSS_LINKER
  2841. # Tests for the dwp tool.
  2842. # We don't want to rely yet on GCC support for -gsplit-dwarf,
  2843. # so we use (for now) test cases in x86 assembly language,
  2844. # compiled from the dwp_test_*.cc sources.
  2845. if DEFAULT_TARGET_X86_64
  2846. dwp_test_main.o: dwp_test_main.s
  2847. $(TEST_AS) -o $@ $<
  2848. dwp_test_1.o: dwp_test_1.s
  2849. $(TEST_AS) -o $@ $<
  2850. dwp_test_1b.o: dwp_test_1b.s
  2851. $(TEST_AS) -o $@ $<
  2852. dwp_test_2.o: dwp_test_2.s
  2853. $(TEST_AS) -o $@ $<
  2854. dwp_test_main.dwo: dwp_test_main.o
  2855. $(TEST_OBJCOPY) --extract-dwo $< $@
  2856. dwp_test_1.dwo: dwp_test_1.o
  2857. $(TEST_OBJCOPY) --extract-dwo $< $@
  2858. dwp_test_1b.dwo: dwp_test_1b.o
  2859. $(TEST_OBJCOPY) --extract-dwo $< $@
  2860. dwp_test_2.dwo: dwp_test_2.o
  2861. $(TEST_OBJCOPY) --extract-dwo $< $@
  2862. MOSTLYCLEANFILES += *.dwo *.dwp
  2863. check_SCRIPTS += dwp_test_1.sh
  2864. check_DATA += dwp_test_1.stdout
  2865. dwp_test_1.stdout: dwp_test_1.dwp
  2866. $(TEST_READELF) -wi $< > $@
  2867. dwp_test_1.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
  2868. ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo dwp_test_1b.dwo dwp_test_2.dwo
  2869. check_SCRIPTS += dwp_test_2.sh
  2870. check_DATA += dwp_test_2.stdout
  2871. dwp_test_2.stdout: dwp_test_2.dwp
  2872. $(TEST_READELF) -wi $< > $@
  2873. dwp_test_2.dwp: ../dwp dwp_test_2a.dwp dwp_test_2b.dwp
  2874. ../dwp -o $@ dwp_test_2a.dwp dwp_test_2b.dwp
  2875. dwp_test_2a.dwp: ../dwp dwp_test_main.dwo dwp_test_1.dwo
  2876. ../dwp -o $@ dwp_test_main.dwo dwp_test_1.dwo
  2877. dwp_test_2b.dwp: ../dwp dwp_test_1b.dwo dwp_test_2.dwo
  2878. ../dwp -o $@ dwp_test_1b.dwo dwp_test_2.dwo
  2879. endif DEFAULT_TARGET_X86_64