diff mbox

model.lds.S: INPUT() bootsemi.o, not boot.o, if SEMIHOSTING

Message ID 1329162548-7595-1-git-send-email-peter.maydell@linaro.org
State Superseded
Headers show

Commit Message

Peter Maydell Feb. 13, 2012, 7:49 p.m. UTC
If SEMIHOSTING is defined then use the correct object file name
in the INPUT() directive. This fixes a failure to build
linux-system-semi.axf from clean.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Oops. I'll commit this to the git repo within the next day
or two unless somebody wants to object...

 model.lds.S |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Peter Maydell Feb. 13, 2012, 7:56 p.m. UTC | #1
On 13 February 2012 19:49, Peter Maydell <peter.maydell@linaro.org> wrote:
> diff --git a/model.lds.S b/model.lds.S
> index 3af4e07..10c13b1 100644
> --- a/model.lds.S
> +++ b/model.lds.S
> @@ -12,12 +12,14 @@ OUTPUT_ARCH(arm)
>  TARGET(binary)
>
>  INPUT(./monitor.o)
> -INPUT(./boot.o)
>  #ifndef SEMIHOSTING
> +INPUT(./boot.o)
>  INPUT(./uImage)
>  #ifdef USE_INITRD
>  INPUT(./filesystem.cpio.gz)
>  #endif
> +#else
> +INPUT(./bootsemi.o)
>  #endif

Actually it looks as if there's no need to have INPUT() lines for
the .o files at all, because the linker pulls in the correct ones
anyway when we refer to them in the SECTIONS{} part below [this is
why the resulting .axf works correctly for semihosting even when
there's an INPUT(./boot.o) line, because the linker uses bootsemi.o
anyway]. So I think we could just delete the
 INPUT(./monitor.o)
 INPUT(./boot.o)
lines altogether. Anybody with a better grasp of GNU ld linker
script syntax care to confirm/deny ?

-- PMM
Peter Maydell Feb. 17, 2012, 5:26 p.m. UTC | #2
On 13 February 2012 19:56, Peter Maydell <peter.maydell@linaro.org> wrote:
> Actually it looks as if there's no need to have INPUT() lines for
> the .o files at all, because the linker pulls in the correct ones
> anyway when we refer to them in the SECTIONS{} part below [this is
> why the resulting .axf works correctly for semihosting even when
> there's an INPUT(./boot.o) line, because the linker uses bootsemi.o
> anyway]. So I think we could just delete the
>  INPUT(./monitor.o)
>  INPUT(./boot.o)
> lines altogether. Anybody with a better grasp of GNU ld linker
> script syntax care to confirm/deny ?

I finally found the bit of the gas manual that confirms this (strictly
there is a tiny difference in that it won't search the archive search
path the way it would with INPUT(), but we don't care about that).
So I'll do a v2 of this patch that just drops the unnecessary INPUT()
lines.

-- PMM
diff mbox

Patch

diff --git a/model.lds.S b/model.lds.S
index 3af4e07..10c13b1 100644
--- a/model.lds.S
+++ b/model.lds.S
@@ -12,12 +12,14 @@  OUTPUT_ARCH(arm)
 TARGET(binary)
 
 INPUT(./monitor.o)
-INPUT(./boot.o)
 #ifndef SEMIHOSTING
+INPUT(./boot.o)
 INPUT(./uImage)
 #ifdef USE_INITRD
  INPUT(./filesystem.cpio.gz)
 #endif
+#else
+INPUT(./bootsemi.o)
 #endif