Commit 1ed8c137304c8bd19eeadc98a376dfec9575ebe0

Authored by T Karthik Reddy
Committed by Michal Simek
1 parent ef92ed26a5

common: image-sig.c: Add manual relocation

This patch adds manual relocation for struct checksum_algo & struct
crypto_algo structures.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Showing 1 changed file with 29 additions and 0 deletions Side-by-side Diff

... ... @@ -89,6 +89,21 @@
89 89 int i;
90 90 const char *name;
91 91  
  92 +#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
  93 + static bool done;
  94 +
  95 + if (!done) {
  96 + done = true;
  97 + for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) {
  98 + checksum_algos[i].name += gd->reloc_off;
  99 +#if IMAGE_ENABLE_SIGN
  100 + checksum_algos[i].calculate_sign += gd->reloc_off;
  101 +#endif
  102 + checksum_algos[i].calculate += gd->reloc_off;
  103 + }
  104 + }
  105 +#endif
  106 +
92 107 for (i = 0; i < ARRAY_SIZE(checksum_algos); i++) {
93 108 name = checksum_algos[i].name;
94 109 /* Make sure names match and next char is a comma */
... ... @@ -104,6 +119,20 @@
104 119 {
105 120 int i;
106 121 const char *name;
  122 +
  123 +#if !defined(USE_HOSTCC) && defined(CONFIG_NEEDS_MANUAL_RELOC)
  124 + static bool done;
  125 +
  126 + if (!done) {
  127 + done = true;
  128 + for (i = 0; i < ARRAY_SIZE(crypto_algos); i++) {
  129 + crypto_algos[i].name += gd->reloc_off;
  130 + crypto_algos[i].sign += gd->reloc_off;
  131 + crypto_algos[i].add_verify_data += gd->reloc_off;
  132 + crypto_algos[i].verify += gd->reloc_off;
  133 + }
  134 + }
  135 +#endif
107 136  
108 137 /* Move name to after the comma */
109 138 name = strchr(full_name, ',');