mirror of
https://github.com/netwide-assembler/nasm.git
synced 2024-11-21 03:14:19 +08:00
03c4f90afa
Add a common file, outlib.c, for output formats. Add the function realsize() instead of open-coded variants in almost every backend. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
24 lines
337 B
C
24 lines
337 B
C
/*
|
|
* libout.c
|
|
*
|
|
* Common routines for the output backends.
|
|
*/
|
|
|
|
#include "compiler.h"
|
|
#include "nasm.h"
|
|
#include "outlib.h"
|
|
|
|
uint64_t realsize(enum out_type type, uint64_t size)
|
|
{
|
|
switch (type) {
|
|
case OUT_REL2ADR:
|
|
return 2;
|
|
case OUT_REL4ADR:
|
|
return 4;
|
|
case OUT_REL8ADR:
|
|
return 8;
|
|
default:
|
|
return size;
|
|
}
|
|
}
|