for SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS.
The intention of creating an abstraction like
SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS is to address the concern that there
should be a central place to enforce harmonious flags between GNU as and
ld. At the moment, the only flag that needs to be enforced is
SFRAME_F_FDE_FUNC_START_PCREL.
sframe.h and sframe-api.h are installed headers by libsframe for the
specification and implementation respectively. Adding a definition like
SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS does not fit in either. Create a
new internal header instead to keep the definition uncoupled from
sframe.h and sframe-api.h. Rename the previously added
SFRAME_F_LD_MUSTHAVE_FLAGS to define the new
SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS.
bfd/
* elf-sframe.c (_bfd_elf_merge_section_sframe): Use the new
internal header and SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS.
gas/
* gen-sframe.c (output_sframe_internal): Likewise.
include/
* sframe-api.h (SFRAME_F_LD_MUSTHAVE_FLAGS): Move from..
* sframe-internal.h: ..to here. New file.
#include "libbfd.h"
#include "elf-bfd.h"
#include "sframe-api.h"
+#include "sframe-internal.h"
/* Return TRUE if the function has been marked for deletion during the linking
process. */
uint8_t tflags = dctx_flags & ~SFRAME_F_FDE_SORTED;
/* ld always generates an output section with
SFRAME_F_FDE_FUNC_START_PCREL flag set. Later using
- SFRAME_F_LD_MUSTHAVE_FLAGS, it is enforced that the provided input
- sections also have this flag set. */
+ SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS, it is enforced that the provided
+ input sections also have this flag set. */
tflags |= SFRAME_F_FDE_FUNC_START_PCREL;
htab->sfe_info.sfe_ctx = sframe_encode (SFRAME_VERSION_2,
tflags, /* SFrame flags. */
related flags set. The implementation does not support updating these
data encodings on the fly; confirm by checking the ectx_flags. */
ectx_flags = sframe_encoder_get_flags (sfe_ctx);
- if ((dctx_flags & ectx_flags & SFRAME_F_LD_MUSTHAVE_FLAGS)
- != SFRAME_F_LD_MUSTHAVE_FLAGS)
+ if ((dctx_flags & ectx_flags & SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS)
+ != SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS)
{
_bfd_error_handler
(_("SFrame sections with unexpected data encoding prevent"
#include "as.h"
#include "subsegs.h"
#include "sframe.h"
-#include "sframe-api.h"
+#include "sframe-internal.h"
#include "gen-sframe.h"
#include "dw2gencfi.h"
out_one (SFRAME_VERSION);
/* gas must ensure emitted SFrame sections have at least the required flags
set. */
- gas_assert ((sframe_flags & SFRAME_F_LD_MUSTHAVE_FLAGS)
- == SFRAME_F_LD_MUSTHAVE_FLAGS);
+ gas_assert ((sframe_flags & SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS)
+ == SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS);
out_one (sframe_flags);
/* abi/arch. */
#ifdef sframe_get_abi_arch
#define MAX_OFFSET_BYTES \
((SFRAME_FRE_OFFSET_4B * 2 * MAX_NUM_STACK_OFFSETS))
-/* Set of flags that are required to be harmonious between all decoder and
- encoder objects participating in a link. */
-#define SFRAME_F_LD_MUSTHAVE_FLAGS \
- (SFRAME_F_FDE_FUNC_START_PCREL)
-
/* User interfacing SFrame Row Entry.
An abstraction provided by libsframe so the consumer is decoupled from
the binary format representation of the same.
--- /dev/null
+/* Internal header for SFrame.
+
+ Used by GNU as and ld.
+
+ Copyright (C) 2025 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _SFRAME_INTERNAL_H
+#define _SFRAME_INTERNAL_H
+
+#include "sframe.h"
+
+/* Set of flags which are required to be harmonious between GNU as and ld. All
+ objects participating in the link for GNU ld must have these flags set. */
+#define SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS \
+ (SFRAME_F_FDE_FUNC_START_PCREL)
+
+#endif /* _SFRAME_INTERNAL_H */