This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/48032] New: PowerPC64 -mcmodel=medium invalid ld offset


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48032

           Summary: PowerPC64 -mcmodel=medium invalid ld offset
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: amodra@gmail.com


/* -fsection-anchors loses the original SYMBOL_REF_DECL when
   replacing memory addresses with an anchor plus offset.
   offsettable_ok_by_alignment assumes the -fsection-anchors code,
   or any symbol_ref without a SYMBOL_REF_DECL is OK, giving:

.L.f:
    addis 9,2,.LANCHOR0@toc@ha
    ld 10,.LANCHOR0@toc@l(9)
    ld 11,.LANCHOR0+8@toc@l(9)
   ...
    .section    .rodata
    .align 1
    .set    .LANCHOR0,. + 0
    .type    BGR233Format, @object
    .size    BGR233Format, 16
BGR233Format:

   Note the byte aligned .rodata which can be linked anywhere, but the
   ld instructions must have .LANCHO0@toc@l at a 4 byte boundary.  */

typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;

typedef struct {
    uint8_t bitsPerPixel;
    uint8_t depth;
    uint8_t bigEndian;
    uint8_t trueColour;
    uint16_t redMax;
    uint16_t greenMax;
    uint16_t blueMax;
    uint8_t redShift;
    uint8_t greenShift;
    uint8_t blueShift;
    uint8_t pad1;
    uint16_t pad2;
} rfbPixelFormat;

struct foo {
    rfbPixelFormat format;
};

static const rfbPixelFormat BGR233Format = {
    8, 8, 0, 1, 7, 7, 3, 0, 3, 6, 0, 0
};

void f (struct foo *p)
{
    p->format = BGR233Format;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]