English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 01 December 2017, 22:03   #1
dalton
tulou
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 70
vbcc bss clearing issue

I've been having some trouble with constant data included in my program being cleared already before my program starts running.

So I disassembled to linked executable of my program, and found this piece of code just 5 rows into the program. It is a loop which iterates 0x30 (48) times. Each time clearing one longword.
Code:
	MOVE.L	#$00000030,D0
	BEQ.S	LAB_0002
	LEA	__BSSBAS,A0
LAB_0001:
	CLR.L	(A0)+
	SUBQ.L	#1,D0
	BNE.S	LAB_0001
LAB_0002:
Further down the source is the __BSSBAS declaration:

Code:
	SECTION S_2,DATA

SECSTRT_2:
	DC.L	$00220063,$41000000
__BSSBAS:
	DS.L	1
_SysBase:
	DS.L	1
_DOSBase:
	DS.L	1
_WBenchMsg:
	DS.L	1
__WBenchMsg:
	DS.L	1
__stdin:
	DS.L	1
__stdout:
	DS.L	1
__stderr:
	DS.L	1
_errno:
	DS.L	1
___stack_usage:
	DS.L	1
___stackLower:
	DS.L	1
___stackPtr:
	DS.L	1


	SECTION S_3,DATA

SECSTRT_3:
	DS.L	1
_GfxBase:
	DS.L	1
There are 12 longwords from __BSSBAS to the end of the section, ie 48 (0x30) bytes.

The clearing loop in the beginning of the program appears to be clearing 4 times the data it should. So it basically goes on to clear some constant data I have included in my program.

Very strange! Is it a bug in vbcc?

VBCC 0.9e
dalton is offline  
AdSense AdSense  
Old 02 December 2017, 20:20   #2
dalton
tulou
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 70
This title of this post is actually not accurate. It's not clearing bss data, it's clearing a normal data section which happens to hold a bss pointer.

Still, I'm pretty confident it's a bug in the m68k-kick13 targets startup.o.
It basically clears a number of longwords instead of that number of bytes.
dalton is offline  
Old 02 December 2017, 21:36   #3
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,079
Quote:
Originally Posted by dalton View Post
The clearing loop in the beginning of the program appears to be clearing 4 times the data it should. So it basically goes on to clear some constant data I have included in my program.

Very strange! Is it a bug in vbcc?
Don't think so. My guess is that you are using an obsolete vlink version for m68k-kick13.

In my startup code source the "move.l #$00000030,d0" is
Code:
        move.l  #__BSSLEN,d0
__BSSLEN is a (SAS/C-compatible) linker symbol, which represents the number of long words in the BSS part of a Data-Bss section. There was a bug fix for vlink recently (before the vbcc 0.9f release). From the history file:
Code:
- 0.16 (16.05.17)
...
o (ados/ehf): Fixed SAS/C-compatibility linker symbol __BSSLEN. Now it
  represents the number of long words instead of the number of bytes.
  WARNING! Make sure to check your code, if you used __BSSLEN before!
Make sure your vlink is V0.16.


Quote:
VBCC 0.9e
Hmm. There was no m68k-kick13 target in 0.9e. I first released it with 0.9f (accompanied by the appropriate vlink-version).
phx is offline  
Old 02 December 2017, 22:50   #4
dalton
tulou
dalton's Avatar
 
Join Date: Jun 2006
Location: Gothenburg / Sweden
Posts: 70
I see! It looks like I have mismatched target and linker versions. I've actually been changing back and forth between different compiler/linker versions without considering the targets.
Thanks for your reply!
dalton is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
vbcc 0.9f (windows) local includes issue? dalton Coders. C/C++ 4 29 July 2017 21:33
Devpac - CNOP in a BSS Section h0ffman Coders. Asm / Hardware 30 18 March 2015 23:12
Clearing the X-bit oRBIT Coders. Asm / Hardware 6 22 April 2012 02:52
newest ami/x and cnet bss GreenMeanie request.Apps 1 16 September 2011 20:12
Federation of the Free Traders + BSS Jane Seymour haynor666 MarketPlace 0 06 June 2003 15:19

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:58.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Page generated in 0.16460 seconds with 14 queries