From: Hans-Peter Nilsson Date: Wed, 31 Mar 2010 13:23:40 +0000 (+0000) Subject: PR ld/11458 X-Git-Tag: sid-snapshot-20100401~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bb4a8e71062e9ca56a7a18662b8157457c99d9a3;p=external%2Fbinutils.git PR ld/11458 * ld-cris/pcrelcp-1.d, ld-cris/pcrelcp-1.s: New test. --- diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index c2c6d46..d8d0475 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2010-03-31 Hans-Peter Nilsson + PR ld/11458 + * ld-cris/pcrelcp-1.d, ld-cris/pcrelcp-1.s: New test. + * lib/ld-lib.exp (run_dump_test): When checking linker message and return code, when success with no message is expected, don't continue if we have an abnormal exit with a message. Check output diff --git a/ld/testsuite/ld-cris/pcrelcp-1.d b/ld/testsuite/ld-cris/pcrelcp-1.d new file mode 100644 index 0000000..95fb235 --- /dev/null +++ b/ld/testsuite/ld-cris/pcrelcp-1.d @@ -0,0 +1,34 @@ +#as: --no-underscore --em=criself +#ld: -shared -m crislinux -z nocombreloc +#ld_after_inputfiles: tmpdir/libdso-1b.so +#warning: \A[^\n]*\.o, section `.text', to symbol `expfn@@TST2':\n +#warning: [^\n]*recompile with -fPIC\Z +#readelf: -a + +# Building a DSO with (unrecommended) non-pic pc-relative references +# to a versioned symbol in a library got caught by an assert in +# elf_cris_copy_indirect_symbol wherein the list of pc-relative +# references wasn't merged, but simply asserted to be NULL before +# copied to, on the merged-to (direct) symbol. For versioned symbols, +# there was an "extra" copy made, to make a base-version symbol, where +# the copied-from pc-relative list was NULL but the copied-to symbol +# already had a list merged. + +# The list was used to emit warning messages, but incorrectly held the +# relocation section for the reference, resulting in warnings being +# emitted for any section with a pc-relative relocation. + +# The test checks that there's a warning message only for the +# read-only sections section (.text) (not the read-write sections), +# that the correct number of relocations is emitted and we also check +# for the TEXTREL dynamic marker. + +#... + 0x00000016 \(TEXTREL\)[ ]+0x0 +#... +Relocation section '\.rela\.text' at offset .* contains 4 entries: +#... +Relocation section '\.rela\.data' at offset .* contains 8 entries: +#... +Relocation section '.rela.data2' at offset .* contains 16 entries: +#pass diff --git a/ld/testsuite/ld-cris/pcrelcp-1.s b/ld/testsuite/ld-cris/pcrelcp-1.s new file mode 100644 index 0000000..d1bcbee --- /dev/null +++ b/ld/testsuite/ld-cris/pcrelcp-1.s @@ -0,0 +1,50 @@ + .symver x,expfn@TST2 ; .symver required to make @ part of name. + .global _start + .type _start,@function +_start: + .dword 0,0,0,0 + .reloc 0,R_CRIS_32_PCREL,expfn + .reloc 4,R_CRIS_32_PCREL,expfn + .reloc 8,R_CRIS_32_PCREL,x + .reloc 12,R_CRIS_32_PCREL,x +.Lfe3: + .size _start,.Lfe3-_start + + .data + .global tab1 + .type tab1,@object +tab1: + .dword 0,0,0,0,0,0,0,0 + .reloc 0,R_CRIS_32_PCREL,expfn + .reloc 4,R_CRIS_32_PCREL,expfn + .reloc 8,R_CRIS_32_PCREL,expfn + .reloc 12,R_CRIS_32_PCREL,expfn + .reloc 16,R_CRIS_32_PCREL,x + .reloc 20,R_CRIS_32_PCREL,x + .reloc 24,R_CRIS_32_PCREL,x + .reloc 28,R_CRIS_32_PCREL,x + .size tab1,.-tab1 + + .section .data2,"aw",@progbits + .global tab2 + .type tab2,@object +tab2: + .dword 0,0,0,0,0,0,0,0 + .dword 0,0,0,0,0,0,0,0 + .reloc 0,R_CRIS_32_PCREL,expfn + .reloc 4,R_CRIS_32_PCREL,expfn + .reloc 8,R_CRIS_32_PCREL,expfn + .reloc 12,R_CRIS_32_PCREL,expfn + .reloc 16,R_CRIS_32_PCREL,expfn + .reloc 20,R_CRIS_32_PCREL,expfn + .reloc 24,R_CRIS_32_PCREL,expfn + .reloc 28,R_CRIS_32_PCREL,expfn + .reloc 32,R_CRIS_32_PCREL,x + .reloc 36,R_CRIS_32_PCREL,x + .reloc 40,R_CRIS_32_PCREL,x + .reloc 44,R_CRIS_32_PCREL,x + .reloc 48,R_CRIS_32_PCREL,x + .reloc 52,R_CRIS_32_PCREL,x + .reloc 56,R_CRIS_32_PCREL,x + .reloc 60,R_CRIS_32_PCREL,x + .size tab1,.-tab2