gnupic: [PATCH] Bad warning for BRA on 16F code


Previous by date: 22 Jul 2013 04:06:08 -0000 Re: [sdcc-devel] gputils 1.2.0 released, Borut Ražem
Next by date: 22 Jul 2013 04:06:08 -0000 Re: [PATCH] Bad warning for BRA on 16F code, mengjin su
Previous in thread:
Next in thread: 22 Jul 2013 04:06:08 -0000 Re: [PATCH] Bad warning for BRA on 16F code, mengjin su

Subject: [PATCH] Bad warning for BRA on 16F code
From: Richard Hodges ####@####.####
Date: 22 Jul 2013 04:06:08 -0000
Message-Id: <201307212205.04019.richard@hodges.org>

I have found a warning that I believe is wrong. I am assembling for 16f1508 and I am 
getting a warning for a branch to a label with an odd address. Here is the test code:

> cat bad.asm
        LIST    P=PIC16F1518
        include p16f1518.inc

        org     0x000

        bra     main
;       nop
main:   goto    main

        end

> gpasm -c bad.asm ; gplink -o bad.hex bad.o
message: using default linker script 
"/usr/home/install/gputils/share/gputils/lkr/16f1518_g.lkr"
warning: destination address must be word aligned at 0 of section ".org_0"

If I add a nop instruction to make the destination even, there is no warning.

I understand that pic18 uses byte addressing, where 12f and 16f use word addresses, so 
pic18 destinations should always be even. With that in mind, I made this patch:

%diff -u libgputils/gpcofflink.c.orig libgputils/gpcofflink.c
--- libgputils/gpcofflink.c.orig        2013-07-10 22:00:41.000000000 -0600
+++ libgputils/gpcofflink.c     2013-07-21 21:42:21.000000000 -0600
@@ -1415,6 +1415,7 @@
     break;
 
   case RELOCT_BRA:
+    if (class != &proc_class_pic14e)
     if (value & 1) {
       gp_warning("destination address must be word aligned at %#x of section \"%s\"",
                  org, section->name);

I don't know if this patch is the right way to fix the error, but I hope it is useful.

Thanks!
-Richard

Previous by date: 22 Jul 2013 04:06:08 -0000 Re: [sdcc-devel] gputils 1.2.0 released, Borut Ražem
Next by date: 22 Jul 2013 04:06:08 -0000 Re: [PATCH] Bad warning for BRA on 16F code, mengjin su
Previous in thread:
Next in thread: 22 Jul 2013 04:06:08 -0000 Re: [PATCH] Bad warning for BRA on 16F code, mengjin su


Powered by ezmlm-browse 0.20.