On 05/18/2017 10:14 AM, Jozef Lawrynowicz wrote:
A patch for this bug was originally posted here:
https://gcc.gnu.org/ml/gcc-patches/2017-02/msg01054.html
There were some issues with that patch which I've now fixed.

The MSP430 target supports the automatic placement of functions and
data in different memory regions when passing the
"-mdata-region=either" and "-mcode-region=either" options.
MSP430x devices support the large memory model, "-mlarge", which
enables 20 bit pointers, however the vector table across all MSP430
targets only accepts 16-bit pointers. To prevent the use of 20-bit
pointers in the vector table when the large memory model is used, the
MSP430 backend currently places functions specified with the interrupt
attribute in a section called ".lowtext". This section is placed at
the beginning of .text in the MSP430 linker scripts.

PR target/78838 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78838)
reports that a function with the interrupt attribute is placed in a
non-existent section ".either.lowtext" when "-mlarge",
"-mcode-region=either" and "-ffunction-sections" are passed. The
backend has correctly decided to place the function in .lowtext, but
has applied the .either prefix which is undesirable.

No additional .lower/.upper/.either prefixes should be applied to the
section name once it has been placed in .lowtext, the attached patch
implements this, and adds a test.

The patch passed regression testing with "-mcpu=msp430x/-mlarge" for
msp430-elf on the gcc-6-branch (r247086). Trunk doesn't build with C++
support for msp430-elf which is why gcc-6-branch was used.

I don't have write access to the GCC SVN repository, so if this patch
is satisfactory, I would appreciate if someone could commit it for me.
Thanks.

I don't normally review back end patches so forgive me for picking
on two of yours the same day but it seems to me that the first
argument to has_section_name() needs to be const-qualified:

+static bool
+has_section_name (char * name, tree decl = current_function_decl)
...

if the following is to compile without error in C++ where string
literals are const char[]:

+  if (has_section_name (".lowtext", decl))

Martin

Reply via email to