#endif
}
-symbolS *coff_last_function;
#ifndef OBJ_XCOFF
static symbolS *coff_last_bf;
#endif
void
coff_frob_symbol (symbolS *symp, int *punt)
{
+ static symbolS *last_functionP;
static symbolS *last_tagP;
static stack *block_stack;
static symbolS *set_end;
}
}
- if (coff_last_function == 0 && SF_GET_FUNCTION (symp)
- && S_IS_DEFINED (symp))
+ if (SF_GET_FUNCTION (symp) && S_IS_DEFINED (symp))
{
union internal_auxent *auxp;
- coff_last_function = symp;
if (S_GET_NUMBER_AUXILIARY (symp) < 1)
S_SET_NUMBER_AUXILIARY (symp, 1);
auxp = SYM_AUXENT (symp);
if (S_GET_STORAGE_CLASS (symp) == C_EFCN
&& S_IS_DEFINED (symp))
{
- if (coff_last_function == 0)
+ if (!last_functionP)
as_fatal (_("C_EFCN symbol for %s out of scope"),
S_GET_NAME (symp));
- SA_SET_SYM_FSIZE (coff_last_function,
+ SA_SET_SYM_FSIZE (last_functionP,
(long) (S_GET_VALUE (symp)
- - S_GET_VALUE (coff_last_function)));
- next_set_end = coff_last_function;
- coff_last_function = 0;
+ - S_GET_VALUE (last_functionP)));
}
}
set_end = next_set_end;
}
+ if (SF_GET_FUNCTION (symp) && S_IS_DEFINED (symp) && !*punt)
+ {
+ if (last_functionP)
+ SA_SET_SYM_ENDNDX (last_functionP, symp);
+ last_functionP = symp;
+ }
+
#ifndef OBJ_XCOFF
if (! *punt
&& S_GET_STORAGE_CLASS (symp) == C_FCN
extern int text_lineno_number;
extern int coff_line_base;
extern int coff_n_line_nos;
-extern symbolS *coff_last_function;
#define obj_emit_lineno(WHERE, LINE, FILE_START) abort ()
#define obj_app_file(name) c_dot_file_symbol (name)
if (SF_GET_FUNCTION (sym))
{
- /* Make sure coff_last_function is reset. Otherwise, we won't create
- the auxent for the next function. */
- coff_last_function = 0;
ppc_last_function = sym;
if (symbol_get_tc (sym)->u.size != (symbolS *) NULL)
{
{
set_end = ppc_last_function;
ppc_last_function = NULL;
-
- /* We don't have a C_EFCN symbol, but we need to force the
- COFF backend to believe that it has seen one. */
- coff_last_function = NULL;
}
}
&& ![istarget *c54x*-*-*] } {
run_dump_test tag
}
+
+# Omit c4x and c54x, since .def means something different there.
+if { ![istarget *c4x*-*-*] && ![istarget *c54x*-*-*] } {
+ run_dump_test func1
+ run_dump_test func2
+ run_dump_test func3
+ run_dump_test func4
+}
--- /dev/null
+#xfail: aarch64-*-*
+#objdump: -t
+#name: functions w/o C_EFCN
+
+.*: file format .*
+
+SYMBOL TABLE:
+\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x0+0000 func1.c
+File *
+\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 3\) \(nx 1\) 0x0+0000 inner
+AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 4
+\[ 4\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 3\) \(nx 1\) 0x0+000. outer
+AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 6
+\[ 6\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 2\) \(nx 1\) 0x0+000. test
+AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0
+#pass
--- /dev/null
+ .file "func1.c"
+ .text
+ .macro fcn, name
+ .def \name
+ .scl 3 /* C_STAT */
+ .type 32 /* DT_FUNC */
+ .endef
+\name:
+ .endm
+
+ fcn inner
+ .nop
+
+ fcn outer
+ .nop
+ .nop
+
+ .global test
+ fcn test
+ .nop
+ .nop
+ .nop
--- /dev/null
+#xfail: aarch64-*-*
+#objdump: -t
+#name: functions w/ C_EFCN
+
+.*: file format .*
+
+SYMBOL TABLE:
+\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x0+0000 func2.c
+File *
+\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 3\) \(nx 1\) 0x0+0000 inner
+AUX tagndx 0 ttlsiz 0x[124] lnnos 0 next 4
+\[ 4\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 3\) \(nx 1\) 0x0+000. outer
+AUX tagndx 0 ttlsiz 0x[248] lnnos 0 next 6
+\[ 6\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 2\) \(nx 1\) 0x0+000. test
+AUX tagndx 0 ttlsiz 0x[36c] lnnos 0 next 0
+#pass
--- /dev/null
+ .file "func2.c"
+
+ .macro fcn, name
+ .def \name
+ .scl 3 /* C_STAT */
+ .type 32 /* DT_FUNC */
+ .endef
+\name:
+ .endm
+
+ .macro efcn, name
+ .def .\name
+ .scl 255 /* C_EFCN */
+ .val .
+ .endef
+ .endm
+
+ .text
+
+ fcn inner
+ .nop
+ efcn inner
+
+ fcn outer
+ .nop
+ .nop
+ efcn outer
+
+ .global test
+ fcn test
+ .nop
+ .nop
+ .nop
+ efcn test
--- /dev/null
+#xfail: aarch64-*-*
+#objdump: -t
+#name: functions mixed C_EFCN
+
+.*: file format .*
+
+SYMBOL TABLE:
+\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x0+0000 func3.c
+File *
+\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 3\) \(nx 1\) 0x0+0000 inner
+AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 4
+\[ 4\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 3\) \(nx 1\) 0x0+000. outer
+AUX tagndx 0 ttlsiz 0x[248] lnnos 0 next 6
+\[ 6\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 2\) \(nx 1\) 0x0+000. test
+AUX tagndx 0 ttlsiz 0x[36c] lnnos 0 next 0
+#pass
--- /dev/null
+ .file "func3.c"
+
+ .macro fcn, name
+ .def \name
+ .scl 3 /* C_STAT */
+ .type 32 /* DT_FUNC */
+ .endef
+\name:
+ .endm
+
+ .macro efcn, name
+ .def .\name
+ .scl 255 /* C_EFCN */
+ .val .
+ .endef
+ .endm
+
+ .text
+
+ fcn inner
+ .nop
+
+ fcn outer
+ .nop
+ .nop
+ efcn outer
+
+ .global test
+ fcn test
+ .nop
+ .nop
+ .nop
+ efcn test
--- /dev/null
+#xfail: aarch64-*-*
+#objdump: -t
+#name: functions interleaved with data
+
+.*: file format .*
+
+SYMBOL TABLE:
+\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x0+0000 func4.c
+File *
+\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 3\) \(nx 1\) 0x0+0000 inner
+AUX tagndx 0 ttlsiz 0x[124] lnnos 0 next 5
+\[ 4\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 0\) 0x0+0000 item1
+\[ 5\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 3\) \(nx 1\) 0x0+000. outer
+AUX tagndx 0 ttlsiz 0x[248] lnnos 0 next 8
+\[ 7\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 0\) 0x0+000. item2
+\[ 8\]\(sec 1\)\(fl 0x00\)\(ty 20\)\(scl 2\) \(nx 1\) 0x0+000. test
+AUX tagndx 0 ttlsiz 0x[36c] lnnos 0 next 0
+#pass
--- /dev/null
+ .file "func4.c"
+
+ .macro fcn, name
+ .def \name
+ .scl 3 /* C_STAT */
+ .type 32 /* DT_FUNC */
+ .endef
+\name:
+ .endm
+
+ .macro efcn, name
+ .def .\name
+ .scl 255 /* C_EFCN */
+ .val .
+ .endef
+ .endm
+
+ .text
+ fcn inner
+ .nop
+ efcn inner
+
+ .data
+item1: .long -1
+
+ .text
+ fcn outer
+ .nop
+ .nop
+ efcn outer
+
+ .data
+item2: .long -2
+
+ .text
+ .global test
+ fcn test
+ .nop
+ .nop
+ .nop
+ efcn test