mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-23 17:29:23 +08:00
outelf32: handle compilers without 64-bit switch() support
OpenWatcom, in particular, doesn't handle switch() statements with 64-bit expressions, sigh. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
This commit is contained in:
parent
b1a1e69a8f
commit
4dff757ba5
@ -43,6 +43,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#include "nasm.h"
|
#include "nasm.h"
|
||||||
#include "nasmlib.h"
|
#include "nasmlib.h"
|
||||||
@ -788,7 +789,13 @@ static void elf_out(int32_t segto, const void *data,
|
|||||||
" segment base references");
|
" segment base references");
|
||||||
} else {
|
} else {
|
||||||
if (wrt == NO_SEG) {
|
if (wrt == NO_SEG) {
|
||||||
switch (size) {
|
/*
|
||||||
|
* The if() is a hack to deal with compilers which
|
||||||
|
* don't handle switch() statements with 64-bit
|
||||||
|
* expressions.
|
||||||
|
*/
|
||||||
|
if (size < UINT_MAX) {
|
||||||
|
switch ((unsigned int)size) {
|
||||||
case 1:
|
case 1:
|
||||||
gnu16 = true;
|
gnu16 = true;
|
||||||
elf_add_reloc(s, segment, R_386_8);
|
elf_add_reloc(s, segment, R_386_8);
|
||||||
@ -803,6 +810,7 @@ static void elf_out(int32_t segto, const void *data,
|
|||||||
default: /* Error issued further down */
|
default: /* Error issued further down */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (wrt == elf_gotpc_sect + 1) {
|
} else if (wrt == elf_gotpc_sect + 1) {
|
||||||
/*
|
/*
|
||||||
* The user will supply GOT relative to $$. ELF
|
* The user will supply GOT relative to $$. ELF
|
||||||
|
Loading…
Reference in New Issue
Block a user