summaryrefslogtreecommitdiff
path: root/modules/objfmts/elf/elf-objfmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/objfmts/elf/elf-objfmt.c')
-rw-r--r--modules/objfmts/elf/elf-objfmt.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/modules/objfmts/elf/elf-objfmt.c b/modules/objfmts/elf/elf-objfmt.c
index 1cf725f0..0c3a1426 100644
--- a/modules/objfmts/elf/elf-objfmt.c
+++ b/modules/objfmts/elf/elf-objfmt.c
@@ -80,6 +80,7 @@ typedef struct {
yasm_objfmt_module yasm_elf_LTX_objfmt;
yasm_objfmt_module yasm_elf32_LTX_objfmt;
yasm_objfmt_module yasm_elf64_LTX_objfmt;
+yasm_objfmt_module yasm_elfx32_LTX_objfmt;
static elf_symtab_entry *
@@ -397,7 +398,9 @@ elf_objfmt_create(yasm_object *object)
if (objfmt) {
objfmt_elf = (yasm_objfmt_elf *)objfmt;
/* Figure out which bitness of object format to use */
- if (elf_march->bits == 32)
+ if (strcmp (elf_march->machine, "x32") == 0)
+ objfmt_elf->objfmt.module = &yasm_elfx32_LTX_objfmt;
+ else if (elf_march->bits == 32)
objfmt_elf->objfmt.module = &yasm_elf32_LTX_objfmt;
else if (elf_march->bits == 64)
objfmt_elf->objfmt.module = &yasm_elf64_LTX_objfmt;
@@ -417,6 +420,12 @@ elf64_objfmt_create(yasm_object *object)
return elf_objfmt_create_common(object, &yasm_elf64_LTX_objfmt, 64, NULL);
}
+static yasm_objfmt *
+elfx32_objfmt_create(yasm_object *object)
+{
+ return elf_objfmt_create_common(object, &yasm_elfx32_LTX_objfmt, 32, NULL);
+}
+
static long
elf_objfmt_output_align(FILE *f, unsigned int align)
{
@@ -1363,3 +1372,22 @@ yasm_objfmt_module yasm_elf64_LTX_objfmt = {
elf_objfmt_section_switch,
elf_objfmt_get_special_sym
};
+
+yasm_objfmt_module yasm_elfx32_LTX_objfmt = {
+ "ELF (x32)",
+ "elfx32",
+ "o",
+ 64,
+ 0,
+ elf_objfmt_dbgfmt_keywords,
+ "null",
+ elf_objfmt_directives,
+ elf_objfmt_stdmacs,
+ elfx32_objfmt_create,
+ elf_objfmt_output,
+ elf_objfmt_destroy,
+ elf_objfmt_add_default_section,
+ elf_objfmt_init_new_section,
+ elf_objfmt_section_switch,
+ elf_objfmt_get_special_sym
+};