Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Zwinkau
libfirm
Commits
029646c1
Commit
029646c1
authored
Sep 06, 2015
by
Matthias Braun
Browse files
begnuas: use designated initializers for section names
parent
76b87ca1
Changes
1
Hide whitespace changes
Inline
Side-by-side
ir/be/begnuas.c
View file @
029646c1
...
...
@@ -102,21 +102,18 @@ static void emit_section_sparc(be_gas_section_t section,
be_gas_section_t
base
=
section
&
GAS_SECTION_TYPE_MASK
;
be_gas_section_t
flags
=
section
&
~
GAS_SECTION_TYPE_MASK
;
static
const
char
*
const
basename
[
GAS_SECTION_LAST
+
1
]
=
{
"text"
,
"data"
,
"rodata"
,
"bss"
,
"ctors"
,
"dtors"
,
"jcr"
,
NULL
,
/* cstring */
NULL
,
/* pic trampolines */
NULL
,
/* pic symbols */
"debug_info"
,
"debug_abbrev"
,
"debug_line"
,
"debug_pubnames"
,
"debug_frame"
,
[
GAS_SECTION_TEXT
]
=
"text"
,
[
GAS_SECTION_DATA
]
=
"data"
,
[
GAS_SECTION_RODATA
]
=
"rodata"
,
[
GAS_SECTION_BSS
]
=
"bss"
,
[
GAS_SECTION_CONSTRUCTORS
]
=
"ctors"
,
[
GAS_SECTION_DESTRUCTORS
]
=
"dtors"
,
[
GAS_SECTION_JCR
]
=
"jcr"
,
[
GAS_SECTION_DEBUG_INFO
]
=
"debug_info"
,
[
GAS_SECTION_DEBUG_ABBREV
]
=
"debug_abbrev"
,
[
GAS_SECTION_DEBUG_LINE
]
=
"debug_line"
,
[
GAS_SECTION_DEBUG_PUBNAMES
]
=
"debug_pubnames"
,
[
GAS_SECTION_DEBUG_FRAME
]
=
"debug_frame"
,
};
if
(
current_section
==
section
&&
!
(
section
&
GAS_SECTION_FLAG_COMDAT
))
...
...
@@ -129,7 +126,9 @@ static void emit_section_sparc(be_gas_section_t section,
if
(
flags
&
GAS_SECTION_FLAG_TLS
)
be_emit_char
(
't'
);
assert
(
base
<
(
be_gas_section_t
)
ARRAY_SIZE
(
basename
));
be_emit_string
(
basename
[
base
]);
char
const
*
const
name
=
basename
[
base
];
assert
(
name
!=
NULL
);
be_emit_string
(
name
);
if
(
flags
&
GAS_SECTION_FLAG_COMDAT
)
{
be_emit_char
(
'.'
);
...
...
@@ -170,21 +169,18 @@ static void emit_section(be_gas_section_t section, const ir_entity *entity)
const
char
*
type
;
const
char
*
flags
;
}
sectioninfos
[
GAS_SECTION_LAST
+
1
]
=
{
{
"text"
,
"progbits"
,
"ax"
},
{
"data"
,
"progbits"
,
"aw"
},
{
"rodata"
,
"progbits"
,
"a"
},
{
"bss"
,
"nobits"
,
"aw"
},
{
"ctors"
,
"progbits"
,
"aw"
},
{
"dtors"
,
"progbits"
,
"aw"
},
{
"jcr"
,
"progbits"
,
"aw"
},
{
NULL
,
NULL
,
NULL
},
/* cstring */
{
NULL
,
NULL
,
NULL
},
/* pic trampolines */
{
NULL
,
NULL
,
NULL
},
/* pic symbols */
{
"debug_info"
,
"progbits"
,
""
},
{
"debug_abbrev"
,
"progbits"
,
""
},
{
"debug_line"
,
"progbits"
,
""
},
{
"debug_pubnames"
,
"progbits"
,
""
},
{
"debug_frame"
,
"progbits"
,
""
},
[
GAS_SECTION_TEXT
]
=
{
"text"
,
"progbits"
,
"ax"
},
[
GAS_SECTION_DATA
]
=
{
"data"
,
"progbits"
,
"aw"
},
[
GAS_SECTION_RODATA
]
=
{
"rodata"
,
"progbits"
,
"a"
},
[
GAS_SECTION_BSS
]
=
{
"bss"
,
"nobits"
,
"aw"
},
[
GAS_SECTION_CONSTRUCTORS
]
=
{
"ctors"
,
"progbits"
,
"aw"
},
[
GAS_SECTION_DESTRUCTORS
]
=
{
"dtors"
,
"progbits"
,
"aw"
},
[
GAS_SECTION_JCR
]
=
{
"jcr"
,
"progbits"
,
"aw"
},
[
GAS_SECTION_DEBUG_INFO
]
=
{
"debug_info"
,
"progbits"
,
""
},
[
GAS_SECTION_DEBUG_ABBREV
]
=
{
"debug_abbrev"
,
"progbits"
,
""
},
[
GAS_SECTION_DEBUG_LINE
]
=
{
"debug_line"
,
"progbits"
,
""
},
[
GAS_SECTION_DEBUG_PUBNAMES
]
=
{
"debug_pubnames"
,
"progbits"
,
""
},
[
GAS_SECTION_DEBUG_FRAME
]
=
{
"debug_frame"
,
"progbits"
,
""
},
};
if
(
be_gas_object_file_format
==
OBJECT_FILE_FORMAT_MACH_O
)
{
...
...
@@ -228,7 +224,9 @@ static void emit_section(be_gas_section_t section, const ir_entity *entity)
/* section name */
if
(
flags
&
GAS_SECTION_FLAG_TLS
)
be_emit_char
(
't'
);
be_emit_string
(
sectioninfos
[
base
].
name
);
char
const
*
const
name
=
sectioninfos
[
base
].
name
;
assert
(
name
!=
NULL
);
be_emit_string
(
name
);
if
(
flags
&
GAS_SECTION_FLAG_COMDAT
)
{
be_emit_char
(
'.'
);
be_gas_emit_entity
(
entity
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment