Commit Graph

6661 Commits

Author SHA1 Message Date
Amy Huang 5127da0291 Revert "[COFF] Only consider associated EH sections during ICF"
This change causes an asan error for ODR violation.

This reverts commit 7ce9a3e9a9.
2021-03-29 19:15:35 -07:00
Jez Ng a43f588e01 [lld-macho] Implement -segprot
Addresses llvm.org/PR49405.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D99389
2021-03-29 14:08:12 -04:00
Jez Ng ae7aa9ed15 [lld-macho] Add time tracing for LTO
The test is similar to the one used for LLD-ELF.

Differential Revision: https://reviews.llvm.org/D99318
2021-03-26 18:14:10 -04:00
Jez Ng 94e369400e [lld-macho] Fix parsing of --time-trace-{granularity,file}
Summary: We needed to use `Joined` instead of `Flag`. This wasn't caught
because the relevant test that was copied from LLD-ELF was still
invoking LLD-ELF instead of LLD-MachO...

Differential Revision: https://reviews.llvm.org/D99313
2021-03-26 18:14:10 -04:00
Jez Ng 45cdceb40c [lld-macho] Support -no_function_starts
Pretty simple code-wise. Also threw in some refactoring:

* Put the functionStartSection under Writer instead of InStruct, since
  it doesn't need to be accessed outside of Writer
* Adjusted the test to put all files under the temp dir instead of at
  the top-level
* Added some CHECK-LABELs to make it clearer where the function starts
  data is

Differential Revision: https://reviews.llvm.org/D99112
2021-03-26 18:14:10 -04:00
Vy Nguyen dee5787d3e Reland [lld-macho][nfc] minor clean up, follow up to D98559
This reverts commit 77b4230ed9.

New change: Fixed tests on windows

     Differential Revision: https://reviews.llvm.org/D99210
2021-03-25 16:46:37 -04:00
Jez Ng 0113cf00b6 [lld-macho] Add support for --threads
Code and test are largely identical to the LLD-ELF equivalents.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D99312
2021-03-25 14:51:31 -04:00
Jez Ng 53fd1ada76 [lld-macho] Fix typo in diagnostic message 2021-03-25 14:51:31 -04:00
Martin Storsjö a88556733a [LLD] Fix probing a MSYS based 'tar' in a Windows Container
Don't run the 'tar' tool in a cleared environment with only the
LANG variable set, just set LANG on top of the existing environment.

If the 'tar' tool is an MSYS based tool, running it in a Windows
Container hangs if all environment variables are cleared - in
particular, the USERPROFILE variable needs to be kept intact.

This is the same issue fixed as was fixed in other places in
9de63b2e05, but contrary to running
the actual tests, running with an as-cleared-as-possible environment
here is less important.

Differential Revision: https://reviews.llvm.org/D99304
2021-03-25 09:45:27 +02:00
Vy Nguyen d988ffc34f [lld-macho][nfc] Fixed test so it output to %t/ rather than current directory.
The a.out broke our build.

Differential Revision: https://reviews.llvm.org/D99271
2021-03-24 16:55:37 -04:00
Konstantin Zhuravlyov 4f28303133 AMDGPU/LLD: Add target id and code object v4 support to linker
Differential Revision: https://reviews.llvm.org/D95811
2021-03-24 13:41:10 -04:00
Konstantin Zhuravlyov f4ace63737 AMDGPU: Add target id and code object v4 support
- Add target id support (https://clang.llvm.org/docs/ClangOffloadBundler.html#target-id)
  - Add code object v4 support (https://llvm.org/docs/AMDGPUUsage.html#elf-code-object)
    - Add kernarg_size to kernel descriptor
    - Change trap handler ABI to no longer move queue pointer into s[0:1]
  - Cleanup ELF definitions
    - Add V2, V3, V4 suffixes to make a clear distinction for code object version
    - Consolidate note names

Differential Revision: https://reviews.llvm.org/D95638
2021-03-24 11:54:05 -04:00
Andy Wingo 9ac5620cb8 [WebAssembly] Rename WasmLimits::Initial to ::Minimum. NFC.
This patch renames the "Initial" member of WasmLimits to the name used
in the spec, "Minimum".

In the core WebAssembly specification, the Limits data type has one
required "min" member and one optional "max" member, indicating the
minimum required size of the corresponding table or memory, and the
maximum size, if any.

Although the WebAssembly spec does instantiate locally-defined tables
and memories with the initial size being equal to the minimum size, it
can't impose such a requirement for imports.  It doesn't make sense to
require an initial size for a memory import, for example.  The compiler
can only sensibly express the minimum and maximum sizes.

See
https://github.com/WebAssembly/js-types/blob/master/proposals/js-types/Overview.md#naming-of-size-limits
for a related discussion that agrees that the right name of "initial" is
"minimum" when querying the type of a table or memory from JavaScript.
(Of course it still makes sense for JS to speak in terms of an initial
size when it explicitly instantiates memories and tables.)

Differential Revision: https://reviews.llvm.org/D99186
2021-03-24 09:10:11 +01:00
Shoaib Meenai 48d9b2fd8e [lld] Fix test to work with and without a vendor string 2021-03-23 16:16:25 -07:00
Vy Nguyen aa6e4cdd73 [lld-macho] Fixed lld-version expectation in test so it works on Fuchsia.
On Fuchsia, it's called Fuchsia LLD

Differential Revision: https://reviews.llvm.org/D99217
2021-03-23 17:56:23 -04:00
Vy Nguyen 77b4230ed9 Revert "[lld-macho][nfc] minor clean up, follow up to D98559"
This reverts commit 1bc33eb6a3.
tests failed on windows
2021-03-23 17:15:36 -04:00
Vy Nguyen 1bc33eb6a3 [lld-macho][nfc] minor clean up, follow up to D98559
Differential Revision: https://reviews.llvm.org/D99210
2021-03-23 16:13:09 -04:00
Vy Nguyen f499b932bf Revert "Revert "Revert "Revert "Revert "Revert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)""""""
This reverts commit 4876ba5b2d.

Third-attemp relanding D98559, new change:
  - explicitly cast enum to underlying type to avoid ambiguity (workaround to clang's bug).
2021-03-23 14:51:05 -04:00
Mehdi Amini 4876ba5b2d Revert "Revert "Revert "Revert "Revert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)"""""
This reverts commit 3c21166a94.
The build is broken (clang-8 host compiler):

lld/MachO/DriverUtils.cpp:271:8: error: use of overloaded operator '<<' is ambiguous (with operand types 'llvm::raw_fd_ostream' and 'lld::macho::DependencyTracker::DepOpCode')
    os << opcode;
    ~~ ^  ~~~~~~
2021-03-23 00:19:12 +00:00
Vy Nguyen 3c21166a94 Revert "Revert "Revert "Revert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)""""
This reverts commit 9670d2e4af.

Second attemp to reland D98559. New changes:
 - inline functions removed from cpp file.
 - updated tests to use CHECK-DAG instead of CHECK-NEXT
 - fixed ambiguous "<<" operator by switching `char` to uint8_t
2021-03-22 19:34:51 -04:00
Reid Kleckner 7ce9a3e9a9 [COFF] Only consider associated EH sections during ICF
The only known reason why ICF should not merge otherwise identical
sections with differing associated sections has to do with exception
handling tables. It's not clear what ICF should do when there are other
kinds of associated sections. In every other case when this has come up,
debug info and CF guard metadata, we have opted to make ICF ignore the
associated sections.

For comparison, ELF doesn't do anything for comdat groups. Instead,
.eh_frame is parsed to figure out if a section has an LSDA, and if so,
ICF is disabled.

Another issue is that the order of associated sections is not defined.
We have had issues in the past (crbug.com/1144476) where changing the
order of the .xdata/.pdata sections in the object file lead to large ICF
slowdowns.

To address these issues, I decided it would be best to explicitly
consider only .pdata and .xdata sections during ICF. This makes it easy
to ignore the object file order, and I think it makes the intention of
the code clearer.

I've also made the children() accessor return an empty list for
associated sections. This mostly only affects ICF and GC. This was the
behavior before I made this a linked list, so the behavior change should
be good. This had positive effects on chrome.dll: more .xdata sections
were merged that previously could not be merged because they were
associated with distinct .pdata sections.

Reviewed By: mstorsjo

Differential Revision: https://reviews.llvm.org/D98993
2021-03-22 15:36:26 -07:00
Reid Kleckner e5646e4570 [PDB] Add missing test for b552adf8b3 2021-03-22 14:56:36 -07:00
Vy Nguyen 9670d2e4af Revert "Revert "Revert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)"""
This reverts commit 5ad2c225f3.

bots still  unhappy - revertting again
2021-03-22 14:54:01 -04:00
Vy Nguyen 5ad2c225f3 Revert "Revert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)""
This reverts commit 2554b95db5.

Relanding [lld-macho] Implement -dependency_info (D98559) with changes:
 - inline functions removed from cpp file.
 - updated tests to not check libSystem.tbd with other input files (because of possible indeterministic ordering)
2021-03-22 14:41:57 -04:00
Stefan Pintilie f21704e080 [LLD][PowerPC] Fix bug in PC-Relative initial exec
There is a bug when initial exec is relaxed to local exec.
In the following situation:

InitExec.c
```
extern __thread unsigned TGlobal;
unsigned getConst(unsigned*);
unsigned addVal(unsigned, unsigned*);

unsigned GetAddrT() {
  return addVal(getConst(&TGlobal), &TGlobal);
}
```

Def.c
```
__thread unsigned TGlobal;

unsigned getConst(unsigned* A) {
  return *A + 3;
}

unsigned addVal(unsigned A, unsigned* B) {
  return A + *B;
}
```

The problem is in InitExec.c but Def.c is required if you want to link the example and see the problem.
To compile everything:
```
clang -O3 -mcpu=pwr10 -c InitExec.c
clang -O3 -mcpu=pwr10 -c Def.c
ld.lld InitExec.o Def.o -o IeToLe
```

If you objdump the problem object file:
```
$ llvm-objdump -dr --mcpu=pwr10 InitExec.o
```
you will get the following assembly:
```
0000000000000000 <GetAddrT>:
       0: a6 02 08 7c  	mflr 0
       4: f0 ff c1 fb  	std 30, -16(1)
       8: 10 00 01 f8  	std 0, 16(1)
       c: d1 ff 21 f8  	stdu 1, -48(1)
      10: 00 00 10 04 00 00 60 e4      	pld 3, 0(0), 1
		0000000000000010:  R_PPC64_GOT_TPREL_PCREL34	TGlobal
      18: 14 6a c3 7f  	add 30, 3, 13
		0000000000000019:  R_PPC64_TLS	TGlobal
      1c: 78 f3 c3 7f  	mr	3, 30
      20: 01 00 00 48  	bl 0x20
		0000000000000020:  R_PPC64_REL24_NOTOC	getConst
      24: 78 f3 c4 7f  	mr	4, 30
      28: 30 00 21 38  	addi 1, 1, 48
      2c: 10 00 01 e8  	ld 0, 16(1)
      30: f0 ff c1 eb  	ld 30, -16(1)
      34: a6 03 08 7c  	mtlr 0
      38: 00 00 00 48  	b 0x38
		0000000000000038:  R_PPC64_REL24_NOTOC	addVal
```
The lines of interest are:
```
      10: 00 00 10 04 00 00 60 e4      	pld 3, 0(0), 1
		0000000000000010:  R_PPC64_GOT_TPREL_PCREL34	TGlobal
      18: 14 6a c3 7f  	add 30, 3, 13
		0000000000000019:  R_PPC64_TLS	TGlobal
      1c: 78 f3 c3 7f  	mr	3, 30
```
Which once linked gets turned into:
```
10010210: ff ff 03 06 00 90 6d 38      	paddi 3, 13, -28672, 0
10010218: 00 00 00 60  	nop
1001021c: 78 f3 c3 7f  	mr	3, 30
```
The problem is that register 30 is never set after the optimization.

Therefore it is not correct to relax the above instructions by replacing
the add instruction with a nop.
Instead the add instruction should be replaced with a copy (mr) instruction.
If the add uses the same resgiter as input and as ouput then it is safe to
continue to replace the add with a nop.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D95262
2021-03-22 13:15:44 -05:00
Nico Weber 2554b95db5 Revert "[lld-macho] Implement -dependency_info (partially - more opcodes needed)"
This reverts commit c53a1322f3.
Test only passes depending on build dir having a lexicographically later name
than the source dir, and doesn't link on mac/win. See
https://reviews.llvm.org/D98559#2640265 onward.
2021-03-21 16:35:38 -04:00
Vy Nguyen c53a1322f3 [lld-macho] Implement -dependency_info (partially - more opcodes needed)
Bug: https://bugs.llvm.org/show_bug.cgi?id=49278
The flag is not well documented, so this implementation is based on observed behaviour.

When specified, `-dependency_info <path>` produced a text file containing information pertaining to the current linkage, such as input files, output file, linker version, etc.

This file's layout is also not documented, but it seems to be a series of null ('\0') terminated strings in the form `<op code><path>`

`<op code>` could be:
   `0x00` : linker version
   `0x10` : input
   `0x11` : files not found(??)
   `0x40` : output

`<path>` : is the file path, except for the linker-version case.

(??) This part is a bit unclear. I think it means all the files the linker attempted to look at, but could not find.

Differential Revision: https://reviews.llvm.org/D98559
2021-03-21 14:35:46 -04:00
Jez Ng 47fdaa32f9 [lld-macho] Minor touch-up to objc.s 2021-03-20 14:42:16 -04:00
Vy Nguyen 66f340051a [lld-macho] Define __mh_*_header synthetic symbols.
Bug: https://bugs.llvm.org/show_bug.cgi?id=49290

    Differential Revision: https://reviews.llvm.org/D97007
2021-03-19 14:14:40 -04:00
Fangrui Song 16c30c3c23 [ELF] Change --shuffle-sections=<seed> to --shuffle-sections=<section-glob>=<seed>
`--shuffle-sections=<seed>` applies to all sections.  The new
`--shuffle-sections=<section-glob>=<seed>` makes shuffling selective.  To the
best of my knowledge, the option is only used as debugging, so just drop the
original form.

`--shuffle-sections '.init_array*=-1'` `--shuffle-sections '.fini_array*=-1'`.
reverses static constructors/destructors of the same priority.
Useful to detect some static initialization order fiasco.

`--shuffle-sections '.data*=-1'`
reverses `.data*` sections. Useful to detect unfunded pointer comparison results
of two unrelated objects.

If certain sections have an intrinsic order, the old form cannot be used.

Differential Revision: https://reviews.llvm.org/D98679
2021-03-18 10:18:19 -07:00
caoming.roy ed8bff13dc [lld-macho] implement options -map
Implement command-line options -map

Reviewed By: int3, #lld-macho

Differential Revision: https://reviews.llvm.org/D98323
2021-03-18 10:39:19 -04:00
Fangrui Song 423cb321df [ELF] Special case --shuffle-sections=-1 to reverse input sections
If the number of sections changes, which is common for re-links after
incremental updates, the section order may change drastically.

Special case -1 to reverse input sections. This is a stable transform.
The section order is more resilient to incremental updates.  Usually the
code issue (e.g. Static Initialization Order Fiasco, assuming pointer
comparison result of two unrelated objects) is due to the relative order
between two problematic input files A and B.  Checking the regular order
and the reversed order is sufficient.

Differential Revision: https://reviews.llvm.org/D98445
2021-03-17 09:32:44 -07:00
Greg McGary db1e845a96 [lld-macho] Handle error cases properly for -exported_symbol(s_list)
This fixes defects in D98223 [lld-macho] implement options -(un)exported_symbol(s_list):
* disallow export of hidden symbols
* verify that whitelisted literal names are defined in the symbol table
* reflect export-status overrides in `nlist` attribute of `N_EXT` or `N_PEXT`

Thanks to @thakis for raising these issues

Differential Revision: https://reviews.llvm.org/D98381
2021-03-16 21:20:39 -07:00
Markus Böck af2796c76d [test] Add ability to get error messages from CMake for errc substitution
Visual Studios implementation of the C++ Standard Library does not use strerror to produce a message for std::error_code unlike other standard libraries such as libstdc++ or libc++ that might be used.

This patch adds a cmake script that through running a C++ program gets the error messages for the POSIX error codes and passes them onto lit through an optional config parameter.

If the config parameter is not set, or getting the messages failed, due to say a cross compiling configuration without an emulator, it will fall back to using pythons strerror functions.

Differential Revision: https://reviews.llvm.org/D98278
2021-03-15 20:56:08 +01:00
Jez Ng 29d4676059 [lld-macho] Place LC_FUNCTION_STARTS data at the right position
This pleases the codesign

(Otherwise it complains about "function starts data out of place")

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D98648
2021-03-15 14:56:31 -04:00
Jez Ng 4db4059c8c [lld-macho] Make range-check.s test more tolerant
Summary: The exact out-of-range value seems to differ by 8 bytes on the
buildbots compared to my local machine. I'm guessing it has something to
do with what inputs we are getting from llvm-mc. Not sure why, but I
don't think it's super important -- let's just ignore the number, the
out-of-range message is the important thing here
2021-03-12 18:45:14 -05:00
Jez Ng 38a6374564 [lld-macho] Only codesign by default on arm64 macOS
instead of doing it on all arm64 platforms.

Reviewed By: #lld-macho, gkm

Differential Revision: https://reviews.llvm.org/D98446
2021-03-12 17:26:27 -05:00
Jez Ng d8283d9ddc [lld-macho][nfc] Give every SyntheticSection a fake InputSection
Previously, it was difficult to write code that handled both synthetic
and regular sections generically. We solve this problem by creating a
fake InputSection at the start of every SyntheticSection.

This refactor allows us to handle DSOHandle like a regular Defined
symbol (since Defined symbols must be attached to an InputSection), and
paves the way for supporting `__mh_*header` symbols. Additionally, it
simplifies our binding/rebase code.

I did have to extend Defined a little -- it now has a `linkerInternal`
flag, to indicate that `___dso_handle` should not be in the final symbol
table.

I've also added some additional testing for `___dso_handle`.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D98545
2021-03-12 17:26:27 -05:00
Jez Ng dc8bee9265 [lld-macho] Check address ranges when applying relocations
This diff required fixing `getEmbeddedAddend` to apply sign
extension to 32-bit values. We were previously passing around wrong
64-bit addend values that became "right" after being truncated back to
32-bit.

I've also made `getEmbeddedAddend` return a signed int, which is similar
to what LLD-ELF does for its `getImplicitAddend`.

`reportRangeError`, `checkUInt`, and `checkInt` are counterparts of similar
functions in LLD-ELF.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D98387
2021-03-12 17:26:27 -05:00
Jez Ng d1e57ee99a [lld-macho] Avoid requiring shell in tests
There are 3 remaining tests that still have `REQUIRE: shell`:
* color-diagnostics.test -- seems necessary for ANSI escape sequence support
* stabs.s -- the shell part could be removed, but I don't think we can support
  the test on Windows anyway due to its reliance on `touch` to set the modtime
* framework.s -- uses symlinks, I'm not sure this works on Windows

Addresses PR49512.

Reviewed By: #lld-macho, alexshap

Differential Revision: https://reviews.llvm.org/D98395
2021-03-11 13:28:14 -05:00
Jez Ng a723db92d8 [lld-macho][nfc] Refactor subtractor reloc handling
SUBTRACTOR relocations are always paired with UNSIGNED
relocations to indicate a pair of symbols whose address difference we
want. Functionally they are like a single relocation: only one pointer
gets written / relocated. Previously, we would handle these pairs by
skipping over the SUBTRACTOR relocation and writing the pointer when
handling the UNSIGNED reloc. This diff reverses things, so we write
while handling SUBTRACTORs and skip over the UNSIGNED relocs instead.

Being able to distinguish between SUBTRACTOR and UNSIGNED relocs in the
write phase (i.e. inside `relocateOne`) is useful for the upcoming range
check diff: we want to check that SUBTRACTOR relocs write signed values,
but UNSIGNED relocs (naturally) write unsigned values.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D98386
2021-03-11 13:28:13 -05:00
Jez Ng e8a3058303 [lld-macho] Fix handling of X86_64_RELOC_SIGNED_{1,2,4}
The previous implementation miscalculated the addend, resulting
in an underflow. This meant that every SIGNED_N section relocation would
be associated with the last subsection (since the addend would now be a
huge number). We were "lucky" that this mistake was typically cancelled
out -- 64-to-32-bit-truncation meant that the final value was correct,
as long as subsections were not rearranged.

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D98385
2021-03-11 13:28:11 -05:00
Fangrui Song e4f385d894 [ELF] Support . and $ in symbol names in expressions
GNU ld supports `.` and `$` in symbol names while LLD doesn't support them in
`readPrimary` expressions. Using `.` can result in such an error:

```
https://github.com/ClangBuiltLinux/linux/issues/1318
ld.lld: error: ./arch/powerpc/kernel/vmlinux.lds:255: malformed number: .TOC.
>>>   __toc_ptr = (DEFINED (.TOC.) ? .TOC. : ADDR (.got)) + 0x8000;
```

Allow `.` (ppc64 special symbol `.TOC.`) and `$` (RISC-V special symbol `__global_pointer$`).

Change `diag[3-5].test` to use an invalid character `^`.

Note: GNU ld allows `~` in non-leading positions of a symbol name.  `~`
is not used in practice, conflicts with the unary operator, and can
cause some parsing difficulty, so this patch does not add it.

Differential Revision: https://reviews.llvm.org/D98306
2021-03-11 09:34:36 -08:00
Thorsten Schütt 50c1b21851 [lld-macho] minimal TimeTrace support
This is the minimal port from ELF. Any extension should easy from here

Test plan: ninja check-all-macho

Reviewed By: #lld-macho, thakis

Differential Revision: https://reviews.llvm.org/D98419
2021-03-11 15:30:45 +01:00
Nico Weber 6e92f468c8 [lld/mac] warn on -install_name without -dylib
The flag doesn't (and shouldn't) have an effect in that case.
ld64 doesn't warn on this, but it seems like a good thing to do.
If it causes problems in practice for some reason, we can revert it.

Also add a dedicated test for install_name.

Differential Revision: https://reviews.llvm.org/D98259
2021-03-10 09:05:44 -05:00
Nico Weber 1aafaaca67 [lld/mac] Implement support for -mark_dead_strippable_dylib
lld doesn't read MH_DEAD_STRIPPABLE_DYLIB to strip dead dylibs yet,
but now it can produce dylibs with it set.

While here, also switch an existing test that looks only at the main Mach-O
header from --all-headers to --private-header.

Differential Revision: https://reviews.llvm.org/D98262
2021-03-10 08:57:46 -05:00
Fangrui Song 74bece8dde [WPD][ELF] Allow whole program devirtualization for version script localized symbols
A `local:` version node in a version script can change the effective symbol binding
to STB_LOCAL. The linker needs to communicate the fact to enable WPD
(otherwise LTO does not know that the `!vcall_visibility` metadata has
effectively changed from VCallVisibilityPublic to VCallVisibilityLinkageUnit).

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D98220
2021-03-09 22:33:47 -08:00
Greg McGary 06c4aadeb6 [lld-macho] implement options -(un)exported_symbol(s_list)
Implement command-line options to alter a dylib's exported-symbols list:
* `-exported_symbol*` options override the default export list. The export list is compiled according to the command-line option(s) only.
* `-unexported_symbol*` options hide otherwise public symbols.
* `-*exported_symbol PATTERN` options specify a single literal or glob pattern.
* `-*exported_symbols_list FILE` options specify a file containing a series of lines containing symbol literals or glob patterns. Whitespace and `#`-prefix comments are stripped.

Note: This is a simple implementation of the primary use case. ld64 has much more complexity surrounding interactions with other options, many of which are obscure and undocumented. We will start simple and complexity as necessary.

Differential Revision: https://reviews.llvm.org/D98223
2021-03-09 18:43:39 -08:00
Fangrui Song 42e3f97a9d [MC] Change ELFOSABI_NONE to ELFOSABI_GNU for SHF_GNU_RETAIN
GNU ld does not give SHF_GNU_RETAIN GC root semantics for ELFOSABI_NONE.
(https://sourceware.org/pipermail/binutils/2021-March/115581.html)

This allows GNU ld to interpret SHF_GNU_RETAIN and avoids a gold quirk
https://sourceware.org/bugzilla/show_bug.cgi?id=27490

Because ELFObjectWriter is in an anonymous namespace, I have to place
`markGnuAbi` in the parent MCObjectWriter.

Differential Revision: https://reviews.llvm.org/D97976
2021-03-09 09:59:47 -08:00
Alexander Shaposhnikov 98f1564b88 [lld][MachO] Add missing test requirements
Similarly to the existing tests (e.g. stab.s) function-starts.s
is not supported on Windows.
2021-03-09 04:05:08 -08:00