Skip to content
This repository has been archived by the owner on Jun 5, 2019. It is now read-only.

Reverted change from previous commit that broke GCC builds #485

Merged
merged 1 commit into from
Aug 9, 2016

Conversation

cw2
Copy link
Contributor

@cw2 cw2 commented Aug 5, 2016

Removed nosys.specs that caused "undefined reference to 'end'" error in _sbrk function.

This could be considered a minimal-changes hotfix (affects all GCC builds of all solutions and toolchain versions, tested 4.9 to 5.4), until another solution is implemented (e.g. as proposed by @josesimoes in his PRs).

Removed nosys.specs that caused "undefined reference to 'end'" error in _sbrk
function.
@smaillet-ms
Copy link
Member

Do we have a detailed explanation on what is going on here? The nosys.spec is supposed to be designed for newlib and bare metal systems (e.g. NO SYStem) so disabling that seems counter-intuitive and suggests a deeper problem we don't understand.

@cw2
Copy link
Contributor Author

cw2 commented Aug 8, 2016

Ok.

Adding nosys.spec also requires providing the end symbol (in the linker script, i.e. the scatterfile). Unfortunately, this has not been done, so the result is broken GCC build for all solutions.

Removing nosys.spec fixes this problem for all solutions and their GCC builds. Alternatively, every GCC scatterfile would have to be modified to provide the end symbol. Since I cannot verify all solutions due to the lack of the hardware, I decided to go with reverting/removing nosys.spec (which was the state before the change that broke the GCC builds).

@smaillet-ms
Copy link
Member

Is this 'end symbol' something new to the latest GCC? We definitely built and ran tests on MCBSTM32F400 using GCC so it was working there at one point.

@cw2
Copy link
Contributor Author

cw2 commented Aug 9, 2016

No, the missing 'end' symbol is not related to any particular GCC version, it is caused by adding libnosys.

The GCC builds were working until commit b5adf76#diff-149cd7cd15f32c47c7d3900f4bd3350f added nosys.specs that broke them. At the moment, no solution can be built successfully with any GCC, checked with 4.9 to 5.4.

To summarize,

  • GCC builds were working,
  • Adding nosys.specs resulted in error "undefined reference to `end'",
  • To fix that either remove nosys.specs or provide the 'end' symbol in linker scripts (scatterfile).

I am suggesting the former because it can be done at one place (.targets) and works for all solutions. I am not against using libnosys, I just simply need GCC builds fixed. (I can provide a PR with necessary changes in the scatterfiles to export the 'end' symbol and leave nosys.specs; it saves about 30 bytes).

For more detailed reference how to properly implement system calls for libnosys please have a look for example at http://www.atmel.com/Images/Frequently-Asked-Questions-4.9.3.26.txt.

@smaillet-ms
Copy link
Member

OK, for 30 bytes I can live with that fix. Something to note for vNext so we don't do that again (We'll have plenty more new mistakes to make 😁 )

@smaillet-ms smaillet-ms merged commit fe1254b into NETMF:dev Aug 9, 2016
@cw2 cw2 deleted the fix-gcc-build branch August 9, 2016 17:02
@josesimoes
Copy link
Contributor

To point out that the these "end", "sbrk" and all the other missing symbols are all gone with #486.

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

Successfully merging this pull request may close these issues.

3 participants