Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with fill value in .bss sections #27

Open
dmik opened this issue Jun 14, 2017 · 7 comments
Open

Deal with fill value in .bss sections #27

dmik opened this issue Jun 14, 2017 · 7 comments

Comments

@dmik
Copy link
Collaborator

dmik commented Jun 14, 2017

BSS sections are initialized with zeroes and specifying a non-zero value in .align directives causes latest binutils to barf with this on code generated by GCC:

Warning: ignoring fill value in section `.bss'

The related binutils for OS/2 ticket containing an example and a suggested solution is here: http://trac.netlabs.org/ports/ticket/165.

@psmedley
Copy link
Owner

psmedley commented Jun 15, 2017

I believe the following in emx.h drive this:

/* If defined, a C expression whose value is a string containing the
   assembler operation to identify the following data as
   uninitialized global data.  If not defined, and neither
   `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
   uninitialized global data will be output in the data section if
   `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
   used.  */
#undef BSS_SECTION_ASM_OP
#define BSS_SECTION_ASM_OP              "\t.bss"

&

/* This is how to output an assembler line that says to advance the
   location counter to a multiple of 2**LOG bytes.
   bird: Pad using int 3. */
#undef ASM_OUTPUT_ALIGN
#define ASM_OUTPUT_ALIGN(FILE,LOG) \
    if ((LOG)!=0) fprintf ((FILE), "\t.align %d,0xcc\n", LOG)

@psmedley
Copy link
Owner

Looks like the padding may be the issue, that's a point of difference compared to other architectures. I'll do some testing over the weekend

@psmedley
Copy link
Owner

Confirming that changing ASM_OUTPUT_ALIGN to remove the bird changes, ie to

/* This is how to output an assembler line
   that says to advance the location counter
   to a multiple of 2**LOG bytes.  */

#define ASM_OUTPUT_ALIGN(FILE,LOG)	\
  if ((LOG)!=0) fprintf ((FILE), "\t.align %d\n", (LOG))

stops the warning being generated. Now we just need to understand why bird changed the definition away from the "standard" definition

@SilvanScherrer
Copy link

the question is also, could it have been like that in the old gcc 335 times.

@psmedley
Copy link
Owner

@SilvanScherrer yes it is the same in gcc 3.3.5 - that header originates from GCC 3.3.5

@SilvanScherrer
Copy link

I more meant, if the origin was like that in 335. As the emx.h is probably a adjusted copy of another .h. And it might well be that back then the .bss was treated different.

@psmedley
Copy link
Owner

psmedley commented Jun 21, 2017

My assumption based on the comment " bird: Pad using int 3." is that he added the 0xcc.

Just confirmed that no other headers include 0xcc in the ASM_OUTPUT_ALIGN definition for GCC 3.3.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants