Project

General

Profile

Bug #5461

#pragma align before the declaration

Added by Gary Mills over 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
kernel
Start date:
2014-12-21
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

When building in usr/src/uts/sun4u/unix with gcc 4.8.2, the following error appears:


../../common/vm/vm_pagelist.c:77:9: error: '#pragma align' must appear before the declaration of vm_cpu_data0, ignoring [-Werror]
#pragma align MAX_PRAGMA_ALIGN(vm_cpu_data0)
^
cc1: all warnings being treated as errors

The Studio compiler accepts the code with no complaints, but gcc objects to the placement of the pragma. The solution is to use the aligned attribute for the gcc compiler only. I've attached my patch file.


Files

page.diff (796 Bytes) page.diff Gary Mills, 2014-12-21 01:51 PM

Related issues

Related to illumos gate - Bug #3062: illumos should build/work with GCC 4.6 or newerNew2012-08-07

Actions

History

#1

Updated by Rich Lowe over 4 years ago

I'm 99% sure that the real problem is the (unnecessary) declaration in the vm_dep.h's for both platforms.

The reason this is "post-facto" is the extern declaration, which is unnecessary and generally detrimental.

#2

Updated by Gary Mills over 4 years ago

  • Status changed from New to Feedback

I expect that you are right, but your suggestion is testable, at least on the x86 platform. I can only do a build on the SPARC platform, which is only part of the test. Maybe somebody else can assist us.

#3

Updated by Rich Lowe over 4 years ago

If it works on SPARC, I can certainly try on x86 for you. I'm confident it'll work on both (more confident about x86, honestly).

#4

Updated by Igor Kozhukhov over 4 years ago

i'd like to help with test on SPARC with gcc44 build

#5

Updated by Andrew Stormont over 4 years ago

The code builds fine with these changes (the removal of vm_cpu_data0 from vm_dep.h). I haven't tested the build yet but I will do later today.

#6

Updated by Andrew Stormont over 4 years ago

  • Related to Bug #3373: gcc >= 4.5 concerns about offsetof() added
#7

Updated by Andrew Stormont over 4 years ago

  • Related to deleted (Bug #3373: gcc >= 4.5 concerns about offsetof())
#8

Updated by Andrew Stormont over 4 years ago

  • Related to Bug #3062: illumos should build/work with GCC 4.6 or newer added
#9

Updated by Gary Mills over 4 years ago

This certainly seems like a better solution than mine. Please proceed.

#10

Updated by Rich Lowe over 3 years ago

  • Assignee set to Rich Lowe
#11

Updated by Electric Monk over 3 years ago

  • Status changed from Feedback to Closed
  • % Done changed from 0 to 100

git commit 71b4af9b981b0fc179b6c0bab0186b84a2bc2d9c

commit  71b4af9b981b0fc179b6c0bab0186b84a2bc2d9c
Author: Richard Lowe <richlowe@richlowe.net>
Date:   2016-01-31T18:40:17.000Z

    5461 #pragma align before the declaration
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
    Reviewed by: Andrew Stormont <andyjstormont@gmail.com>
    Reviewed by: Garrett D'Amore <garrett@damore.org>
    Approved by: Dan McDonald <danmcd@omniti.com>

Also available in: Atom PDF