[19/22] hppa/ELF: fix .text/.data interaction with .previous

Message ID cf2b8ad1-9ad4-4c3c-a189-679e7db2d830@suse.com
State New
Headers
Series ELF: correct handling of simplified section directives |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Testing passed

Commit Message

Jan Beulich Dec. 15, 2023, 12:19 p.m. UTC
  For some ELF targets .text/.data are overridden. In that case
obj_elf_{text,data}() need calling, just like .code vectors to that
function for the remaining ELF targets.

While there also hand on the function arguments, even if right now
they're meaningless. This matches what other targets' code does.
  

Comments

John David Anglin Dec. 15, 2023, 4:37 p.m. UTC | #1
Tested on hppa-linux.  No regressions were observed.

Dave

On 2023-12-15 7:19 a.m., Jan Beulich wrote:
> For some ELF targets .text/.data are overridden. In that case
> obj_elf_{text,data}() need calling, just like .code vectors to that
> function for the remaining ELF targets.
>
> While there also hand on the function arguments, even if right now
> they're meaningless. This matches what other targets' code does.
>
> --- a/gas/config/tc-hppa.c
> +++ b/gas/config/tc-hppa.c
> @@ -6199,7 +6199,7 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED
>      label when finished.  */
>   
>   static void
> -pa_text (int unused ATTRIBUTE_UNUSED)
> +pa_text (int arg)
>   {
>   #ifdef OBJ_SOM
>     current_space = is_defined_space ("$TEXT$");
> @@ -6207,21 +6207,32 @@ pa_text (int unused ATTRIBUTE_UNUSED)
>       = pa_subsegment_to_subspace (current_space->sd_seg, 0);
>   #endif
>   
> -  s_text (0);
> +#ifdef OBJ_ELF
> +  obj_elf_text (arg);
> +#else
> +  s_text (arg);
> +#endif
> +
>     pa_undefine_label ();
>   }
>   
>   /* Switch to the data space.  As usual delete our label.  */
>   
>   static void
> -pa_data (int unused ATTRIBUTE_UNUSED)
> +pa_data (int arg)
>   {
>   #ifdef OBJ_SOM
>     current_space = is_defined_space ("$PRIVATE$");
>     current_subspace
>       = pa_subsegment_to_subspace (current_space->sd_seg, 0);
>   #endif
> -  s_data (0);
> +
> +#ifdef OBJ_ELF
> +  obj_elf_data (arg);
> +#else
> +  s_data (arg);
> +#endif
> +
>     pa_undefine_label ();
>   }
>   
>
  

Patch

--- a/gas/config/tc-hppa.c
+++ b/gas/config/tc-hppa.c
@@ -6199,7 +6199,7 @@  pa_callinfo (int unused ATTRIBUTE_UNUSED
    label when finished.  */
 
 static void
-pa_text (int unused ATTRIBUTE_UNUSED)
+pa_text (int arg)
 {
 #ifdef OBJ_SOM
   current_space = is_defined_space ("$TEXT$");
@@ -6207,21 +6207,32 @@  pa_text (int unused ATTRIBUTE_UNUSED)
     = pa_subsegment_to_subspace (current_space->sd_seg, 0);
 #endif
 
-  s_text (0);
+#ifdef OBJ_ELF
+  obj_elf_text (arg);
+#else
+  s_text (arg);
+#endif
+
   pa_undefine_label ();
 }
 
 /* Switch to the data space.  As usual delete our label.  */
 
 static void
-pa_data (int unused ATTRIBUTE_UNUSED)
+pa_data (int arg)
 {
 #ifdef OBJ_SOM
   current_space = is_defined_space ("$PRIVATE$");
   current_subspace
     = pa_subsegment_to_subspace (current_space->sd_seg, 0);
 #endif
-  s_data (0);
+
+#ifdef OBJ_ELF
+  obj_elf_data (arg);
+#else
+  s_data (arg);
+#endif
+
   pa_undefine_label ();
 }