Skip to content

Commit

Permalink
Merge pull request ocaml#13496 from dra27/ld-warning
Browse files Browse the repository at this point in the history
Silence ld warning with libasmrun_shared.so
  • Loading branch information
shindere authored Nov 5, 2024
2 parents 06b9212 + 87fd1b4 commit 718a664
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 11 deletions.
5 changes: 5 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ Working version
entries found in ld.conf.
(David Allsopp, review by Stephen Dolan)

- #13496: Add missing .type and .size directives to main frametable to silence
warnings from the linker when using libasmrun_shared on amd64 and power. The
other backends already carried these directives.
(David Allsopp, review by Tim McGilchrist and Miod Vallat)

- #13500: Add frame pointers support for ARM64 on Linux and macOS.
(Tim McGilchrist, review by KC Sivaramakrishnan, Fabrice Buoro
and Miod Vallat)
Expand Down
14 changes: 11 additions & 3 deletions runtime/amd64.S
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,20 @@

#endif

#define OBJECT(name) \
.globl name; \
.align EIGHT_ALIGN; \
name:

#if defined(SYS_linux) || defined(SYS_gnu)
#define ENDFUNCTION(name) \
.size name, . - name
#define ENDOBJECT(name) \
.type name, @object; \
.size name, . - name;
#else
#define ENDFUNCTION(name)
#define ENDOBJECT(name)
#endif

#include "../runtime/caml/asm.h"
Expand Down Expand Up @@ -1320,9 +1329,7 @@ ENDFUNCTION(G(caml_assert_stack_invariants))
G(caml_system__code_end):

.data
.globl G(caml_system.frametable)
.align EIGHT_ALIGN
G(caml_system.frametable):
OBJECT(G(caml_system.frametable))
.quad 2 /* two descriptors */
.quad LBL(108) /* return address into callback */
.value -1 /* negative frame size => use callback link */
Expand All @@ -1331,6 +1338,7 @@ G(caml_system.frametable):
.quad LBL(frame_runstack) /* return address into fiber_val_handler */
.value -1 /* negative frame size => use callback link */
.value 0 /* no roots here */
ENDOBJECT(G(caml_system.frametable))

#if defined(SYS_macosx)
.literal16
Expand Down
17 changes: 13 additions & 4 deletions runtime/power.S
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,17 @@ caml_hot.code_end:
.endm

.macro ENDFUNCTION name
.size \name, . - \name
.size \name, . - \name
.endm

.macro OBJECT name
.globl \name
.type \name, @object
\name:
.endm

.macro ENDOBJECT name
.size \name, . - \name
.endm

/* Function prologue and epilogue */
Expand Down Expand Up @@ -1181,9 +1191,7 @@ caml_system__code_end:
/* Frame table */

.section ".data"
.globl caml_system.frametable
.type caml_system.frametable, @object
caml_system.frametable:
OBJECT caml_system.frametable
.quad 2 /* two descriptors */
.quad .Lcaml_retaddr + 4 /* return address into callback */
.short -1 /* negative frame size => use callback link */
Expand All @@ -1193,6 +1201,7 @@ caml_system.frametable:
.short -1 /* negative frame size => use callback link */
.short 0 /* no roots here */
.align 3
ENDOBJECT caml_system.frametable

/* TOC entries */

Expand Down
14 changes: 10 additions & 4 deletions runtime/s390x.S
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ caml_hot.code_end:

#define ENDFUNCTION(name)

#define OBJECT(name) \
.align 8; \
.globl name; \
.type name, @object; \
name:

#define ENDOBJECT(name)

/* Stack space to be reserved by the caller of a C function */
#define RESERVED_STACK 160

Expand Down Expand Up @@ -1199,10 +1207,7 @@ caml_system__code_end:
/* Frame table */

.section ".data"
.align 8
.globl caml_system.frametable
.type caml_system.frametable, @object
caml_system.frametable:
OBJECT(caml_system.frametable)
.quad 2 /* two descriptors */
.quad LBL(caml_retaddr) /* return address into callback */
.short -1 /* negative size count => use callback link */
Expand All @@ -1212,6 +1217,7 @@ caml_system.frametable:
.short -1 /* negative size count => use callback link */
.short 0 /* no roots here */
.align 8
ENDOBJECT(caml_system.frametable)

/* Mark stack as non-executable */
.section .note.GNU-stack,"",%progbits

0 comments on commit 718a664

Please sign in to comment.