diff options
| author | mycroft <mycroft@NetBSD.org> | 1995-01-17 06:44:38 +0000 |
|---|---|---|
| committer | mycroft <mycroft@NetBSD.org> | 1995-01-17 06:44:38 +0000 |
| commit | ae92c26c4c09df5e9a041cc860554e601df19bca (patch) | |
| tree | 06907b98bf5638031f774ec9ea5c5dccd39a88d3 /libexec | |
| parent | 2c64d3be894241ff3aab45a6afcb0d690b6f8e3a (diff) | |
Several consistency nits, and fix a byte order problem in md_swapout_reloc().
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/ld.aout_so/arch/m68k/md-static-funcs.c | 8 | ||||
| -rw-r--r-- | libexec/ld.aout_so/arch/m68k/md.c | 37 | ||||
| -rw-r--r-- | libexec/ld.aout_so/arch/m68k/md.h | 4 |
3 files changed, 25 insertions, 24 deletions
diff --git a/libexec/ld.aout_so/arch/m68k/md-static-funcs.c b/libexec/ld.aout_so/arch/m68k/md-static-funcs.c index 30cf25c88bd..8c8c1d90ae9 100644 --- a/libexec/ld.aout_so/arch/m68k/md-static-funcs.c +++ b/libexec/ld.aout_so/arch/m68k/md-static-funcs.c @@ -9,9 +9,9 @@ struct relocation_info *r; long relocation; char *addr; { - if (r->r_relative) { - *(long *)addr += relocation; - _cachectl (addr, 4); /* maintain cache coherency */ - } + if (r->r_relative) { + *(long *)addr += relocation; + _cachectl (addr, 4); /* maintain cache coherency */ + } } diff --git a/libexec/ld.aout_so/arch/m68k/md.c b/libexec/ld.aout_so/arch/m68k/md.c index 810d6bc6a34..43d6213c886 100644 --- a/libexec/ld.aout_so/arch/m68k/md.c +++ b/libexec/ld.aout_so/arch/m68k/md.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: md.c,v 1.6 1994/06/13 05:28:41 chopps Exp $ + * $Id: md.c,v 1.7 1995/01/17 06:44:39 mycroft Exp $ */ #include <sys/param.h> @@ -53,13 +53,13 @@ unsigned char *addr; switch (RELOC_TARGET_SIZE(rp)) { case 0: return get_byte(addr); - break; case 1: return get_short(addr); - break; case 2: return get_long(addr); - break; + default: + errx(1, "Unsupported relocation size: %x", + RELOC_TARGET_SIZE(rp)); } } @@ -71,6 +71,7 @@ md_relocate(rp, relocation, addr, relocatable_output) struct relocation_info *rp; long relocation; unsigned char *addr; +int relocatable_output; { switch (RELOC_TARGET_SIZE(rp)) { case 0: @@ -312,14 +313,14 @@ int n; for (; n; n--, r++) { r->r_address = md_swap_long(r->r_address); bits = ((int *)r)[1]; - r->r_symbolnum = md_swap_long(bits) & 0xffffff; + r->r_symbolnum = md_swap_long(bits) & 0x00ffffff; bits = ((unsigned char *)r)[7]; - r->r_pcrel = ((bits >> 7) & 1); - r->r_length = ((bits >> 5) & 3); - r->r_extern = ((bits >> 4) & 1); - r->r_baserel = ((bits >> 3) & 1); - r->r_jmptable = ((bits >> 2) & 1); - r->r_relative = ((bits >> 1) & 1); + r->r_pcrel = (bits >> 7) & 1; + r->r_length = (bits >> 5) & 3; + r->r_extern = (bits >> 4) & 1; + r->r_baserel = (bits >> 3) & 1; + r->r_jmptable = (bits >> 2) & 1; + r->r_relative = (bits >> 1) & 1; #ifdef N_SIZE r->r_copy = (bits & 1); #endif @@ -335,13 +336,13 @@ int n; for (; n; n--, r++) { r->r_address = md_swap_long(r->r_address); - ((int *)r)[1] = md_swap_long(r->r_symbolnum & 0xffffff00); - bits = ((r->r_pcrel << 7) & 0x80); - bits |= ((r->r_length << 5) & 0x60); - bits |= ((r->r_extern << 4) & 0x10); - bits |= ((r->r_baserel << 3) & 8); - bits |= ((r->r_jmptable << 2) & 4); - bits |= ((r->r_relative << 1) & 2); + ((int *)r)[1] = md_swap_long(r->r_symbolnum) & 0xffffff00; + bits = (r->r_pcrel & 1) << 7; + bits |= (r->r_length & 3) << 5; + bits |= (r->r_extern & 1) << 4; + bits |= (r->r_baserel & 1) << 3; + bits |= (r->r_jmptable & 1) << 2; + bits |= (r->r_relative & 1) << 1; #ifdef N_SIZE bits |= (r->r_copy & 1); #endif diff --git a/libexec/ld.aout_so/arch/m68k/md.h b/libexec/ld.aout_so/arch/m68k/md.h index 4f8883dbff8..4d8697438f9 100644 --- a/libexec/ld.aout_so/arch/m68k/md.h +++ b/libexec/ld.aout_so/arch/m68k/md.h @@ -1,5 +1,5 @@ /* - * $Id: md.h,v 1.3 1994/04/07 19:43:58 pk Exp $ + * $Id: md.h,v 1.4 1995/01/17 06:44:40 mycroft Exp $ * - m68k dependent definitions */ @@ -88,6 +88,7 @@ typedef struct jmpslot { #define get_short(p) ( ( ((unsigned char *)(p))[0] << 8) | \ ( ((unsigned char *)(p))[1] ) \ ) + #define get_long(p) ( ( ((unsigned char *)(p))[0] << 24) | \ ( ((unsigned char *)(p))[1] << 16) | \ ( ((unsigned char *)(p))[2] << 8 ) | \ @@ -164,4 +165,3 @@ void md_swapout_jmpslot __P((jmpslot_t *, int)); #define put_long(where,what) (*(long *)(where) = (what)) #endif /* CROSS_LINKER */ - |
