[ARM-FDPIC 00/12] FDPIC ABI for ARM

Christophe Lyon christophe.lyon@linaro.org
Mon Mar 26 20:37:00 GMT 2018


On 26 March 2018 at 14:33, Christophe Lyon <christophe.lyon@st.com> wrote:
> Hi Nick,
>
> On 23/03/2018 16:08, Nick Clifton wrote:
>>
>> Hi Christophe,
>>
>>    As a first pass over this patch set, I applied them to the sources
>>    and ran my regression tests.  Unfortunately there were several new
>>    failures:
>>
>
> Thanks for your interest in this patch series.
>
>> Checking Binutils in: arm-none-eabi ... LD: 6  done
>>    LD REGRESSION: FDPIC ARM shared library little
>>    LD REGRESSION: FDPIC ARM dynamic executable little
>>    LD REGRESSION: FDPIC ARM shared library big
>>    LD REGRESSION: FDPIC ARM dynamic executable big
>>    LD REGRESSION: FDPIC ARM shared library little endian M profile
>>    LD REGRESSION: FDPIC ARM dynamic executable little endian M profile
>> Checking Binutils in: armeb-eabi ... LD: 6  done
>>    LD REGRESSION: FDPIC ARM shared library little
>>    LD REGRESSION: FDPIC ARM dynamic executable little
>>    LD REGRESSION: FDPIC ARM shared library big
>>    LD REGRESSION: FDPIC ARM dynamic executable big
>>    LD REGRESSION: FDPIC ARM shared library little endian M profile
>>    LD REGRESSION: FDPIC ARM dynamic executable little endian M profile
>>
>> It seems that these tests are all failing for the same reason:
>>
>>    ld-new: unrecognised emulation mode: armelf_linux_fdpiceabi
>>
>>
>> Checking Binutils in: arm-netbsdelf ... GAS: 1  LD: 2  done
>>    GAS REGRESSION: FDPIC relocations
>> Checking Binutils in: arm-nto ... GAS: 1  done
>>    GAS REGRESSION: FDPIC relocations
>>
>> Meanwhile these tests fail for a similar, but not quite the same reason:
>>
>>    Fatal error: selected target format 'elf32-littlearm-fdpic' unknown
>>
>> Would you mind fixing these up please ?
>>

Hi Nick,

The attached patch avoids running the new tests on unsupported targets.

Thanks,

Christophe

>
> I'm looking at it. All these failures are caused by the tests added by this
> series.
>
> I did test them on arm-linux-gnueabihf, armeb-linux-gnueabihf
> and-linux-uclibceabi,
> but overlooked testing on arm-eabi and others. As usual, not tested means it
> does not work :(
>
> My homework on de-hardcoding things is obviously not complete :)
>
>
> The simple route would probably be just to skip the tests on those targets,
> but I have been trying to do something better, but didn't succeed so far.
>
> Currently, gas sets the OSABI flag to ELFOSABI_ARM_FDPIC if the user
> supplied -fdpic. I think this flag should set the linker in the right
> mode (fdpic/no-fdpic).
>
> It seems I have to set arm_elf32_fdpic_le_vec as default (targ_defvec in
> config.bfd),
> such that the linker uses that in priority (otherwise arm_elf32_le_vec also
> accepts to read an FDPIC object file, but fails to flag it as "FDPIC"
> (because
> elf-object_p is happy with ELFOSABI_NONE).
>
> However, if I do that, the linker then defaults to generating FDPIC files,
> and thus breaks arm-linux-gnueabihf, unless I force -m armelf_linux_eabi.
>
> I have looked at other targets, for instance sh adds -m shelf_fd for its
> fdpic tests.
> That's what the patches I have posted do. Is this the only way?
>
> How can I have ld support both models transparently without needing to use
> -m ?
>
> Thanks,
>
> Christophe
>
>
>> Cheers
>>    Nick
>> .
>>
>
-------------- next part --------------
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c
index 216b98b..f62808f 100644
--- a/bfd/elf32-arm.c
+++ b/bfd/elf32-arm.c
@@ -20359,7 +20359,7 @@ elf32_arm_nacl_plt_sym_val (bfd_vma i, const asection *plt,
 #undef  TARGET_BIG_NAME
 #define TARGET_BIG_NAME			"elf32-bigarm-fdpic"
 #undef elf_match_priority
-#define elf_match_priority		128
+#define elf_match_priority		1
 #undef ELF_OSABI
 #define ELF_OSABI		ELFOSABI_ARM_FDPIC
 
@@ -20377,6 +20377,8 @@ elf32_arm_fdpic_link_hash_table_create (bfd *abfd)
       struct elf32_arm_link_hash_table *htab = (struct elf32_arm_link_hash_table *) ret;
 
       htab->fdpic_p = 1;
+      //      _bfd_error_handler (_("%pB: ENTERED FDPIC MODE"),
+      //			  abfd);
     }
   return ret;
 }
diff --git a/gas/testsuite/gas/arm/reloc-fdpic.d b/gas/testsuite/gas/arm/reloc-fdpic.d
index 768c3a1..bedb2ff 100644
--- a/gas/testsuite/gas/arm/reloc-fdpic.d
+++ b/gas/testsuite/gas/arm/reloc-fdpic.d
@@ -2,7 +2,7 @@
 #objdump: -dr --show-raw-insn
 #name: FDPIC relocations
 # This test is only valid on ELF based ports.
-#not-target: *-*-*coff *-*-pe *-*-wince *-*-*aout* *-*-netbsd *-*-riscix*
+#not-skip: *-*-uclibceabi
 
 .*: +file format .*arm.*
 
diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp
index 00960db..230728e 100644
--- a/ld/testsuite/ld-arm/arm-elf.exp
+++ b/ld/testsuite/ld-arm/arm-elf.exp
@@ -1016,7 +1016,9 @@ set armeabitests_nonacl {
      "" {preempt-app.s}
      {{readelf -Ds preempt-app.sym}}
      "preempt-app"}
+}
 
+set armfdpiceabitests {
     {"FDPIC ARM shared library little endian"
      "-shared -T fdpic-shared.ld --hash-style=sysv -EL -m armelf_linux_fdpiceabi" ""
      "-EL -fdpic" {fdpic-shared.s}
@@ -1081,6 +1083,10 @@ if { !$is_nacl } {
     run_ld_link_tests $armeabitests_nonacl
 }
 
+if { [istarget "arm*-linux-uclibceaci"] } {
+    run_ld_link_tests $armfdpiceabitests
+}
+
 run_dump_test "attr-merge-div-00"
 run_dump_test "attr-merge-div-01"
 run_dump_test "attr-merge-div-10"


More information about the Binutils mailing list