How to control Arm relocation types

Hi,

I'm working on bringing up the thumbv7m-unknown-linux-uclibc target and I think I'm nearing the final hurdle!

One of the final steps of this build process is using the elf2flt tool to produce a binary in the correct bFLT format. The errors elf2flt current generates involve symbol relocation types. Here are the two errors I'm seeing:

arm-2010q1/arm-uclinuxeabi/bin/elf2flt: error: reloc type R_ARM_ABS32 is not supported for PIC
arm-2010q1/arm-uclinuxeabi/bin/elf2flt: error: reloc type R_ARM_GOT_PREL is not supported

In total there are 462 bad relocs. I suspect most or all of these are originating in the core rust .rlib libraries linked against my executable. This has been somewhat confirmed by running readelf -r | grep GOT_PREL (or ARM_ABS32) against the .rlibs getting linked in.

My question - Is it possible to ask the LLVM components of rustc to not generate these relocation types? There appears to be some support within the LLVM linker for the flag --target2 with the options rel, got-rel, and abs (seen in the wild in this ubuntu manpage). However I am not sure how to properly use this flag via the rustc frontend.

I also am not sure if changing these reloc types is the correct question and am open to other suggestions.

My current target specification file:

{
  "arch": "arm",
  "cpu": "cortex-m3",
  "data-layout": "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64",
  "dynamic-linking": false,
  "env": "uclibc",
  "executables": true,
  "features": "+thumb-mode,+thumb2,+armv7-m,+m3,+v7",
  "has-elf-tls": false,
  "has-rpath": false,
  "linker-flavor": "gcc",
  "linker-is-gnu": true,
  "llvm-target": "thumbv7m-unknown-linux-uclibc",
  "max-atomic-width": 32,
  "os": "linux",
  "position-independent-executables": false,
  "pre-link-args": {
    "gcc": [
      "-Wl,--as-needed",
      "-Wl,-z,noexecstack",
      "-L", "/vagrant/linux-cortexm-1.14.3/A2F/root/usr/lib",
      "-mthumb",
      "-mcpu=cortex-m3"
    ]
  },
  "late-link-args": {
    "gcc": [
      "-Wl,--start-group",
      "/vagrant/linux-cortexm-1.14.3/A2F/root/usr/lib/libc.a",
      "-lpthread",
      "-lgcc",
      "-Wl,--end-group"
    ]
  },
  "relro-level": "off",
  "relocation-model": "pic",
  "target-c-int-width": "32",
  "target-endian": "little",
  "target-family": "unix",
  "target-pointer-width": "32",
  "vendor": "unknown"
}

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.