[PATCH] D74741: [ELF] Warn changed output section address

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 15:21:57 PST 2020


MaskRay created this revision.
MaskRay added reviewers: grimar, psmith, ruiu.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
MaskRay added a parent revision: D74736: [ELF] Use ALIGN to decide output section alignment.
MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: lld/test/ELF/linkerscript/section-align2.test:1
 # REQUIRES: aarch64
 # RUN: echo '.globl _start; _start: ret; .data.rel.ro; .balign 8; .byte 0; .data; .byte 0; \
----------------
AArch64 needs thunks. assignAddresses is called at least twice.

This enhances the test - it can detect duplicate diagnostic issue (https://sourceware.org/bugzilla/show_bug.cgi?id=25570 )


When the output section address (addrExpr) is specified, GNU ld warns if
sh_addr is different. This patch implements the warning.

Note, LinkerScript::assignAddresses can be called more than once. We
need to record the changed section addresses, and only report the
warnings when the addresses are finalized.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74741

Files:
  lld/ELF/LinkerScript.cpp
  lld/ELF/LinkerScript.h
  lld/ELF/Writer.cpp
  lld/test/ELF/linkerscript/lma-align.test
  lld/test/ELF/linkerscript/section-align2.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74741.245043.patch
Type: text/x-patch
Size: 4792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200217/214c48d2/attachment.bin>


More information about the llvm-commits mailing list