Blame binutils-2.24-set-section-macros.patch

057864b
diff -rcp ../binutils-2.24.orig/bfd/bfd-in2.h bfd/bfd-in2.h
057864b
*** ../binutils-2.24.orig/bfd/bfd-in2.h	2014-04-22 12:03:35.226872578 +0100
057864b
--- bfd/bfd-in2.h	2014-04-22 12:07:51.556393678 +0100
057864b
*************** typedef struct bfd_section *sec_ptr;
057864b
*** 294,302 ****
057864b
  
057864b
  #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
057864b
  
057864b
- #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
057864b
- #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
057864b
- #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
057864b
  /* Find the address one past the end of SEC.  */
057864b
  #define bfd_get_section_limit(bfd, sec) \
057864b
    (((bfd)->direction != write_direction && (sec)->rawsize != 0	\
057864b
--- 294,299 ----
057864b
*************** struct relax_table {
057864b
*** 1592,1597 ****
057864b
--- 1589,1620 ----
057864b
    int size;
057864b
  };
057864b
  
057864b
+ /* Note: the following are provided as inline functions rather than macros
057864b
+    because not all callers use the return value.  A macro implementation
057864b
+    would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
057864b
+    compilers will complain about comma expressions that have no effect.  */
057864b
+ static inline bfd_boolean
057864b
+ bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
057864b
+ {
057864b
+   ptr->userdata = val;
057864b
+   return TRUE;
057864b
+ }
057864b
+ 
057864b
+ static inline bfd_boolean
057864b
+ bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
057864b
+ {
057864b
+   ptr->vma = ptr->lma = val;
057864b
+   ptr->user_set_vma = TRUE;
057864b
+   return TRUE;
057864b
+ }
057864b
+ 
057864b
+ static inline bfd_boolean
057864b
+ bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
057864b
+ {
057864b
+   ptr->alignment_power = val;
057864b
+   return TRUE;
057864b
+ }
057864b
+ 
057864b
  /* These sections are global, and are managed by BFD.  The application
057864b
     and target back end are not permitted to change the values in
057864b
     these sections.  */
057864b
diff -rcp ../binutils-2.24.orig/bfd/bfd-in.h bfd/bfd-in.h
057864b
*** ../binutils-2.24.orig/bfd/bfd-in.h	2014-04-22 12:03:35.272868967 +0100
057864b
--- bfd/bfd-in.h	2014-04-22 12:06:12.850914084 +0100
057864b
*************** typedef struct bfd_section *sec_ptr;
057864b
*** 287,295 ****
057864b
  
057864b
  #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
057864b
  
057864b
- #define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
057864b
- #define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
057864b
- #define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
057864b
  /* Find the address one past the end of SEC.  */
057864b
  #define bfd_get_section_limit(bfd, sec) \
057864b
    (((bfd)->direction != write_direction && (sec)->rawsize != 0	\
057864b
--- 287,292 ----
057864b
diff -rcp ../binutils-2.24.orig/bfd/section.c bfd/section.c
057864b
*** ../binutils-2.24.orig/bfd/section.c	2014-04-22 12:03:35.215873442 +0100
057864b
--- bfd/section.c	2014-04-22 12:06:55.795118059 +0100
057864b
*************** CODE_FRAGMENT
057864b
*** 542,547 ****
057864b
--- 542,573 ----
057864b
  .  int size;
057864b
  .};
057864b
  .
057864b
+ .{* Note: the following are provided as inline functions rather than macros
057864b
+ .   because not all callers use the return value.  A macro implementation
057864b
+ .   would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
057864b
+ .   compilers will complain about comma expressions that have no effect.  *}
057864b
+ .static inline bfd_boolean
057864b
+ .bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
057864b
+ .{
057864b
+ .  ptr->userdata = val;
057864b
+ .  return TRUE;
057864b
+ .}
057864b
+ .
057864b
+ .static inline bfd_boolean
057864b
+ .bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
057864b
+ .{
057864b
+ .  ptr->vma = ptr->lma = val;
057864b
+ .  ptr->user_set_vma = TRUE;
057864b
+ .  return TRUE;
057864b
+ .}
057864b
+ .
057864b
+ .static inline bfd_boolean
057864b
+ .bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
057864b
+ .{
057864b
+ .  ptr->alignment_power = val;
057864b
+ .  return TRUE;
057864b
+ .}
057864b
+ .
057864b
  .{* These sections are global, and are managed by BFD.  The application
057864b
  .   and target back end are not permitted to change the values in
057864b
  .   these sections.  *}