Fix handling of GNU Property notes that are not in a GNU NOTE PROPERTY section.
[deliverable/binutils-gdb.git] / ld / testsuite / ld-elf / elf.exp
index acdad8db22ae09191200849cd349905ab83690fa..8f24a75a74bc549617266d8b607e85c59bf3bcd2 100644 (file)
@@ -61,6 +61,8 @@ if { [is_remote host] } then {
     remote_download host merge.ld
 }
 
+# Note - the output file from the second test (symbol3w.a) is
+# used in the proc is_elf64 test below...
 run_ld_link_tests [list \
     [list "Build symbol3.a" \
        "" "" $hpux \
@@ -70,6 +72,41 @@ run_ld_link_tests [list \
        {symbol3w.s} {} "symbol3w.a" ] \
 ]
 
+
+# True if the object format is known to be 64-bit ELF.
+#
+proc is_elf64 { binary_file } {
+    global READELF
+    global READELFFLAGS
+
+    set readelf_size ""
+    catch "exec $READELF $READELFFLAGS -h $binary_file > readelf.out" got
+
+    if ![string match "" $got] then {
+       return 0
+    }
+
+    if { ![regexp "\n\[ \]*Class:\[ \]*ELF(\[0-9\]+)\n" \
+              [file_contents readelf.out] nil readelf_size] } {
+       verbose "FAILED to determine ELF size"
+       return 0
+    }
+
+    if { $readelf_size == "64" } {
+       return 1
+    }
+
+    return 0
+}
+
+if [is_elf64 tmpdir/symbol3w.a] {
+    set ASFLAGS "$ASFLAGS --defsym ALIGN=3"
+} else {
+    set ASFLAGS "$ASFLAGS --defsym ALIGN=2"
+}
+
+
+
 # Targets that use _bfd_generic_link_add_symbols won't pass pr21703 tests
 run_ld_link_tests {
       {"PR ld/21703"
This page took 0.028036 seconds and 4 git commands to generate.