Opened 7 years ago

Closed 7 years ago

#165 closed defect (fixed)

binutils spits .bss message

Reported by: Silvan Scherrer Owned by:
Priority: major Milestone: dev tools
Component: *none Version:
Severity: medium Keywords:
Cc:

Description

latest binutils spits on some assembler files the following message

{standard input}:4280: Warning: ignoring fill value in section `.bss'

we believe the source of the problem might come from gcc.

Change History (13)

comment:1 by dmik, 7 years ago

The source of the problem is the following assembly generated by gcc 4.9.2 on OS/2:

    .bss
    .align 2,0xcc

i.e. using align with a non-zero fill value (0xCC in our case) inside the .bss section of the data segment. In GCC for OS/2 this section is used to store uninitialised global variables of a C++ program which are initialised with zeroes at program startup (since they are all initialized with zeroes it makes no sense to store the actual bytes in the object file, only the length of the section is stored, and this is the main purpose of dedicating a special section for it). This way, setting the fill value to anything other than 0 (which is the default for .align) makes no sense and this is what the assembler warning is about.

This is a simple example to generate the above assembly (run with gcc -S test.cpp):

extern __declspec(dllexport) int foo;

int foo;

int main(int argc, const char **argv)
{
  return foo;
}

This is its assembly:

	.file	"test.cpp"
	.globl	_foo
	.bss
	.align 2,0xcc
_foo:
	.space 4
	.text
	.globl	_main
_main:
LFB0:
	pushl	%ebp
LCFI0:
	movl	%esp, %ebp
LCFI1:
	andl	$-16, %esp
	call	___main
	movl	_foo, %eax
	leave
LCFI2:
	ret
LFE0:
	.ident	"GCC: (GNU) 4.9.2"
	# Exports: "<exportname>,<ordinal>=<asmname>,<code|data>", N_EXP,0,0,-42
	.stabs	"_foo,0=_foo,data",0x6c,0,0,-42	# foo

Compile it with as test.c and you get the warning.

Note that I don't know if the .bss section is stored in OMF as length only. But if our OMF natively supports such sections and gas maps to them (I guess it's the case), we should eliminate the fill value from .align. Otherwise we should stop using .bss when generating assembly on OS/2 in -Zomf mode. A closer look at the compiler is needed to resolve this.

comment:2 by dmik, 7 years ago

BTW, I also checked gcc 3.3.5 and it does just the same.

comment:3 by dmik, 7 years ago

For the time being we should just disable this message in gas with #ifdef 0 (and roll it back when we fix/update our gcc port) — this warning is purely informational and doing so is absolutely no harm.

This looks like the original patch that brought it to binutils: https://sourceware.org/ml/binutils/2015-12/txtN57RcPEOan.txt.

comment:4 by dmik, 7 years ago

This is the respective GCC for OS/2 issue: https://github.com/psmedley/gcc/issues/27

comment:5 by psmedley, 7 years ago

FYI, GCC 6.3.0 generates the same, I'll try with GCC 7.1.0 tonight

comment:6 by dmik, 7 years ago

Thanks Paul. If GCC 7.x is the same, then this will mean this .bss .align thingy is OS/2 specific. Anyway, we will come to it later.

comment:7 by Tellie, 7 years ago

Hi all,

I see it also in gcc v7.1.0

comment:8 by Silvan Scherrer, 7 years ago

r2201 fixes it. I leave the ticket open until we are 100% sure

comment:9 by psmedley, 7 years ago

Yes, seems OS/2 specific, I see some stuff in emx.h that I think causes it, will comment further in the gcc ticket as it's more relevant there.

comment:10 by psmedley, 7 years ago

How do I get binutils 2.27 without compiling myself? is it in the exp repository?

comment:11 by Silvan Scherrer, 7 years ago

yes it's there. but be aware there are 2 versions of it. 2.27-1 which has the .bss issue still and 2.27-2 which has the message disabled.

Last edited 7 years ago by Silvan Scherrer (previous) (diff)

comment:12 by psmedley, 7 years ago

Thanks, confirmed the cause of the warning is a bird change to the definition of ASM_OUTPUT_ALIGN

comment:13 by Silvan Scherrer, 7 years ago

Resolution: fixed
Status: newclosed

binutils with the fix released to rel

Note: See TracTickets for help on using tickets.