* reloc-macros.h: Add a comment about the use of the
authorNick Clifton <nickc@redhat.com>
Wed, 21 May 2008 14:50:07 +0000 (14:50 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 21 May 2008 14:50:07 +0000 (14:50 +0000)
        END_RELOC_NUMBERS symbol as a sentinel value.
        * arm.h (END_RELOC_NUMBERS): Provide a maximum value.

include/elf/ChangeLog
include/elf/arm.h
include/elf/reloc-macros.h

index a4288a7bad4fa57767fbf9560c8e93f52fbb0698..81f5478bcd8a2b5bdb661615823deed013b6bdbd 100644 (file)
@@ -1,3 +1,12 @@
+2008-05-21  Nick Clifton  <nickc@redhat.com>
+
+       * reloc-macros.h: Add a comment about the use of the
+       END_RELOC_NUMBERS symbol as a sentinel value.
+
+2008-05-15  Christophe Lyon  <christophe.lyon@st.com>
+       
+       * arm.h (END_RELOC_NUMBERS): Provide a maximum value.
+
 2008-04-16  David S. Miller  <davem@davemloft.net>
 
        * elf/sparc.h (R_SPARC_GOTDATA_HIX22,
index e701883387863a19cc6ad4e46dd5301cb07ce1e4..af623f1c120e1971a9dfaf075afa41e549471349 100644 (file)
@@ -234,7 +234,8 @@ START_RELOC_NUMBERS (elf_arm_reloc_type)
   FAKE_RELOC (R_ARM_GOT32,              R_ARM_GOT_BREL)   /* 32 bit GOT entry.  */
   FAKE_RELOC (R_ARM_ROSEGREL32,         R_ARM_SBREL31)    /* ??? */
   FAKE_RELOC (R_ARM_AMP_VCALL9,         R_ARM_BREL_ADJ)   /* Thumb-something.  Not used.  */
-END_RELOC_NUMBERS (R_ARM_max)
+
+END_RELOC_NUMBERS (R_ARM_max = 256)
 
 #ifdef BFD_ARCH_SIZE
 /* EABI object attributes.  */
index a67419d220ca2ae819e4c02049467dabd38f3b01..aefb85f2c11ca78eaa535d2f8458f0bc846ef781 100644 (file)
          R_foo_count
        };
 
+   Note: The value of the symbol defined in the END_RELOC_NUMBERS
+   macro (R_foo_count in the case of the example above) will be
+   set to the value of the whichever *_RELOC macro preceeds it plus
+   one.  Therefore if you intend to use the symbol as a sentinel for
+   the highest valid macro value you should make sure that the
+   preceeding *_RELOC macro is the highest valid number.  ie a
+   declaration like this:
+
+       START_RELOC_NUMBERS (foo)
+           RELOC_NUMBER (R_foo_NONE,    0)
+           RELOC_NUMBER (R_foo_32,      1)
+           FAKE_RELOC   (R_foo_illegal, 9)
+           FAKE_RELOC   (R_foo_synonym, 0)
+       END_RELOC_NUMBERS (R_foo_count)
+
+   will result in R_foo_count having a value of 1 (R_foo_synonym + 1)
+   rather than 10 or 2 as might be expected.
+
+   Alternatively you can assign a value to END_RELOC_NUMBERS symbol
+   explicitly, like this:
+
+       START_RELOC_NUMBERS (foo)
+           RELOC_NUMBER (R_foo_NONE,    0)
+           RELOC_NUMBER (R_foo_32,      1)
+           FAKE_RELOC   (R_foo_illegal, 9)
+           FAKE_RELOC   (R_foo_synonym, 0)
+       END_RELOC_NUMBERS (R_foo_count = 2)
+
    If RELOC_MACROS_GEN_FUNC *is* defined, then instead the
    following function will be generated:
 
This page took 0.026647 seconds and 4 git commands to generate.